[PATCH] [libcxxabi] Remove strict dependency on llvm-config.
Dan Albert
danalbert at google.com
Thu Aug 21 16:49:43 PDT 2014
Hi jroelofs, loladiro,
Depending on llvm-config allows for a few nice things (auto-detecting LLVM source tree, version numbers, etc), but it's makes bootstrapping a pain. Keep the llvm-config features around, but also fall back to being able to configure based on -DLLVM_MAIN_SRC_DIR=path/to/llvm.
http://reviews.llvm.org/D5016
Files:
CMakeLists.txt
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -13,10 +13,7 @@
if(LLVM_CONFIG)
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
set(CONFIG_COMMAND ${LLVM_CONFIG}
- "--bindir"
"--includedir"
- "--libdir"
- "--prefix"
"--src-root")
execute_process(
COMMAND ${CONFIG_COMMAND}
@@ -32,35 +29,32 @@
message(STATUS "${CONFIG_COMMAND_STR}")
message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
endif()
+
+ list(GET CONFIG_OUTPUT 0 INCLUDE_DIR)
+ list(GET CONFIG_OUTPUT 1 MAIN_SRC_DIR)
+
+ set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
+ set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
+ set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
+ elseif(DEFINED LLVM_MAIN_SRC_DIR)
+ set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
+ set(LLVM_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR} CACHE PATH
+ "Path to LLVM source tree")
+ set(LLVM_CMAKE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
else()
- message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
+ message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined")
endif()
- list(GET CONFIG_OUTPUT 0 TOOLS_BINARY_DIR)
- list(GET CONFIG_OUTPUT 1 INCLUDE_DIR)
- list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
- list(GET CONFIG_OUTPUT 3 LLVM_OBJ_ROOT)
- list(GET CONFIG_OUTPUT 4 MAIN_SRC_DIR)
-
- set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
- set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
- set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
- set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
- set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
-
- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
- set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
- if(EXISTS ${LLVMCONFIG_FILE})
+ if(EXISTS ${LLVM_CMAKE_PATH})
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
- include(${LLVMCONFIG_FILE})
include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
else()
- message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
+ message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}")
endif()
set(PACKAGE_NAME libcxxabi)
- set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
+ set(PACKAGE_VERSION 3.6.0svn)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs at cs.uiuc.edu")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5016.12812.patch
Type: text/x-patch
Size: 2686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140821/751ee327/attachment.bin>
More information about the cfe-commits
mailing list