[cfe-commits] [PATCH][CMake][clang-tools-extra] Apply add_llvm_external_project to clang-tools-extra.
NAKAMURA Takumi
geek4civic at gmail.com
Wed Sep 5 00:44:42 PDT 2012
This patchset introduces availability of external clang-tools-extra in
the build.
By default,
LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/srcroot/tools/clang/extra
and build directory is in tools/clang/extra.
check-clang-tools and check-all pased. :p
Please review, thank you.
ps. I will not introduce extra-dir stuff to autoconf build, for now.
...Takumi
-------------- next part --------------
From 8ffce2ea3c00d5b861c8af3ea96d2b3137d0542c Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Wed, 5 Sep 2012 16:18:48 +0900
Subject: [PATCH 1/2] [CMake] Enhance add_llvm_external_project.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.4.1"
This is a multi-part message in MIME format.
--------------1.7.4.1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
- Substitute hyphen to underscore, s/-/_/g, as the variable name.
- Additional parameter can be specified as the name of directory.
e.g.) add_llvm_external_project(clang-tools-extra extra)
- LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/srcroot/tools/clang/extra, by default.
- Build directory is in tools/clang/extra
---
llvm/cmake/modules/AddLLVM.cmake | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
--------------1.7.4.1
Content-Type: text/x-patch; name="0001-CMake-Enhance-add_llvm_external_project.patch.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-CMake-Enhance-add_llvm_external_project.patch.txt"
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index f44a27c..a999f30 100755
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -135,16 +135,22 @@ endmacro(add_llvm_target)
# lld, and Polly. This adds two options. One for the source directory of the
# project, which defaults to ${CMAKE_CURRENT_SOURCE_DIR}/${name}. Another to
# enable or disable building it with everthing else.
+# Additional parameter can be specified as the name of directory.
macro(add_llvm_external_project name)
- string(TOUPPER ${name} nameUPPER)
- set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}"
+ set(add_llvm_external_dir "${ARGN}")
+ if("${add_llvm_external_dir}" STREQUAL "")
+ set(add_llvm_external_dir ${name})
+ endif()
+ string(REPLACE "-" "_" nameUNDERSCORE ${name})
+ string(TOUPPER ${nameUNDERSCORE} nameUPPER)
+ set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}"
CACHE PATH "Path to ${name} source directory")
if (NOT ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} STREQUAL ""
AND EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt)
option(LLVM_EXTERNAL_${nameUPPER}_BUILD
"Whether to build ${name} as part of LLVM" ON)
if (LLVM_EXTERNAL_${nameUPPER}_BUILD)
- add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${name})
+ add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${add_llvm_external_dir})
endif()
endif()
endmacro(add_llvm_external_project)
--------------1.7.4.1--
-------------- next part --------------
From 9745f2950fac389a8eb6a7a1f98d1f95004f1be2 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Wed, 5 Sep 2012 16:26:00 +0900
Subject: [PATCH 2/2] [CMake] clang/tools/extra may be included by LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.4.1"
This is a multi-part message in MIME format.
--------------1.7.4.1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/srcroot/tools/clang/extra, by default.
---
clang/tools/CMakeLists.txt | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
--------------1.7.4.1
Content-Type: text/x-patch; name="0002-CMake-clang-tools-extra-may-be-included-by-LLVM_.patch.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0002-CMake-clang-tools-extra-may-be-included-by-LLVM_.patch.txt"
diff --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index 3a6fef5..cccff5d 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -10,7 +10,5 @@ add_subdirectory(clang-check)
# subdirectory. It contains tools developed as part of the Clang/LLVM project
# on top of the Clang tooling platform. We keep them in a separate repository
# to keep the primary Clang repository small and focused.
-if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/extra AND
- EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/extra/CMakeLists.txt)
- add_subdirectory(extra)
-endif()
+# It also may be included by LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR.
+add_llvm_external_project(clang-tools-extra extra)
--------------1.7.4.1--
More information about the cfe-commits
mailing list