@@ -24,6 +24,24 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
2424
2525 # Common compilation step setup
2626
27+ check_cxx_compiler_flag(-Winstantiation-after-specialization
28+ HAS_INST_AFTER_SPEC)
29+
30+ target_compile_options (
31+ ${LIB_OBJ_NAME}
32+ PRIVATE
33+ ${ARG_COMPILE_OPTIONS}
34+ $<$<BOOL :${HAS_INST_AFTER_SPEC} >:-Winstantiation-after-specialization>
35+ PUBLIC
36+ $<$<NOT :$<BOOL :${MSVC} >>:-fvisibility=hidden -fvisibility-inlines-hidden>
37+ # Sycl math built-in macros cause a GCC 4.6 'note' to be output
38+ # repeatedly.
39+ # => note: the ABI for passing parameters with 32-byte alignment has
40+ # changed in GCC 4.6
41+ # Seems to be no way to suppress it except use -Wno-psabi
42+ $<$<NOT :$<BOOL :${MSVC} >>:-Wno-psabi>
43+ )
44+
2745 target_compile_definitions (
2846 ${LIB_OBJ_NAME}
2947 PRIVATE
@@ -107,10 +125,6 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
107125 )
108126 endif ()
109127
110- if (ARG_COMPILE_OPTIONS)
111- target_compile_options (${LIB_OBJ_NAME} PRIVATE ${ARG_COMPILE_OPTIONS} )
112- endif ()
113-
114128 add_dependencies (${LIB_OBJ_NAME}
115129 sycl-headers
116130 )
@@ -162,14 +176,6 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
162176 # Install stripped PDB
163177 add_stripped_pdb(${LIB_NAME} )
164178 else ()
165- target_compile_options (${LIB_OBJ_NAME} PUBLIC
166- -fvisibility=hidden -fvisibility-inlines-hidden)
167-
168- # Sycl math built-in macros cause a GCC 4.6 'note' to be output repeatedly.
169- # => note: the ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
170- # Seems to be no way to suppress it except use -Wno-psabi
171- target_compile_options (${LIB_OBJ_NAME} PUBLIC -Wno-psabi)
172-
173179 if (UNIX AND NOT APPLE )
174180 set (linker_script "${CMAKE_CURRENT_SOURCE_DIR} /ld-version-script.txt" )
175181 target_link_libraries (
@@ -203,13 +209,6 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
203209 VERSION ${SYCL_VERSION_STRING}
204210 SOVERSION ${SYCL_MAJOR_VERSION} )
205211
206- check_cxx_compiler_flag(-Winstantiation-after-specialization
207- HAS_INST_AFTER_SPEC)
208- if (HAS_INST_AFTER_SPEC)
209- target_compile_options (${LIB_OBJ_NAME} PRIVATE
210- -Winstantiation-after-specialization)
211- endif ()
212-
213212 # When building using icx on Windows, the VERSION file
214213 # produced by cmake is used in source code
215214 # when including '<version>' because Windows is
0 commit comments