Skip to content

Commit

Permalink
Fix in-tree build
Browse files Browse the repository at this point in the history
Do not limit component installation to external build
  • Loading branch information
mshelego authored and sys-cmllvm committed Sep 9, 2024
1 parent 98ff865 commit 0199260
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 44 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
74 changes: 33 additions & 41 deletions GenXIntrinsics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)

0 comments on commit 0199260

Please sign in to comment.