Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ option(SYCL_ADD_DEV_VERSION_POSTFIX "Adds -V postfix to version string" ON)
option(SYCL_ENABLE_COVERAGE "Enables code coverage for runtime and unit tests" OFF)
option(SYCL_ENABLE_STACK_PRINTING "Enables stack printing on crashes of SYCL applications" OFF)
option(SYCL_LIB_WITH_DEBUG_SYMBOLS "Builds SYCL runtime libraries with debug symbols" OFF)
option(SYCL_ENABLE_IPO "Builds SYCL runtime libraries with interprocedural optimization" OFF)

if (NOT SYCL_COVERAGE_PATH)
set(SYCL_COVERAGE_PATH "${CMAKE_CURRENT_BINARY_DIR}/profiles")
Expand Down
16 changes: 16 additions & 0 deletions sycl/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#cmake_policy(SET CMP0057 NEW)
#include(AddLLVM)
include(CheckLinkerFlag)
include(CheckIPOSupported)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
Expand All @@ -16,13 +17,24 @@ if (SYCL_ENABLE_XPTI_TRACING)
include_directories(${LLVM_EXTERNAL_XPTI_SOURCE_DIR}/include)
endif()

if(SYCL_ENABLE_IPO)
check_ipo_supported(RESULT SYCL_USE_IPO)
if (NOT SYCL_USE_IPO)
message(WARNING "Interprocedural optimization is not supported by the compiler, disabling")
endif()
endif()

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 "" "XPTI_LIB;IMPLIB_NAME" "COMPILE_OPTIONS;SOURCES" ${ARGN})

add_library(${LIB_OBJ_NAME} OBJECT ${ARG_SOURCES})

if(SYCL_USE_IPO)
set_property(TARGET ${LIB_OBJ_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

# Common compilation step setup

check_cxx_compiler_flag(-Winstantiation-after-specialization
Expand Down Expand Up @@ -79,6 +91,10 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
$<TARGET_OBJECTS:${LIB_OBJ_NAME}>
${CMAKE_CURRENT_BINARY_DIR}/version.rc)

if(SYCL_USE_IPO)
set_property(TARGET ${LIB_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

find_package(Threads REQUIRED)

target_link_libraries(${LIB_NAME}
Expand Down