[llvm] [SYCL] Add libsycl, a SYCL RT library implementation project (PR #144372)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 06:46:04 PDT 2025


================
@@ -0,0 +1,115 @@
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes/cmake/Modules")
+include(WarningFlags)
+
+function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
+  # Add an optional argument so we can get the library name to
+  # link with for Windows Debug version
+  cmake_parse_arguments(ARG "" "IMPLIB_NAME" "COMPILE_OPTIONS;SOURCES" ${ARGN})
+
+  add_library(${LIB_OBJ_NAME} OBJECT ${ARG_SOURCES})
+
+  # Common compilation step setup
+  target_compile_definitions(${LIB_OBJ_NAME} PRIVATE $<$<BOOL:${MSVC}>:_LIBSYCL_BUILD_SYCL_DLL>)
+
+  target_include_directories(
+    ${LIB_OBJ_NAME}
+    PRIVATE
+      ${CMAKE_CURRENT_SOURCE_DIR}
+      ${LIBSYCL_BUILD_INCLUDE_DIR}
+  )
+
+  add_library(${LIB_NAME} SHARED
+              $<TARGET_OBJECTS:${LIB_OBJ_NAME}>)
----------------
jhuber6 wrote:

It's an object library above. I'm not sure why we need an object library and then a static library, usually object libraries are used for some indirection before creating the final library but seems like there's just one step here.

https://github.com/llvm/llvm-project/pull/144372


More information about the llvm-commits mailing list