[llvm-commits] [llvm] r162219 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake

NAKAMURA Takumi geek4civic at gmail.com
Sat Dec 8 21:22:38 PST 2012


Sebastian, excuse me to ping an old commit.

Why did you need to make but also "TARGET_TRIPLE" configurable, not
only "LLVM_DEFAULT_TARGET_TRIPLE"?

I think "TARGET_TRIPLE" may be an alias of LLVM_DEFAULT_TARGET_TRIPLE.
(or, TARGET_TRIPLE might be localized as possible)
I'll update it if it did not break yours.

...Takumi

--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -242,8 +242,7 @@ include(config-ix)
 # invocation time.
 set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING
   "Default target for which LLVM will generate code." )
-set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING
-  "Default target for which LLVM will generate code." )
+set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")

 include(HandleLLVMOptions)

2012/8/21 Sebastian Pop <spop at codeaurora.org>:
> Author: spop
> Date: Mon Aug 20 14:56:52 2012
> New Revision: 162219
>
> URL: http://llvm.org/viewvc/llvm-project?rev=162219&view=rev
> Log:
> enable cross compilation with cmake
>
> This patch allows us to use cmake to specify a cross compiler: target different
> than host. In particular, it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE
> variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them
> available at configure time.
>
> Here is the command line that I have used to test my patches to create a Hexagon
> cross compiler hosted on x86:
>
> $ cmake -G Ninja -D LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu ..
> $ ninja check
>
> Modified:
>     llvm/trunk/CMakeLists.txt
>     llvm/trunk/cmake/config-ix.cmake
>
> Modified: llvm/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=162219&r1=162218&r2=162219&view=diff
> ==============================================================================
> --- llvm/trunk/CMakeLists.txt (original)
> +++ llvm/trunk/CMakeLists.txt Mon Aug 20 14:56:52 2012
> @@ -249,6 +249,14 @@
>  # BEFORE this include, otherwise options will not be correctly set on
>  # first cmake run
>  include(config-ix)
> +
> +# By default, we target the host, but this can be overridden at CMake
> +# invocation time.
> +set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING
> +  "Default target for which LLVM will generate code." )
> +set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING
> +  "Default target for which LLVM will generate code." )
> +
>  include(HandleLLVMOptions)
>
>  # Verify that we can find a Python interpreter,
>
> Modified: llvm/trunk/cmake/config-ix.cmake
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=162219&r1=162218&r2=162219&view=diff
> ==============================================================================
> --- llvm/trunk/cmake/config-ix.cmake (original)
> +++ llvm/trunk/cmake/config-ix.cmake Mon Aug 20 14:56:52 2012
> @@ -294,9 +294,7 @@
>
>  # By default, we target the host, but this can be overridden at CMake
>  # invocation time.
> -set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}")
>  set(LLVM_HOSTTRIPLE "${LLVM_HOST_TRIPLE}")
> -set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
>
>  # Determine the native architecture.
>  string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list