[llvm] r319480 - [llvm] Add stripped installation targets
Shoaib Meenai via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 11 16:19:07 PDT 2018
Argh, sorry about that. Thanks for fixing!
From: Justin Bogner <justin at justinbogner.com> on behalf of Justin Bogner <mail at justinbogner.com>
Date: Monday, June 11, 2018 at 4:17 PM
To: Shoaib Meenai via llvm-commits <llvm-commits at lists.llvm.org>
Cc: Shoaib Meenai <smeenai at fb.com>, Chris Bieneman <chris.bieneman at me.com>
Subject: Re: [llvm] r319480 - [llvm] Add stripped installation targets
Shoaib Meenai via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> writes:
Author: smeenai
Date: Thu Nov 30 13:48:26 2017
New Revision: 319480
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D319480-26view-3Drev&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=xyX7bQFLanNt_oHPukSKx2WR4VAy7oemK0_CR9Fuefw&e=
Log:
[llvm] Add stripped installation targets
CMake's generated installation scripts support `CMAKE_INSTALL_DO_STRIP`
to enable stripping the installed binaries. LLVM's build system doesn't
expose this option to the `install-` targets, but it's useful in
conjunction with `install-distribution`.
Add a new function to create the install targets, which creates both the
regular install target and a second install target that strips during
installation. Change the creation of all installation targets to use
this new function. Stripping doesn't make a whole lot of sense for some
installation targets (e.g. the LLVM headers), but consistency doesn't
hurt.
I'll make other repositories (e.g. clang, compiler-rt) use this in a
follow-up, and then add an `install-distribution-stripped` target to
actually accomplish the end goal of creating a stripped distribution. I
don't want to do that step yet because the creation of that target would
depend on the presence of the `install-*-stripped` target for each
distribution component, and the distribution components from other
repositories will be missing that target right now.
Differential Revision: https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D40620&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=MMUDVJwkKVamtd7zbo0mgtHQIO4pYlaesTorxjG5auI&e=
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/modules/AddLLVM.cmake
llvm/trunk/cmake/modules/CMakeLists.txt
llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake
llvm/trunk/tools/xcode-toolchain/CMakeLists.txt
Modified: llvm/trunk/CMakeLists.txt
URL:
https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_CMakeLists.txt-3Frev-3D319480-26r1-3D319479-26r2-3D319480-26view-3Ddiff&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=AKh9cP5iurpH6ngObnGePClkPCgu0AWZ_Uk1lZWh8rU&e=
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Thu Nov 30 13:48:26 2017
@@ -975,11 +975,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
set_target_properties(llvm-headers PROPERTIES FOLDER "Misc")
if (NOT CMAKE_CONFIGURATION_TYPES)
- add_custom_target(install-llvm-headers
- DEPENDS llvm-headers
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=llvm-headers
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-llvm-headers
+ COMPONENT llvm-headers)
FYI, this accidentally dropped the DEPENDS llvm-headers, causing
install-llvm-headers and install-distribution to skip generated headers
in clean builds. Fixed in r334452.
endif()
endif()
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_cmake_modules_AddLLVM.cmake-3Frev-3D319480-26r1-3D319479-26r2-3D319480-26view-3Ddiff&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=ZXdi8kqteCLMCxvIUC5xnLvH3GFdHvt0LFJBgmqW_ec&e=
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Thu Nov 30 13:48:26 2017
@@ -569,6 +569,32 @@ function(llvm_add_library name)
endif()
endfunction()
+function(add_llvm_install_targets target)
+ cmake_parse_arguments(ARG "" "COMPONENT;PREFIX" "DEPENDS" ${ARGN})
+ if(ARG_COMPONENT)
+ set(component_option -DCMAKE_INSTALL_COMPONENT="${ARG_COMPONENT}")
+ endif()
+ if(ARG_PREFIX)
+ set(prefix_option -DCMAKE_INSTALL_PREFIX="${ARG_PREFIX}")
+ endif()
+
+ add_custom_target(${target}
+ DEPENDS ${ARG_DEPENDS}
+ COMMAND "${CMAKE_COMMAND}"
+ ${component_option}
+ ${prefix_option}
+ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+ USES_TERMINAL)
+ add_custom_target(${target}-stripped
+ DEPENDS ${ARG_DEPENDS}
+ COMMAND "${CMAKE_COMMAND}"
+ ${component_option}
+ ${prefix_option}
+ -DCMAKE_INSTALL_DO_STRIP=1
+ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+ USES_TERMINAL)
+endfunction()
+
macro(add_llvm_library name)
cmake_parse_arguments(ARG
"SHARED;BUILDTREE_ONLY"
@@ -619,11 +645,9 @@ macro(add_llvm_library name)
COMPONENT ${name})
if (NOT CMAKE_CONFIGURATION_TYPES)
- add_custom_target(install-${name}
- DEPENDS ${name}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
@@ -849,11 +873,9 @@ macro(add_llvm_tool name)
COMPONENT ${name})
if (NOT CMAKE_CONFIGURATION_TYPES)
- add_custom_target(install-${name}
- DEPENDS ${name}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
endif()
@@ -889,11 +911,9 @@ macro(add_llvm_utility name)
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
COMPONENT ${name})
if (NOT CMAKE_CONFIGURATION_TYPES)
- add_custom_target(install-${name}
- DEPENDS ${name}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
endmacro(add_llvm_utility name)
@@ -1400,11 +1420,9 @@ function(llvm_install_library_symlink na
COMPONENT ${component})
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
- add_custom_target(install-${name}
- DEPENDS ${name} ${dest} install-${dest}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name} ${dest} install-${dest}
+ COMPONENT ${name})
endif()
endfunction()
@@ -1435,11 +1453,9 @@ function(llvm_install_symlink name dest)
COMPONENT ${component})
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
- add_custom_target(install-${name}
- DEPENDS ${name} ${dest} install-${dest}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name} ${dest} install-${dest}
+ COMPONENT ${name})
endif()
endfunction()
Modified: llvm/trunk/cmake/modules/CMakeLists.txt
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_cmake_modules_CMakeLists.txt-3Frev-3D319480-26r1-3D319479-26r2-3D319480-26view-3Ddiff&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=mWOa-yIlFS9-7-LAXQIrSNtDPWGyG6yuirqnBBkGJ7w&e=
==============================================================================
--- llvm/trunk/cmake/modules/CMakeLists.txt (original)
+++ llvm/trunk/cmake/modules/CMakeLists.txt Thu Nov 30 13:48:26 2017
@@ -129,9 +129,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
if (NOT CMAKE_CONFIGURATION_TYPES)
# Add a dummy target so this can be used with LLVM_DISTRIBUTION_COMPONENTS
add_custom_target(cmake-exports)
- add_custom_target(install-cmake-exports
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=cmake-exports
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-cmake-exports
+ COMPONENT cmake-exports)
endif()
endif()
Modified: llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_cmake_modules_LLVMExternalProjectUtils.cmake-3Frev-3D319480-26r1-3D319479-26r2-3D319480-26view-3Ddiff&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=GSc13h6_ZrpO_j-SbWeSc2MPH0lX5pC9lkf3d12P4SI&e=
==============================================================================
--- llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake (original)
+++ llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake Thu Nov 30 13:48:26 2017
@@ -189,12 +189,9 @@ function(llvm_ExternalProject_Add name s
install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${BINARY_DIR}/cmake_install.cmake \)"
COMPONENT ${name})
- add_custom_target(install-${name}
- DEPENDS ${name}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
- USES_TERMINAL)
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
# Add top-level targets
Modified: llvm/trunk/tools/xcode-toolchain/CMakeLists.txt
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_xcode-2Dtoolchain_CMakeLists.txt-3Frev-3D319480-26r1-3D319479-26r2-3D319480-26view-3Ddiff&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=1ak-FlzCa7w838PXQRUzlShRQAvbOr5d0TSuV5A0HS8&e=
==============================================================================
--- llvm/trunk/tools/xcode-toolchain/CMakeLists.txt (original)
+++ llvm/trunk/tools/xcode-toolchain/CMakeLists.txt Thu Nov 30 13:48:26 2017
@@ -93,13 +93,11 @@ add_custom_command(OUTPUT ${LLVMToolchai
COMMAND /usr/libexec/PlistBuddy -c "Add:CompatibilityVersion integer ${COMPAT_VERSION}" "${LLVMToolchainDir}/Info.plist"
)
-add_custom_target(install-xcode-toolchain
- DEPENDS ${LLVMToolchainDir}/Info.plist
- COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target all
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
- USES_TERMINAL)
+add_custom_target(build-xcode-toolchain
+ COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target all)
+add_llvm_install_targets(install-xcode-toolchain
+ DEPENDS ${LLVMToolchainDir}/Info.plist build-xcode-toolchain
+ PREFIX ${LLVMToolchainDir}/usr/)
if(LLVM_DISTRIBUTION_COMPONENTS)
if(CMAKE_CONFIGURATION_TYPES)
@@ -110,13 +108,10 @@ if(LLVM_DISTRIBUTION_COMPONENTS)
DEPENDS ${LLVMToolchainDir}/Info.plist distribution)
foreach(target ${LLVM_DISTRIBUTION_COMPONENTS})
- add_custom_target(install-distribution-${target}
- DEPENDS ${target}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${target}
- -DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
- USES_TERMINAL)
+ add_llvm_install_targets(install-distribution-${target}
+ DEPENDS ${target}
+ COMPONENT ${target}
+ PREFIX ${LLVMToolchainDir}/usr/)
add_dependencies(install-distribution-toolchain install-distribution-${target})
endforeach()
endif()
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=iC8BMROyE7kTt0EghFPQDN5QUZobBbTNzbO7pmyBdtA&s=axWFLxedMMd-N1l5LEFXlPNBBmmx5BDGqL3AZwtvY50&e=
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180611/e4777f19/attachment-0001.html>
More information about the llvm-commits
mailing list