From 01992603ededc225cea6c3a1a9b370bbefe4d4d9 Mon Sep 17 00:00:00 2001 From: "Shelegov, Maksim" Date: Mon, 9 Sep 2024 17:38:30 +0000 Subject: [PATCH] Fix in-tree build Do not limit component installation to external build --- CMakeLists.txt | 3 -- GenXIntrinsics/CMakeLists.txt | 74 ++++++++++++++++------------------- 2 files changed, 33 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a04f4b16..71f55560 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,6 @@ set(LLVM_GENX_INTRINSICS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) get_filename_component(LLVM_CMAKE_PATH ${LLVM_DIR} ABSOLUTE BASE_DIR ${CMAKE_BINARY_DIR}) set(BUILD_EXTERNAL YES) - if(NOT DEFINED INSTALL_REQUIRED) - set(INSTALL_REQUIRED YES) - endif() project(LLVM_GenXIntrinsics VERSION ${LLVM_GENX_INTRINSICS_VERSION} diff --git a/GenXIntrinsics/CMakeLists.txt b/GenXIntrinsics/CMakeLists.txt index 689e7558..daf21553 100644 --- a/GenXIntrinsics/CMakeLists.txt +++ b/GenXIntrinsics/CMakeLists.txt @@ -47,44 +47,36 @@ if(VC_INTR_ENABLE_LIT_TESTS) endif() endif() -# this option is to switch on install when we are building not inside IGC -if(INSTALL_REQUIRED) - install(DIRECTORY include/llvm - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT genx-intrinsics-headers - FILES_MATCHING - PATTERN "*.h" - ) - - # cmake creates too many subdirectories in build directory - # and then "install(DIRECTORY" installs them even if they are empty - # so generated file has to be installed separetely - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/llvm/GenXIntrinsics/${GENX_INTRINSICS_DESCRIPTION} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm/GenXIntrinsics - COMPONENT genx-intrinsics-headers - ) - - # for now not clear do we need to check deps on install, - # so config will only contain single file - # we need to limit it to external build - if(BUILD_EXTERNAL) - install(TARGETS LLVMGenXIntrinsics EXPORT LLVMGenXIntrinsicsTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ) - - # Legacy export. To remove when all clients switch to new name. - install(EXPORT LLVMGenXIntrinsicsTargets - FILE LLVMGenXIntrinsicsConfig.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LLVMGenXIntrinsics - ) - - set(PACKAGE_NAME VCIntrinsics${LLVM_VERSION_MAJOR}) - install(EXPORT LLVMGenXIntrinsicsTargets - FILE ${PACKAGE_NAME}Config.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME} - ) - endif() # BUILD_EXTERNAL -endif() # INSTALL_REQUIRED +install(DIRECTORY include/llvm + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT genx-intrinsics-headers + FILES_MATCHING + PATTERN "*.h" +) + +# cmake creates too many subdirectories in build directory +# and then "install(DIRECTORY" installs them even if they are empty +# so generated file has to be installed separetely +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/llvm/GenXIntrinsics/${GENX_INTRINSICS_DESCRIPTION} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm/GenXIntrinsics + COMPONENT genx-intrinsics-headers +) + +install(TARGETS LLVMGenXIntrinsics EXPORT LLVMGenXIntrinsicsTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +# Legacy export. To remove when all clients switch to new name. +install(EXPORT LLVMGenXIntrinsicsTargets + FILE LLVMGenXIntrinsicsConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LLVMGenXIntrinsics +) + +set(PACKAGE_NAME VCIntrinsics${LLVM_VERSION_MAJOR}) +install(EXPORT LLVMGenXIntrinsicsTargets + FILE ${PACKAGE_NAME}Config.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME} +)