Skip to content

Commit

Permalink
Revert "[cmake] Use GNUInstallDirs to support custom installation d…
Browse files Browse the repository at this point in the history
…irs."

https://lab.llvm.org/buildbot/#/builders/46/builds/21146 Still have
this odd error, not sure how to reproduce, so I will just try breaking
up my patch.

This reverts commit 4a678f8.
  • Loading branch information
Ericson2314 committed Jan 16, 2022
1 parent 4a678f8 commit da77db5
Show file tree
Hide file tree
Showing 36 changed files with 68 additions and 96 deletions.
1 change: 0 additions & 1 deletion clang-tools-extra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include(CMakeDependentOption)
include(GNUInstallDirs)

option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
"Include static analyzer checks in clang-tidy" ON)
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-doc/tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ target_link_libraries(clang-doc
)

install(FILES ../assets/clang-doc-default-stylesheet.css
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-doc)

install(FILES ../assets/index.js
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-doc)
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ target_link_libraries(find-all-symbols
)

install(PROGRAMS run-find-all-symbols.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT find-all-symbols)
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ target_link_libraries(clang-include-fixer
)

install(PROGRAMS clang-include-fixer.el
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-include-fixer)
install(PROGRAMS clang-include-fixer.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-include-fixer)
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ add_subdirectory(utils)

if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY .
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/clang-tidy"
DESTINATION include/clang-tidy
COMPONENT clang-tidy-headers
FILES_MATCHING
PATTERN "*.h"
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-tidy/tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ target_link_libraries(clang-tidy


install(PROGRAMS clang-tidy-diff.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-tidy)
install(PROGRAMS run-clang-tidy.py
DESTINATION "${CMAKE_INSTALL_BINDIR}"
DESTINATION bin
COMPONENT clang-tidy
RENAME run-clang-tidy)
2 changes: 1 addition & 1 deletion clang-tools-extra/modularize/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ clang_target_link_libraries(modularize
)

install(TARGETS modularize
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
RUNTIME DESTINATION bin
COMPONENT clang-extras)
8 changes: 3 additions & 5 deletions clang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.13.4)

include(GNUInstallDirs)

# If we are not building as a part of LLVM, build Clang as an
# standalone project, using LLVM as an external library:
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
Expand Down Expand Up @@ -426,7 +424,7 @@ include_directories(BEFORE

if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/clang include/clang-c
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
DESTINATION include
COMPONENT clang-headers
FILES_MATCHING
PATTERN "*.def"
Expand All @@ -435,7 +433,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
DESTINATION include
COMPONENT clang-headers
FILES_MATCHING
PATTERN "CMakeFiles" EXCLUDE
Expand All @@ -455,7 +453,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)

add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
install(PROGRAMS utils/bash-autocomplete.sh
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT bash-autocomplete)
if(NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-bash-autocomplete
Expand Down
5 changes: 2 additions & 3 deletions clang/cmake/modules/AddClang.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include(GNUInstallDirs)
include(LLVMDistributionSupport)

function(clang_tablegen)
Expand Down Expand Up @@ -121,7 +120,7 @@ macro(add_clang_library name)
${export_to_clangtargets}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
RUNTIME DESTINATION bin)

if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${lib}
Expand Down Expand Up @@ -160,7 +159,7 @@ macro(add_clang_tool name)
get_target_export_arg(${name} Clang export_to_clangtargets)
install(TARGETS ${name}
${export_to_clangtargets}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
RUNTIME DESTINATION bin
COMPONENT ${name})

if(NOT LLVM_ENABLE_IDE)
Expand Down
2 changes: 1 addition & 1 deletion clang/tools/c-index-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
"@executable_path/../../lib")
else()
set(INSTALL_DESTINATION "${CMAKE_INSTALL_BINDIR}")
set(INSTALL_DESTINATION bin)
endif()

