diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 07b5957123..ba73b80600 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -34,7 +34,8 @@ if(ENABLE_SPIRV) # Avoid POCL_EXPORT here target_compile_definitions(spirv_fix_atomic_compare_exchange PRIVATE SPIRV_PARSER_LIB) else() - add_executable(spirv_fix_atomic_compare_exchange spirv_fix_atomic_compare_exchange.cc) + add_executable(spirv_fix_atomic_compare_exchange spirv_fix_atomic_compare_exchange.cc "${SPVSRC}/spirv_parser.hh" "${SPVSRC}/spirv_parser.cc") + target_compile_definitions(spirv_fix_atomic_compare_exchange PRIVATE SPIRV_PARSER_LIB) endif() harden(spirv_fix_atomic_compare_exchange) target_link_libraries(spirv_fix_atomic_compare_exchange poclu ${OPENCL_LIBS}) diff --git a/include/pocl.h b/include/pocl.h index 0a9f672d0f..088f118a53 100644 --- a/include/pocl.h +++ b/include/pocl.h @@ -40,7 +40,7 @@ 0 marks an invalid/undefined object. */ typedef uint64_t pocl_obj_id_t; -#if defined(EXPORT_POCL_LIB) && defined(_MSC_VER) +#if defined(EXPORT_POCL_LIB) && defined(_WIN32) /* To successfully export OpenCL API, the dllexport must be placed on * both the declaration and the definition as MSVC requires that both * of them have the same attributes. diff --git a/lib/CL/CMakeLists.txt b/lib/CL/CMakeLists.txt index f82745d83f..ec17f6ab46 100644 --- a/lib/CL/CMakeLists.txt +++ b/lib/CL/CMakeLists.txt @@ -264,7 +264,7 @@ else() endif() add_library("pocl_cache" OBJECT "pocl_cache.c") -if(BUILD_SHARED_LIBS AND MSVC) +if(BUILD_SHARED_LIBS AND WIN32) # Inject __declspec(dllexport). target_compile_definitions("pocl_cache" PRIVATE EXPORT_POCL_LIB) target_compile_definitions("pocl_cache" INTERFACE IMPORT_POCL_LIB) @@ -326,7 +326,7 @@ if (ENABLE_LLVM) endif() endif() - if(BUILD_SHARED_LIBS AND MSVC) + if(BUILD_SHARED_LIBS AND WIN32) # Inject __declspec(dllexport). target_compile_definitions(lib_cl_llvm PRIVATE EXPORT_POCL_LIB) target_compile_definitions(lib_cl_llvm INTERFACE IMPORT_POCL_LIB) @@ -366,7 +366,7 @@ add_library("libpocl_unlinked_objs" OBJECT ${POCL_LIB_SOURCES}) target_include_directories(libpocl_unlinked_objs PRIVATE ${CMAKE_SOURCE_DIR}/thirdparty/STC/include) -if(BUILD_SHARED_LIBS AND MSVC) +if(BUILD_SHARED_LIBS AND WIN32) # Inject __declspec(dllexport). target_compile_definitions(libpocl_unlinked_objs PRIVATE EXPORT_POCL_LIB) target_compile_definitions(libpocl_unlinked_objs INTERFACE IMPORT_POCL_LIB) @@ -441,7 +441,7 @@ set(POCL_TRANSITIVE_LIBS ${POCL_PRIVATE_LINK_LIST} PARENT_SCOPE) ################################################################# add_library("${POCL_LIBRARY_NAME}" ${LIBPOCL_OBJS}) -if(BUILD_SHARED_LIBS AND MSVC) +if(BUILD_SHARED_LIBS AND WIN32) # Inject __declspec(dllexport). target_compile_definitions("${POCL_LIBRARY_NAME}" PRIVATE EXPORT_POCL_LIB) target_compile_definitions("${POCL_LIBRARY_NAME}" INTERFACE IMPORT_POCL_LIB) @@ -460,7 +460,7 @@ if((UNIX AND NOT APPLE) OR (MINGW AND HAVE_LINKER_EXCLUDE_LIBS)) target_link_options("${POCL_LIBRARY_NAME}" PRIVATE "LINKER:--exclude-libs,ALL") endif() if(MINGW) - target_link_options("${POCL_LIBRARY_NAME}" PRIVATE "LINKER:--enable-auto-import,--enable-runtime-pseudo-reloc") + target_link_options("${POCL_LIBRARY_NAME}" PRIVATE "LINKER:--exclude-all-symbols,--enable-auto-import,--enable-runtime-pseudo-reloc") endif() set_target_properties("${POCL_LIBRARY_NAME}" PROPERTIES SOVERSION "${LIB_API_VERSION}"