File tree Expand file tree Collapse file tree 5 files changed +77
-34
lines changed Expand file tree Collapse file tree 5 files changed +77
-34
lines changed Original file line number Diff line number Diff line change @@ -22,37 +22,3 @@ if (NOT MSVC)
22
22
add_subdirectory (esimd_cpu )
23
23
endif ()
24
24
endif ()
25
-
26
- set ( SYCL_PLUGIN_TARGETS
27
- pi_opencl
28
- pi_level_zero )
29
-
30
- if (SYCL_BUILD_PI_ESIMD_CPU )
31
- list (APPEND SYCL_PLUGIN_TARGETS pi_esimd_cpu )
32
- endif ()
33
-
34
- if (SYCL_BUILD_PI_CUDA )
35
- list (APPEND SYCL_PLUGIN_TARGETS pi_cuda )
36
- endif ()
37
-
38
- foreach (pi_plugin ${SYCL_PLUGIN_TARGETS} )
39
- if (MSVC )
40
- # by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
41
- # which are individually tagged for all pi* symbols in pi.h
42
- target_compile_definitions (${pi_plugin} PRIVATE __SYCL_BUILD_SYCL_DLL )
43
- else ()
44
- # we set the visibility of all symbols 'hidden' by default.
45
- # In pi.h file, we set exported symbols with visibility==default individually
46
- target_compile_options (${pi_plugin} PUBLIC -fvisibility=hidden )
47
-
48
- # This script file is used to allow exporting pi* symbols only.
49
- # All other symbols are regarded as local (hidden)
50
- set (linker_script "${CMAKE_CURRENT_SOURCE_DIR} /../ld-version-script.txt" )
51
-
52
- # Filter symbols based on the scope defined in the script file,
53
- # and export pi* function symbols in the library.
54
- target_link_libraries (${pi_plugin} PRIVATE "-Wl,--version-script=${linker_script} " )
55
- endif ()
56
-
57
- endforeach ()
58
-
Original file line number Diff line number Diff line change @@ -45,6 +45,24 @@ target_link_libraries(pi_cuda
45
45
cudadrv
46
46
)
47
47
48
+ if (MSVC )
49
+ # by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
50
+ # which are individually tagged for all pi* symbols in pi.h
51
+ target_compile_definitions (pi_cuda PRIVATE __SYCL_BUILD_SYCL_DLL )
52
+ else ()
53
+ # we set the visibility of all symbols 'hidden' by default.
54
+ # In pi.h file, we set exported symbols with visibility==default individually
55
+ target_compile_options (pi_cuda PUBLIC -fvisibility=hidden )
56
+
57
+ # This script file is used to allow exporting pi* symbols only.
58
+ # All other symbols are regarded as local (hidden)
59
+ set (linker_script "${CMAKE_CURRENT_SOURCE_DIR} /../ld-version-script.txt" )
60
+
61
+ # Filter symbols based on the scope defined in the script file,
62
+ # and export pi* function symbols in the library.
63
+ target_link_libraries (pi_cuda PRIVATE "-Wl,--version-script=${linker_script} " )
64
+ endif ()
65
+
48
66
add_common_options (pi_cuda )
49
67
50
68
install (TARGETS pi_cuda
Original file line number Diff line number Diff line change @@ -101,6 +101,26 @@ add_library(pi_esimd_cpu SHARED
101
101
"pi_esimd_cpu.cpp"
102
102
)
103
103
104
+ if (MSVC )
105
+ # by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
106
+ # which are individually tagged for all pi* symbols in pi.h
107
+ target_compile_definitions (pi_esimd_cpu PRIVATE __SYCL_BUILD_SYCL_DLL )
108
+ else ()
109
+ # we set the visibility of all symbols 'hidden' by default.
110
+ # In pi.h file, we set exported symbols with visibility==default individually
111
+ target_compile_options (pi_esimd_cpu PUBLIC -fvisibility=hidden )
112
+
113
+ # This script file is used to allow exporting pi* symbols only.
114
+ # All other symbols are regarded as local (hidden)
115
+ set (linker_script "${CMAKE_CURRENT_SOURCE_DIR} /../ld-version-script.txt" )
116
+
117
+ # Filter symbols based on the scope defined in the script file,
118
+ # and export pi* function symbols in the library.
119
+ target_link_libraries ( pi_esimd_cpu
120
+ PRIVATE "-Wl,--version-script=${linker_script} "
121
+ )
122
+ endif ()
123
+
104
124
add_dependencies (pi_esimd_cpu OpenCL-Headers )
105
125
add_dependencies (pi_esimd_cpu cm-emu )
106
126
add_dependencies (sycl-toolchain pi_esimd_cpu )
Original file line number Diff line number Diff line change @@ -110,6 +110,26 @@ add_library(pi_level_zero SHARED
110
110
"${CMAKE_CURRENT_SOURCE_DIR} /usm_allocator.hpp"
111
111
)
112
112
113
+ if (MSVC )
114
+ # by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
115
+ # which are individually tagged for all pi* symbols in pi.h
116
+ target_compile_definitions (pi_level_zero PRIVATE __SYCL_BUILD_SYCL_DLL )
117
+ else ()
118
+ # we set the visibility of all symbols 'hidden' by default.
119
+ # In pi.h file, we set exported symbols with visibility==default individually
120
+ target_compile_options (pi_level_zero PUBLIC -fvisibility=hidden )
121
+
122
+ # This script file is used to allow exporting pi* symbols only.
123
+ # All other symbols are regarded as local (hidden)
124
+ set (linker_script "${CMAKE_CURRENT_SOURCE_DIR} /../ld-version-script.txt" )
125
+
126
+ # Filter symbols based on the scope defined in the script file,
127
+ # and export pi* function symbols in the library.
128
+ target_link_libraries ( pi_level_zero
129
+ PRIVATE "-Wl,--version-script=${linker_script} "
130
+ )
131
+ endif ()
132
+
113
133
if (TARGET level-zero-loader )
114
134
add_dependencies (pi_level_zero level-zero-loader )
115
135
endif ()
Original file line number Diff line number Diff line change @@ -28,6 +28,25 @@ target_link_libraries(pi_opencl
28
28
OpenCL-Headers
29
29
OpenCL-ICD
30
30
)
31
+ if (MSVC )
32
+ # by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
33
+ # which are individually tagged for all pi* symbols in pi.h
34
+ target_compile_definitions (pi_opencl PRIVATE __SYCL_BUILD_SYCL_DLL )
35
+ else ()
36
+ # we set the visibility of all symbols 'hidden' by default.
37
+ # In pi.h file, we set exported symbols with visibility==default individually
38
+ target_compile_options (pi_opencl PUBLIC -fvisibility=hidden )
39
+
40
+ # This script file is used to allow exporting pi* symbols only.
41
+ # All other symbols are regarded as local (hidden)
42
+ set (linker_script "${CMAKE_CURRENT_SOURCE_DIR} /../ld-version-script.txt" )
43
+
44
+ # Filter symbols based on the scope defined in the script file,
45
+ # and export pi* function symbols in the library.
46
+ target_link_libraries ( pi_opencl
47
+ PRIVATE "-Wl,--version-script=${linker_script} "
48
+ )
49
+ endif ()
31
50
32
51
add_common_options (pi_opencl )
33
52
You can’t perform that action at this time.
0 commit comments