Skip to content

Commit ef2338b

Browse files
authored
Merge pull request #1647 from callumfare/callum/xpti_build_option
Add option to control building XPTI libraries
2 parents 3e49b01 + d527ac1 commit ef2338b

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

CMakeLists.txt

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ option(UR_BUILD_ADAPTER_ALL "Build all currently supported adapters" OFF)
4747
option(UR_BUILD_EXAMPLE_CODEGEN "Build the codegen example." OFF)
4848
option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF)
4949
option(UR_ENABLE_ASSERTIONS "Enable assertions for all build types" OFF)
50+
option(UR_BUILD_XPTI_LIBS "Build the XPTI libraries when tracing is enabled" ON)
5051
set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable")
5152
set(UR_DPCXX_BUILD_FLAGS "" CACHE STRING "Build flags to pass to DPC++ when compiling device programs")
5253
set(UR_SYCL_LIBRARY_DIR "" CACHE PATH
@@ -109,31 +110,34 @@ endif()
109110
if(UR_ENABLE_TRACING)
110111
add_compile_definitions(UR_ENABLE_TRACING)
111112

112-
# fetch xpti proxy library for the tracing layer
113-
FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "sycl-nightly/20230703" "xpti")
114-
FetchContent_MakeAvailable(xpti)
113+
if (UR_BUILD_XPTI_LIBS)
114+
# fetch xpti proxy library for the tracing layer
115+
FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "sycl-nightly/20230703" "xpti")
116+
FetchContent_MakeAvailable(xpti)
115117

116-
# set -fPIC for xpti since we are linking it with a shared library
117-
set_target_properties(xpti PROPERTIES POSITION_INDEPENDENT_CODE ON)
118+
# set -fPIC for xpti since we are linking it with a shared library
119+
set_target_properties(xpti PROPERTIES POSITION_INDEPENDENT_CODE ON)
118120

119-
# fetch the xptifw dispatcher, mostly used for testing
120-
# these variables need to be set for xptifw to compile
121-
set(XPTI_SOURCE_DIR ${xpti_SOURCE_DIR})
122-
set(XPTI_DIR ${xpti_SOURCE_DIR})
123-
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")
121+
# fetch the xptifw dispatcher, mostly used for testing
122+
# these variables need to be set for xptifw to compile
123+
set(XPTI_SOURCE_DIR ${xpti_SOURCE_DIR})
124+
set(XPTI_DIR ${xpti_SOURCE_DIR})
125+
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")
124126

125-
FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "sycl-nightly/20230703" "xptifw")
127+
FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "sycl-nightly/20230703" "xptifw")
126128

127-
FetchContent_MakeAvailable(xptifw)
129+
FetchContent_MakeAvailable(xptifw)
128130

129-
check_cxx_compiler_flag("-Wno-error=maybe-uninitialized" HAS_MAYBE_UNINIT)
130-
if (HAS_MAYBE_UNINIT)
131-
target_compile_options(xptifw PRIVATE -Wno-error=maybe-uninitialized)
131+
check_cxx_compiler_flag("-Wno-error=maybe-uninitialized" HAS_MAYBE_UNINIT)
132+
if (HAS_MAYBE_UNINIT)
133+
target_compile_options(xptifw PRIVATE -Wno-error=maybe-uninitialized)
134+
endif()
135+
136+
set_target_properties(xptifw PROPERTIES
137+
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
138+
)
132139
endif()
133140

134-
set_target_properties(xptifw PROPERTIES
135-
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
136-
)
137141
if (MSVC)
138142
set(TARGET_XPTI $<IF:$<CONFIG:Release>,xpti,xptid>)
139143
else()

0 commit comments

Comments
 (0)