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

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 07:12:05 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}>)
----------------
KseniyaTikhomirova wrote:

This split is done for SYCL RT unittests (UT) target that is not included to this PR.
1) we do not provide SYCL RT static lib and don't plan to
2) fPIC option is set by default in LLVM (see LLVM_ENABLE_PIC)
3) the usage is that we have object library sycl_object. It is used for shared library "sycl" creation and for UT executable creation (not included to this PR).

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


More information about the llvm-commits mailing list