install(TARGETS c-index-test
Expand Down
12 changes: 6 additions & 6 deletions clang/tools/clang-format/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
endif()

install(PROGRAMS clang-format-bbedit.applescript
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-format)
install(PROGRAMS clang-format-diff.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-format)
install(PROGRAMS clang-format-sublime.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-format)
install(PROGRAMS clang-format.el
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-format)
install(PROGRAMS clang-format.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-format)
install(PROGRAMS git-clang-format
DESTINATION "${CMAKE_INSTALL_BINDIR}"
DESTINATION bin
COMPONENT clang-format)
2 changes: 1 addition & 1 deletion clang/tools/clang-nvlink-wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ target_link_libraries(clang-nvlink-wrapper
${CLANG_NVLINK_WRAPPER_LIB_DEPS}
)

install(TARGETS clang-nvlink-wrapper RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(TARGETS clang-nvlink-wrapper RUNTIME DESTINATION bin)
4 changes: 2 additions & 2 deletions clang/tools/clang-rename/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
)

install(PROGRAMS clang-rename.py
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-rename)
install(PROGRAMS clang-rename.el
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
DESTINATION share/clang
COMPONENT clang-rename)
2 changes: 1 addition & 1 deletion clang/tools/libclang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ endif()
if(INTERNAL_INSTALL_PREFIX)
set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
else()
set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
endif()

install(DIRECTORY ../../include/clang-c
Expand Down
6 changes: 3 additions & 3 deletions clang/tools/scan-build-py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ foreach(BinFile ${BinFiles})
${CMAKE_BINARY_DIR}/bin/scan-build-py
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/scan-build)
install (PROGRAMS "bin/scan-build"
DESTINATION "${CMAKE_INSTALL_BINDIR}"
DESTINATION bin
RENAME scan-build-py
COMPONENT scan-build-py)
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/scan-build-py)
Expand All @@ -56,7 +56,7 @@ foreach(BinFile ${BinFiles})
${CMAKE_BINARY_DIR}/bin/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
install(PROGRAMS bin/${BinFile}
DESTINATION "${CMAKE_INSTALL_BINDIR}"
DESTINATION bin
COMPONENT scan-build-py)
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
endif()
Expand All @@ -72,7 +72,7 @@ foreach(lib ${LibExecs})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${lib})
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${lib})
install(PROGRAMS libexec/${lib}
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}"
DESTINATION libexec
COMPONENT scan-build-py)
endforeach()

Expand Down
6 changes: 3 additions & 3 deletions clang/tools/scan-build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
install(PROGRAMS bin/${BinFile}
DESTINATION "${CMAKE_INSTALL_BINDIR}"
DESTINATION bin
COMPONENT scan-build)
endforeach()

Expand All @@ -61,7 +61,7 @@ if(CLANG_INSTALL_SCANBUILD)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
install(PROGRAMS libexec/${LibexecFile}
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}"
DESTINATION libexec
COMPONENT scan-build)
endforeach()

Expand Down Expand Up @@ -89,7 +89,7 @@ if(CLANG_INSTALL_SCANBUILD)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
install(FILES share/scan-build/${ShareFile}
DESTINATION "${CMAKE_INSTALL_DATADIR}/scan-build"
DESTINATION share/scan-build
COMPONENT scan-build)
endforeach()

Expand Down
4 changes: 2 additions & 2 deletions clang/tools/scan-view/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if(CLANG_INSTALL_SCANVIEW)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
install(PROGRAMS bin/${BinFile}
DESTINATION "${CMAKE_INSTALL_BINDIR}"
DESTINATION bin
COMPONENT scan-view)
endforeach()

Expand All @@ -34,7 +34,7 @@ if(CLANG_INSTALL_SCANVIEW)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
install(FILES share/${ShareFile}
DESTINATION "${CMAKE_INSTALL_DATADIR}/scan-view"
DESTINATION share/scan-view
COMPONENT scan-view)
endforeach()

Expand Down
2 changes: 1 addition & 1 deletion clang/utils/hmaptool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM

