[llvm-commits] [llvm] r148822 - in /llvm/trunk/cmake: config-ix.cmake modules/CMakeLists.txt modules/GetHostTriple.cmake modules/GetTargetTriple.cmake

Chandler Carruth chandlerc at gmail.com
Tue Jan 24 10:00:44 PST 2012


Author: chandlerc
Date: Tue Jan 24 12:00:44 2012
New Revision: 148822

URL: http://llvm.org/viewvc/llvm-project?rev=148822&view=rev
Log:
Undo an over zealous rename. This bit of the CMake build really is
dealing in the host triple, be honest about it and document the decision
to default the target triple to the host triple unless overridden.

Added:
    llvm/trunk/cmake/modules/GetHostTriple.cmake
      - copied, changed from r148782, llvm/trunk/cmake/modules/GetTargetTriple.cmake
Removed:
    llvm/trunk/cmake/modules/GetTargetTriple.cmake
Modified:
    llvm/trunk/cmake/config-ix.cmake
    llvm/trunk/cmake/modules/CMakeLists.txt

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=148822&r1=148821&r2=148822&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Tue Jan 24 12:00:44 2012
@@ -287,15 +287,18 @@
 
 check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
 
-include(GetTargetTriple)
-get_target_triple(LLVM_DEFAULT_TARGET_TRIPLE)
+include(GetHostTriple)
+get_host_triple(LLVM_HOST_TRIPLE)
 
+# By default, we target the host, but this can be overridden at CMake
+# invocation time.
+set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}")
 set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
 
 # Determine the native architecture.
 string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
 if( LLVM_NATIVE_ARCH STREQUAL "host" )
-  string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_DEFAULT_TARGET_TRIPLE})
+  string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
 endif ()
 
 if (LLVM_NATIVE_ARCH MATCHES "i[2-6]86")

Modified: llvm/trunk/cmake/modules/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CMakeLists.txt?rev=148822&r1=148821&r2=148822&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CMakeLists.txt (original)
+++ llvm/trunk/cmake/modules/CMakeLists.txt Tue Jan 24 12:00:44 2012
@@ -32,6 +32,6 @@
   PATTERN LLVMConfig.cmake EXCLUDE
   PATTERN LLVMConfigVersion.cmake EXCLUDE
   PATTERN LLVM-Config.cmake EXCLUDE
-  PATTERN GetTargetTriple.cmake EXCLUDE
+  PATTERN GetHostTriple.cmake EXCLUDE
   PATTERN VersionFromVCS.cmake EXCLUDE
   PATTERN CheckAtomic.cmake EXCLUDE)

Copied: llvm/trunk/cmake/modules/GetHostTriple.cmake (from r148782, llvm/trunk/cmake/modules/GetTargetTriple.cmake)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/GetHostTriple.cmake?p2=llvm/trunk/cmake/modules/GetHostTriple.cmake&p1=llvm/trunk/cmake/modules/GetTargetTriple.cmake&r1=148782&r2=148822&rev=148822&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/GetTargetTriple.cmake (original)
+++ llvm/trunk/cmake/modules/GetHostTriple.cmake Tue Jan 24 12:00:44 2012
@@ -1,7 +1,7 @@
 # Returns the host triple.
 # Invokes config.guess
 
-function( get_target_triple var )
+function( get_host_triple var )
   if( MSVC )
     if( CMAKE_CL_64 )
       set( value "x86_64-pc-win32" )
@@ -27,4 +27,4 @@
   endif( MSVC )
   set( ${var} ${value} PARENT_SCOPE )
   message(STATUS "Target triple: ${value}")
-endfunction( get_target_triple var )
+endfunction( get_host_triple var )

Removed: llvm/trunk/cmake/modules/GetTargetTriple.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/GetTargetTriple.cmake?rev=148821&view=auto
==============================================================================
--- llvm/trunk/cmake/modules/GetTargetTriple.cmake (original)
+++ llvm/trunk/cmake/modules/GetTargetTriple.cmake (removed)
@@ -1,30 +0,0 @@
-# Returns the host triple.
-# Invokes config.guess
-
-function( get_target_triple var )
-  if( MSVC )
-    if( CMAKE_CL_64 )
-      set( value "x86_64-pc-win32" )
-    else()
-      set( value "i686-pc-win32" )
-    endif()
-  elseif( MINGW AND NOT MSYS )
-    if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-      set( value "x86_64-w64-mingw32" )
-    else()
-      set( value "i686-pc-mingw32" )
-    endif()
-  else( MSVC )
-    set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
-    execute_process(COMMAND sh ${config_guess}
-      RESULT_VARIABLE TT_RV
-      OUTPUT_VARIABLE TT_OUT
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    if( NOT TT_RV EQUAL 0 )
-      message(FATAL_ERROR "Failed to execute ${config_guess}")
-    endif( NOT TT_RV EQUAL 0 )
-    set( value ${TT_OUT} )
-  endif( MSVC )
-  set( ${var} ${value} PARENT_SCOPE )
-  message(STATUS "Target triple: ${value}")
-endfunction( get_target_triple var )





More information about the llvm-commits mailing list