summaryrefslogtreecommitdiffstats
path: root/clang/cmake
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2015-09-15 21:52:42 +0000
committerChris Bieneman <beanz@apple.com>2015-09-15 21:52:42 +0000
commitea7ecde87cd783ac7a2409e5a08d72f4043cf0d0 (patch)
treea5415ed396bf7dc993a7ee6fcebee144027a9421 /clang/cmake
parent4b1ac72cd47f11ec55239dfd2978d85fd8dfbaef (diff)
downloadbcm5719-llvm-ea7ecde87cd783ac7a2409e5a08d72f4043cf0d0.tar.gz
bcm5719-llvm-ea7ecde87cd783ac7a2409e5a08d72f4043cf0d0.zip
[CMake] Add cache scripts for Apple-style clang builds.
Summary: These CMake cache scripts are my first pass at replicating Apple's packaging logic from autoconf. They can be used on any Darwin machine to approximate an Apple Clang build. The included README file includes documentation and a sample CMake invocation. Reviewers: chandlerc, echristo Subscribers: echristo, cfe-commits Differential Revision: http://reviews.llvm.org/D12817 llvm-svn: 247726
Diffstat (limited to 'clang/cmake')
-rw-r--r--clang/cmake/caches/Apple-stage1.cmake32
-rw-r--r--clang/cmake/caches/Apple-stage2.cmake29
-rw-r--r--clang/cmake/caches/README.txt18
3 files changed, 79 insertions, 0 deletions
diff --git a/clang/cmake/caches/Apple-stage1.cmake b/clang/cmake/caches/Apple-stage1.cmake
new file mode 100644
index 00000000000..a5c3fdbbdfd
--- /dev/null
+++ b/clang/cmake/caches/Apple-stage1.cmake
@@ -0,0 +1,32 @@
+# This file sets up a CMakeCache for Apple-style bootstrap builds. It can be
+# used on any Darwin system to approximate Apple Clang builds.
+
+if($ENV{DT_TOOLCHAIN_DIR})
+ set(CMAKE_INSTALL_PREFIX $ENV{DT_TOOLCHAIN_DIR}/usr/)
+else()
+ set(CMAKE_INSTALL_PREFIX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.toolchain/usr/)
+endif()
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+set(CLANG_VENDOR Apple CACHE STRING "")
+set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
+set(LLVM_INCLUDE_UTILS OFF CACHE BOOL "")
+set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
+set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "")
+set(COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
+
+set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+set(PACKAGE_VERSION 7.1.0 CACHE STRING "")
+
+# LIBCXX Settings
+set(LIBCXX_INSTALL_LIBRARY OFF CACHE BOOL "")
+set(LIBCXX_INSTALL_HEADERS ON CACHE BOOL "")
+set(LIBCXX_OVERRIDE_DARWIN_INSTALL ON CACHE BOOL "")
+
+#bootstrap
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+ -C ${CMAKE_CURRENT_LIST_DIR}/Apple-stage2.cmake
+ CACHE STRING "")
diff --git a/clang/cmake/caches/Apple-stage2.cmake b/clang/cmake/caches/Apple-stage2.cmake
new file mode 100644
index 00000000000..f88e3ebc6e5
--- /dev/null
+++ b/clang/cmake/caches/Apple-stage2.cmake
@@ -0,0 +1,29 @@
+# This file sets up a CMakeCache for Apple-style stage2 bootstrap. It is
+# specified by the stage1 build.
+
+set(LLVM_TARGETS_TO_BUILD X86 ARM AArch64 CACHE STRING "")
+set(CLANG_VENDOR Apple CACHE STRING "")
+set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
+set(LLVM_INCLUDE_UTILS OFF CACHE BOOL "")
+set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
+set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "")
+set(COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
+
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -flto -gline-tables-only -DNDEBUG" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os -flto -gline-tables-only -DNDEBUG" CACHE STRING "")
+set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+set(PACKAGE_VERSION 7.1.0 CACHE STRING "")
+
+set(LIBCXX_INSTALL_LIBRARY OFF CACHE BOOL "")
+set(LIBCXX_INSTALL_HEADERS OFF CACHE BOOL "")
+
+# setup toolchain
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+ llvm-dsymutil
+ llvm-cov
+ llvm-dwarfdump
+ llvm-profdata
+ CACHE STRING "")
diff --git a/clang/cmake/caches/README.txt b/clang/cmake/caches/README.txt
new file mode 100644
index 00000000000..55e5e159db1
--- /dev/null
+++ b/clang/cmake/caches/README.txt
@@ -0,0 +1,18 @@
+CMake Caches
+============
+
+This directory contains CMake cache scripts that pre-populate the CMakeCache in
+a build directory with commonly used settings.
+
+The first two cache files in the directory are used by Apple to build the clang
+distribution packaged with Xcode. You can use the caches with the following
+CMake invocation:
+
+cmake -G <build system>
+ -C <path to llvm>/tools/clang/cmake/caches/Apple-stage1.cmake
+ -DCMAKE_BUILD_TYPE=Release
+ [-DCMAKE_INSTALL_PREFIX=<install path>]
+ <path to llvm>
+
+Building the `bootstrap` target from this generation will build clang, and
+`bootstrap-install` will install it.
OpenPOWER on IntegriCloud