Skip to content

Commit

Permalink
Merge pull request #1647 from callumfare/callum/xpti_build_option
Browse files Browse the repository at this point in the history
Add option to control building XPTI libraries
  • Loading branch information
kbenzie committed May 23, 2024
2 parents 3e49b01 + d527ac1 commit ef2338b
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ option(UR_BUILD_ADAPTER_ALL "Build all currently supported adapters" OFF)
option(UR_BUILD_EXAMPLE_CODEGEN "Build the codegen example." OFF)
option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF)
option(UR_ENABLE_ASSERTIONS "Enable assertions for all build types" OFF)
option(UR_BUILD_XPTI_LIBS "Build the XPTI libraries when tracing is enabled" ON)
set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable")
set(UR_DPCXX_BUILD_FLAGS "" CACHE STRING "Build flags to pass to DPC++ when compiling device programs")
set(UR_SYCL_LIBRARY_DIR "" CACHE PATH
Expand Down Expand Up @@ -109,31 +110,34 @@ endif()
if(UR_ENABLE_TRACING)
add_compile_definitions(UR_ENABLE_TRACING)

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

# set -fPIC for xpti since we are linking it with a shared library
set_target_properties(xpti PROPERTIES POSITION_INDEPENDENT_CODE ON)
# set -fPIC for xpti since we are linking it with a shared library
set_target_properties(xpti PROPERTIES POSITION_INDEPENDENT_CODE ON)

# fetch the xptifw dispatcher, mostly used for testing
# these variables need to be set for xptifw to compile
set(XPTI_SOURCE_DIR ${xpti_SOURCE_DIR})
set(XPTI_DIR ${xpti_SOURCE_DIR})
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")
# fetch the xptifw dispatcher, mostly used for testing
# these variables need to be set for xptifw to compile
set(XPTI_SOURCE_DIR ${xpti_SOURCE_DIR})
set(XPTI_DIR ${xpti_SOURCE_DIR})
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")

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

FetchContent_MakeAvailable(xptifw)
FetchContent_MakeAvailable(xptifw)

check_cxx_compiler_flag("-Wno-error=maybe-uninitialized" HAS_MAYBE_UNINIT)
if (HAS_MAYBE_UNINIT)
target_compile_options(xptifw PRIVATE -Wno-error=maybe-uninitialized)
check_cxx_compiler_flag("-Wno-error=maybe-uninitialized" HAS_MAYBE_UNINIT)
if (HAS_MAYBE_UNINIT)
target_compile_options(xptifw PRIVATE -Wno-error=maybe-uninitialized)
endif()

set_target_properties(xptifw PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
)
endif()

set_target_properties(xptifw PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
)
if (MSVC)
set(TARGET_XPTI $<IF:$<CONFIG:Release>,xpti,xptid>)
else()
Expand Down

0 comments on commit ef2338b

Please sign in to comment.