forked from OSchip/llvm-project
Allow host triple to be correctly overridden in CMake builds
The intended semantics mirror autoconf, where the user is able to specify a host triple, but if it's left to the build system then "config.guess" is invoked for the default. This also renames the LLVM_HOSTTRIPLE define to LLVM_HOST_TRIPLE to fit in with the style of the surrounding defines. llvm-svn: 181112
This commit is contained in:
parent
8ec8c4bf89
commit
fee13d1e11
|
@ -1777,7 +1777,7 @@ AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
|
||||||
[Installation directory for man pages])
|
[Installation directory for man pages])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
||||||
[Time at which LLVM was configured])
|
[Time at which LLVM was configured])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_HOSTTRIPLE, "$host",
|
AC_DEFINE_UNQUOTED(LLVM_HOST_TRIPLE, "$host",
|
||||||
[Host triple LLVM will be executed on])
|
[Host triple LLVM will be executed on])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
|
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
|
||||||
[Target triple LLVM will generate code for by default])
|
[Target triple LLVM will generate code for by default])
|
||||||
|
|
|
@ -340,12 +340,13 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GetHostTriple)
|
|
||||||
get_host_triple(LLVM_HOST_TRIPLE)
|
|
||||||
|
|
||||||
# By default, we target the host, but this can be overridden at CMake
|
# By default, we target the host, but this can be overridden at CMake
|
||||||
# invocation time.
|
# invocation time.
|
||||||
set(LLVM_HOSTTRIPLE "${LLVM_HOST_TRIPLE}")
|
include(GetHostTriple)
|
||||||
|
get_host_triple(LLVM_INFERRED_HOST_TRIPLE)
|
||||||
|
|
||||||
|
set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING
|
||||||
|
"Host on which LLVM binaries will run")
|
||||||
|
|
||||||
# Determine the native architecture.
|
# Determine the native architecture.
|
||||||
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
|
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
|
||||||
|
|
|
@ -22375,7 +22375,7 @@ _ACEOF
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define LLVM_HOSTTRIPLE "$host"
|
#define LLVM_HOST_TRIPLE "$host"
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -589,7 +589,7 @@
|
||||||
#cmakedefine01 LLVM_HAS_ATOMICS
|
#cmakedefine01 LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
/* Host triple LLVM will be executed on */
|
/* Host triple LLVM will be executed on */
|
||||||
#cmakedefine LLVM_HOSTTRIPLE "${LLVM_HOSTTRIPLE}"
|
#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
||||||
|
|
|
@ -594,7 +594,7 @@
|
||||||
#undef LLVM_HAS_ATOMICS
|
#undef LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
/* Host triple LLVM will be executed on */
|
/* Host triple LLVM will be executed on */
|
||||||
#undef LLVM_HOSTTRIPLE
|
#undef LLVM_HOST_TRIPLE
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#undef LLVM_INCLUDEDIR
|
#undef LLVM_INCLUDEDIR
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#cmakedefine01 LLVM_HAS_ATOMICS
|
#cmakedefine01 LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
/* Host triple LLVM will be executed on */
|
/* Host triple LLVM will be executed on */
|
||||||
#cmakedefine LLVM_HOSTTRIPLE "${LLVM_HOSTTRIPLE}"
|
#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#undef LLVM_HAS_ATOMICS
|
#undef LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
/* Host triple LLVM will be executed on */
|
/* Host triple LLVM will be executed on */
|
||||||
#undef LLVM_HOSTTRIPLE
|
#undef LLVM_HOST_TRIPLE
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#undef LLVM_INCLUDEDIR
|
#undef LLVM_INCLUDEDIR
|
||||||
|
|
|
@ -613,7 +613,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string sys::getProcessTriple() {
|
std::string sys::getProcessTriple() {
|
||||||
Triple PT(LLVM_HOSTTRIPLE);
|
Triple PT(LLVM_HOST_TRIPLE);
|
||||||
|
|
||||||
if (sizeof(void *) == 8 && PT.isArch32Bit())
|
if (sizeof(void *) == 8 && PT.isArch32Bit())
|
||||||
PT = PT.get64BitArchVariant();
|
PT = PT.get64BitArchVariant();
|
||||||
|
|
|
@ -125,7 +125,7 @@ endif
|
||||||
|
|
||||||
lit.site.cfg: FORCE
|
lit.site.cfg: FORCE
|
||||||
@echo "Making LLVM 'lit.site.cfg' file..."
|
@echo "Making LLVM 'lit.site.cfg' file..."
|
||||||
@$(ECHOPATH) s=@LLVM_HOSTTRIPLE@=$(HOST_TRIPLE)=g > lit.tmp
|
@$(ECHOPATH) s=@LLVM_HOST_TRIPLE@=$(HOST_TRIPLE)=g > lit.tmp
|
||||||
@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
|
@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
|
||||||
@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp
|
@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp
|
||||||
@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
|
@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
## Autogenerated by LLVM/Clang configuration.
|
## Autogenerated by LLVM/Clang configuration.
|
||||||
# Do not edit!
|
# Do not edit!
|
||||||
config.host_triple = "@LLVM_HOSTTRIPLE@"
|
config.host_triple = "@LLVM_HOST_TRIPLE@"
|
||||||
config.target_triple = "@TARGET_TRIPLE@"
|
config.target_triple = "@TARGET_TRIPLE@"
|
||||||
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
|
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
|
||||||
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
||||||
|
|
Loading…
Reference in New Issue