Skip to content

Commit d527ac1

Browse files
committed
Add option to control building XPTI libraries
1 parent 633ec40 commit d527ac1

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_SYCL_LIBRARY_DIR "" CACHE PATH
5253
"Path of the SYCL runtime library directory")
@@ -107,31 +108,34 @@ endif()
107108
if(UR_ENABLE_TRACING)
108109
add_compile_definitions(UR_ENABLE_TRACING)
109110

110-
# fetch xpti proxy library for the tracing layer
111-
FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "sycl-nightly/20230703" "xpti")
112-
FetchContent_MakeAvailable(xpti)
111+
if (UR_BUILD_XPTI_LIBS)
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)
113115

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

117-
# fetch the xptifw dispatcher, mostly used for testing
118-
# these variables need to be set for xptifw to compile
119-
set(XPTI_SOURCE_DIR ${xpti_SOURCE_DIR})
120-
set(XPTI_DIR ${xpti_SOURCE_DIR})
121-
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")
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")
122124

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

125-
FetchContent_MakeAvailable(xptifw)
127+
FetchContent_MakeAvailable(xptifw)
126128

127-
check_cxx_compiler_flag("-Wno-error=maybe-uninitialized" HAS_MAYBE_UNINIT)
128-
if (HAS_MAYBE_UNINIT)
129-
target_compile_options(xptifw PRIVATE -Wno-error=maybe-uninitialized)
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)
132+
endif()
133+
134+
set_target_properties(xptifw PROPERTIES
135+
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
136+
)
130137
endif()
131138

132-
set_target_properties(xptifw PROPERTIES
133-
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
134-
)
135139
if (MSVC)
136140
set(TARGET_XPTI $<IF:$<CONFIG:Release>,xpti,xptid>)
137141
else()

0 commit comments

Comments
 (0)