[llvm-commits] [llvm] r58953 - in /llvm/trunk: CMakeLists.txt cmake/modules/CrossCompileLLVM.cmake
Oscar Fuentes
ofv at wanadoo.es
Sun Nov 9 18:35:55 PST 2008
Author: ofv
Date: Sun Nov 9 20:35:55 2008
New Revision: 58953
URL: http://llvm.org/viewvc/llvm-project?rev=58953&view=rev
Log:
CMake: Builds a native tblgen when cross-compiling and the user didn't
set LLVM_TABLEGEN.
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/modules/CrossCompileLLVM.cmake
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=58953&r1=58952&r2=58953&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Sun Nov 9 20:35:55 2008
@@ -139,7 +139,7 @@
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
set(LLVM_TABLEGEN "tblgen" CACHE
- STRING "Native TableGen executable.")
+ STRING "Native TableGen executable. Saves building one when cross-compiling.")
add_subdirectory(utils/TableGen)
Modified: llvm/trunk/cmake/modules/CrossCompileLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CrossCompileLLVM.cmake?rev=58953&r1=58952&r2=58953&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CrossCompileLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/CrossCompileLLVM.cmake Sun Nov 9 20:35:55 2008
@@ -1,42 +1,31 @@
if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
- # TODO: remove this when autobuilding the native tblgen works.
- message(FATAL_ERROR
- "Set LLVM_TABLEGEN to the full route to a native tblgen executable")
-
- message(STATUS "Configuring native TableGen...")
- set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
-
- execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
- RESULT_VARIABLE CX_NATIVE_TG_RV)
- if( NOT CX_NATIVE_TG_RV EQUAL 0 )
- message(FATAL_ERROR "Failed to create directory ${CX_NATIVE_TG_DIR}")
- endif()
+ set(LLVM_TABLEGEN "${CX_NATIVE_TG_DIR}/bin/tblgen")
+
+ message(STATUS "CX_NATIVE_TG_DIR : ${CX_NATIVE_TG_DIR}")
+ add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
+ COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
- execute_process(
+ add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
- RESULT_VARIABLE CX_NATIVE_TG_RV
- ERROR_VARIABLE CX_NATIVE_TG_ERROR)
- if( NOT CX_NATIVE_TG_RV EQUAL 0 )
- message(FATAL_ERROR
- "Error while configuring native TableGen:\n${CX_NATIVE_TG_ERROR}")
- endif()
-
- message(STATUS "Native TableGen configured.")
-
- set(LLVM_TABLEGEN "${CX_NATIVE_TG_DIR}/bin/tblgen")
+ DEPENDS ${CX_NATIVE_TG_DIR}
+ COMMENT "Configuring native TableGen...")
add_custom_command(OUTPUT ${LLVM_TABLEGEN}
- COMMAND ${CMAKE_BUILD_TOOL} -C ${CX_NATIVE_TG_DIR}/utils/TableGen
+ COMMAND ${CMAKE_BUILD_TOOL}
+ DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
+ WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
COMMENT "Building native TableGen...")
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN})
+
add_dependencies(tblgen NativeTableGen)
# TODO: We should clean the native build when the `clean target
# is invoked. This doesn't work.
-# add_custom_command(TARGET clean
-# COMMAND ${CMAKE_BUILD_TOOL} -C ${CX_NATIVE_TG_DIR}/utils/TableGen clean
-# POST_BUILD
-# COMMENT "Cleaning native TableGen...")
+ # add_custom_command(TARGET clean
+ # COMMAND ${CMAKE_BUILD_TOOL} -C ${CX_NATIVE_TG_DIR}/utils/TableGen clean
+ # POST_BUILD
+ # COMMENT "Cleaning native TableGen...")
endif()
More information about the llvm-commits
mailing list