Revert "Use GNUInstallDirs to support custom installation dirs. -- LLVM"

This reverts commit 6fd2db04d0 since it
broke GreenDragon LLDB-Incremental bot:

https://green.lab.llvm.org/green/job/lldb-cmake/37560/console

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani 2021-11-02 18:10:50 +00:00
parent 82e0eb22af
commit 797b50d4be
17 changed files with 44 additions and 72 deletions

View File

@ -66,16 +66,16 @@ if(CLANG_INSTALL_SCANBUILD)
endforeach()
foreach(ManPage ${ManPages})
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}"
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}
COMMAND ${CMAKE_COMMAND} -E make_directory
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1"
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}"
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/"
${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage})
list(APPEND Depends "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}")
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage})
install(PROGRAMS man/${ManPage}
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT scan-build)
endforeach()

View File

@ -183,8 +183,8 @@ endif()
# pkg-config file
configure_file( libclc.pc.in libclc.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig" )
install( DIRECTORY generic/include/clc DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig )
install( DIRECTORY generic/include/clc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
if( ENABLE_RUNTIME_SUBNORMAL )
add_library( subnormal_use_default STATIC
@ -192,7 +192,7 @@ if( ENABLE_RUNTIME_SUBNORMAL )
add_library( subnormal_disable STATIC
generic/lib/subnormal_disable.ll )
install( TARGETS subnormal_use_default subnormal_disable ARCHIVE
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
endif()
find_package( Python3 REQUIRED COMPONENTS Interpreter )
@ -343,7 +343,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
add_custom_target( "prepare-${spv_suffix}" ALL
DEPENDS "${spv_suffix}" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${spv_suffix}
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
else()
# Add prepare target
@ -366,7 +366,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
PROPERTIES ENVIRONMENT "LLVM_CONFIG=${LLVM_CONFIG}" )
endif()
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
foreach( a ${${d}_aliases} )
set( alias_suffix "${a}-${t}.bc" )
add_custom_target( ${alias_suffix} ALL
@ -374,7 +374,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
create_symlink ${obj_suffix}
${alias_suffix}
DEPENDS "prepare-${obj_suffix}" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
endforeach( a )
endif()
endforeach( d )

View File

@ -25,14 +25,14 @@ else()
HINTS
${PC_LIBEDIT_INCLUDEDIR}
${PC_LIBEDIT_INCLUDE_DIRS}
"${CMAKE_INSTALL_FULL_INCLUDEDIR}")
${CMAKE_INSTALL_FULL_INCLUDEDIR})
find_library(LibEdit_LIBRARIES
NAMES
edit libedit
HINTS
${PC_LIBEDIT_LIBDIR}
${PC_LIBEDIT_LIBRARY_DIRS}
"${CMAKE_INSTALL_FULL_LIBDIR}")
${CMAKE_INSTALL_FULL_LIBDIR})
if(LibEdit_INCLUDE_DIRS AND EXISTS "${LibEdit_INCLUDE_DIRS}/histedit.h")
file(STRINGS "${LibEdit_INCLUDE_DIRS}/histedit.h"

View File

@ -281,12 +281,9 @@ if (CMAKE_BUILD_TYPE AND
message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()
include(GNUInstallDirs)
set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
"Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
@ -595,9 +592,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
CACHE STRING "Doxygen-generated HTML documentation install directory")
set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/ocaml-html"
set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
CACHE STRING "OCamldoc-generated HTML documentation install directory")
option (LLVM_BUILD_EXTERNAL_COMPILER_RT
@ -1099,7 +1096,7 @@ endif()
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/llvm include/llvm-c
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
DESTINATION include
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
@ -1110,7 +1107,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
)
install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
DESTINATION include
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
@ -1124,13 +1121,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
if (LLVM_INSTALL_MODULEMAPS)
install(DIRECTORY include/llvm include/llvm-c
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
DESTINATION include
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "module.modulemap"
)
install(FILES include/llvm/module.install.modulemap
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm"
DESTINATION include/llvm
COMPONENT llvm-headers
RENAME "module.extern.modulemap"
)

View File

@ -845,7 +845,7 @@ macro(add_llvm_library name)
${export_to_llvmexports}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
RUNTIME DESTINATION bin COMPONENT ${name})
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
@ -1278,7 +1278,7 @@ macro(add_llvm_example name)
endif()
add_llvm_executable(${name} ${ARGN})
if( LLVM_BUILD_EXAMPLES )
install(TARGETS ${name} RUNTIME DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples")
install(TARGETS ${name} RUNTIME DESTINATION examples)
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endmacro(add_llvm_example name)

View File

@ -74,7 +74,7 @@ function (add_sphinx_target builder project)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
if (builder STREQUAL man)
if (CMAKE_INSTALL_MANDIR)
set(INSTALL_MANDIR "${CMAKE_INSTALL_MANDIR}")
set(INSTALL_MANDIR ${CMAKE_INSTALL_MANDIR}/)
else()
set(INSTALL_MANDIR share/man/)
endif()
@ -90,7 +90,7 @@ function (add_sphinx_target builder project)
endif()
elseif (builder STREQUAL html)
string(TOUPPER "${project}" project_upper)
set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/html"
set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
CACHE STRING "HTML documentation install directory for ${project}")
# '/.' indicates: copy the contents of the directory directly into

View File

@ -1,7 +1,6 @@
include(LLVMDistributionSupport)
set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm CACHE STRING
"Path for CMake subdirectory (defaults to 'lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm')")
set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
# First for users who use an installed LLVM, create the LLVMExports.cmake file.
@ -110,13 +109,13 @@ foreach(p ${_count})
set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
endforeach(p)
set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
# Generate a default location for lit
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)