list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
install(PROGRAMS ${CLANG_HMAPTOOL}
DESTINATION "${CMAKE_INSTALL_BINDIR}"
DESTINATION bin
COMPONENT hmaptool)

add_custom_target(hmaptool ALL DEPENDS ${Depends})
Expand Down
7 changes: 3 additions & 4 deletions compiler-rt/cmake/base-config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

include(CheckIncludeFile)
include(CheckCXXSourceCompiles)
include(GNUInstallDirs)
include(ExtendPath)

check_include_file(unwind.h HAVE_UNWIND_H)
Expand Down Expand Up @@ -109,13 +108,13 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt libraries should be installed.")
endif()
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_BINDIR}")
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" bin)
set(COMPILER_RT_INSTALL_BINARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt executables should be installed.")
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_INCLUDEDIR}")
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" include)
set(COMPILER_RT_INSTALL_INCLUDE_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt headers should be installed.")
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_DATADIR}")
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" share)
set(COMPILER_RT_INSTALL_DATA_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt data files should be installed.")

Expand Down
2 changes: 0 additions & 2 deletions libc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.13.4)

include(GNUInstallDirs)

# Use old version of target_sources command which converts the source
# file paths to full paths.
cmake_policy(SET CMP0076 OLD)
Expand Down
8 changes: 3 additions & 5 deletions libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ endif()
#===============================================================================
cmake_minimum_required(VERSION 3.13.4)

include(GNUInstallDirs)

set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")

# Add path for custom modules
Expand Down Expand Up @@ -414,9 +412,9 @@ endif ()
# TODO: Projects that depend on libc++ should use LIBCXX_GENERATED_INCLUDE_DIR
# instead of hard-coding include/c++/v1.

set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH
set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
"Path where target-agnostic libc++ headers should be installed.")
set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH
"Path where built libc++ runtime libraries should be installed.")

if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
Expand All @@ -425,7 +423,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
"Path where built libc++ libraries should be installed.")
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
"Path where target-specific libc++ headers should be installed.")
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
Expand Down
5 changes: 2 additions & 3 deletions libcxx/cmake/Modules/HandleLibCXXABI.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

#===============================================================================
# Add an ABI library if appropriate
#===============================================================================

include(GNUInstallDirs)

#
# _setup_abi: Set up the build to use an ABI library
#
Expand Down Expand Up @@ -64,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)

if (LIBCXX_INSTALL_HEADERS)
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}"
DESTINATION include/c++/v1/${dstdir}
COMPONENT cxx-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
Expand Down
4 changes: 1 addition & 3 deletions libcxxabi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ endif()

cmake_minimum_required(VERSION 3.13.4)

include(GNUInstallDirs)

set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")

# Add path for custom modules
Expand Down Expand Up @@ -212,7 +210,7 @@ set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
)

set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH
"Path where built libc++abi runtime libraries should be installed.")

if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
Expand Down
6 changes: 2 additions & 4 deletions libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ endif()

cmake_minimum_required(VERSION 3.13.4)

include(GNUInstallDirs)

set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")

# Add path for custom modules
Expand Down Expand Up @@ -139,9 +137,9 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
${CMAKE_MODULE_PATH})

set(LIBUNWIND_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH
set(LIBUNWIND_INSTALL_INCLUDE_DIR include CACHE PATH
"Path where built libunwind headers should be installed.")
set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
"Path where built libunwind runtime libraries should be installed.")

if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
Expand Down
3 changes: 1 addition & 2 deletions llvm/cmake/modules/LLVMInstallSymlink.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ include(GNUInstallDirs)

function(install_symlink name target outdir)
set(DESTDIR $ENV{DESTDIR})
GNUInstallDirs_get_absolute_install_dir(bindir "${outdir}" BINDIR)
set(bindir "${DESTDIR}${bindir}")
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")

message(STATUS "Creating ${name}")

Expand Down
Loading

0 comments on commit da77db5

Please sign in to comment.