@@ -2,6 +2,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes/cmake/
22include (WarningFlags)
33
44function (add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
5+ if (NOT LLVM_ENABLE_PIC)
6+ message ( FATAL_ERROR "Position-Independent Code generation is required for libsycl shared library" )
7+ endif ()
58 # Add an optional argument so we can get the library name to
69 # link with for Windows Debug version
710 cmake_parse_arguments (ARG "" "IMPLIB_NAME" "COMPILE_OPTIONS;SOURCES" ${ARGN} )
@@ -10,6 +13,7 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
1013
1114 # Common compilation step setup
1215 target_compile_definitions (${LIB_OBJ_NAME} PRIVATE $<$<BOOL :${MSVC} >:_LIBSYCL_BUILD_SYCL_DLL>)
16+ cxx_add_warning_flags(${LIB_OBJ_NAME} ${LIBSYCL_ENABLE_WERROR} ${LIBSYCL_ENABLE_PEDANTIC} )
1317
1418 target_include_directories (
1519 ${LIB_OBJ_NAME}
@@ -21,12 +25,6 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
2125 add_library (${LIB_NAME} SHARED
2226 $<TARGET_OBJECTS:${LIB_OBJ_NAME} >)
2327
24- if (ARG_COMPILE_OPTIONS)
25- target_compile_options (${LIB_OBJ_NAME} PRIVATE ${ARG_COMPILE_OPTIONS} )
26- endif ()
27-
28- cxx_add_warning_flags(${LIB_OBJ_NAME} ${LIBSYCL_ENABLE_WERROR} ${LIBSYCL_ENABLE_PEDANTIC} )
29-
3028 add_dependencies (${LIB_OBJ_NAME}
3129 sycl-headers
3230 )
@@ -98,14 +96,12 @@ endif()
9896# Version-agnostic name of the import library, has effect on Windows only.
9997set (IMPLIB_NAME "sycl" )
10098
101- add_sycl_rt_library(${LIB_NAME} sycl_object COMPILE_OPTIONS ${LIBSYCL_EXTRA_OPTS}
99+ add_sycl_rt_library(${LIB_NAME} sycl_object
102100 SOURCES ${LIBSYCL_SOURCES} IMPLIB_NAME ${IMPLIB_NAME} )
103101
104102if (WIN32 )
105103 add_library (sycl ALIAS ${LIB_NAME} )
106- endif ()
107104
108- if (CMAKE_SYSTEM_NAME STREQUAL Windows)
109105 set_target_properties (${LIB_NAME} PROPERTIES DEBUG_POSTFIX d)
110106endif ()
111107
0 commit comments