View File

@ -4,7 +4,7 @@
function(install_symlink name target outdir)
set(DESTDIR $ENV{DESTDIR})
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
message(STATUS "Creating ${name}")

View File

@ -252,22 +252,6 @@ manual, or execute ``cmake --help-variable VARIABLE_NAME``.
Sets the C++ standard to conform to when building LLVM. Possible values are
14, 17, 20. LLVM Requires C++ 14 or higher. This defaults to 14.
**CMAKE_INSTALL_BINDIR**:STRING
The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
Defaults to ``bin``.
**CMAKE_INSTALL_INCLUDEDIR**:STRING
The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
Defaults to ``include``.
**CMAKE_INSTALL_DOCDIR**:STRING
The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
Defaults to ``share/doc``.
**CMAKE_INSTALL_MANDIR**:STRING
The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
Defaults to ``share/man``.
.. _LLVM-related variables:
LLVM-related variables
@ -608,12 +592,12 @@ enabled sub-projects. Nearly all of these variable names begin with
**LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
The path to install OCamldoc-generated HTML documentation to. This path can
either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
``${CMAKE_INSTALL_DOCDIR}/llvm/ocaml-html``.
`share/doc/llvm/ocaml-html`.
**LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
The path to install Sphinx-generated HTML documentation to. This path can
either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
``${CMAKE_INSTALL_DOCDIR}/llvm/html``.
`share/doc/llvm/html`.
**LLVM_INSTALL_UTILS**:BOOL
If enabled, utility binaries like ``FileCheck`` and ``not`` will be installed
@ -637,8 +621,8 @@ enabled sub-projects. Nearly all of these variable names begin with
**LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
The path to install Doxygen-generated HTML documentation to. This path can
either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
``${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html``.
either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
`share/doc/llvm/doxygen-html`.
**LLVM_LINK_LLVM_DYLIB**:BOOL
If enabled, tools will be linked with the libLLVM shared library. Defaults

View File

@ -14,6 +14,6 @@ if (NOT WIN32)
BUILDTREE_ONLY
)
install(TARGETS ${name} RUNTIME DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples")
install(TARGETS ${name} RUNTIME DESTINATION examples)
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endif()

View File

@ -5,5 +5,5 @@ add_subdirectory(Frontend)
# If we're doing an out-of-tree build, copy a module map for generated
# header files into the build area.
if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
configure_file(module.modulemap.build module.modulemap COPYONLY)
endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")

View File

@ -23,8 +23,6 @@
#define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
#define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
#define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
#define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
#define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"

View File

@ -357,16 +357,10 @@ int main(int argc, char **argv) {
("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
} else {
ActivePrefix = CurrentExecPrefix;
{
SmallString<256> Path(LLVM_INSTALL_INCLUDEDIR);
sys::fs::make_absolute(ActivePrefix, Path);
ActiveIncludeDir = std::string(Path.str());
}
{
SmallString<256> Path(LLVM_INSTALL_BINDIR);
sys::fs::make_absolute(ActivePrefix, Path);
ActiveBinDir = std::string(Path.str());
}
ActiveIncludeDir = ActivePrefix + "/include";
SmallString<256> path(LLVM_TOOLS_INSTALL_DIR);
sys::fs::make_absolute(ActivePrefix, path);
ActiveBinDir = std::string(path.str());
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
ActiveIncludeOption = "-I" + ActiveIncludeDir;

View File

@ -33,7 +33,7 @@ add_llvm_library(${LTO_LIBRARY_NAME} ${LTO_LIBRARY_TYPE} INSTALL_WITH_TOOLCHAIN
${SOURCES} DEPENDS intrinsics_gen)
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm-c"
DESTINATION include/llvm-c
COMPONENT LTO)
if (APPLE)

View File

@ -8,7 +8,7 @@ set (files
foreach (file ${files})
install(PROGRAMS ${file}
DESTINATION "${CMAKE_INSTALL_DATADIR}/opt-viewer"
DESTINATION share/opt-viewer
COMPONENT opt-viewer)
endforeach (file)

View File

@ -19,7 +19,7 @@ if(LLVM_ENABLE_PIC)
endif()
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm-c"
DESTINATION include/llvm-c
COMPONENT Remarks)
if (APPLE)

View File

@ -323,7 +323,7 @@ if(WIN32)
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\"
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)")
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
\"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
\"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
endforeach()
else()
@ -335,7 +335,7 @@ else()
foreach(alias IN LISTS LIBOMP_ALIASES)
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\"
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
endforeach()
endif()
endif()