Skip to content

Commit

Permalink
Fix cache-creator build.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojbao committed Jan 2, 2024
1 parent efc2d75 commit 53656ff
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tools/cache_creator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ include(LLVMConfig)
# Find all the LLVM libraries necessary to use the LLVM components that we use.
# See https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project.
llvm_map_components_to_libnames(llvm_libs Object Support)
target_link_libraries(cache_creator_lib INTERFACE pal xgl_cache_support ${llvm_libs})
target_link_libraries(cache_creator_lib INTERFACE pal xgl_cache_support ${llvm_libs} llpc_version)

target_include_directories(cache_creator_lib INTERFACE
${XGL_LLVM_SRC_PATH}/include
Expand Down Expand Up @@ -64,6 +64,20 @@ if(NOT LLVM_ENABLE_RTTI)
endif()
endif()

if(CMAKE_BUILD_TYPE_RELEASE AND XGL_ENABLE_LTO)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
#target_link_options(xgl PRIVATE -Wno-stringop-overflow)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 5.3 OR GCC_VERSION VERSION_EQUAL 5.3)
target_link_libraries(cache_creator_lib INTERFACE -flto=4 -fuse-linker-plugin -Wno-odr)
message(WARNING "LTO enabled for Linking")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# LTO enabled for final Linking (clang)
target_link_libraries(cache_creator_lib INTERFACE -flto=thin)
endif()
endif()

target_sources(cache_creator_lib INTERFACE cache_creator.cpp cache_info.cpp)

# This executable takes AMDGPU elf files as input and outputs a Vulkan cache file blob
Expand Down

0 comments on commit 53656ff

Please sign in to comment.