2008-11-10 02:32:14 +01:00
|
|
|
|
|
|
|
if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
|
2008-11-10 23:09:59 +01:00
|
|
|
set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
|
2009-06-11 06:16:10 +02:00
|
|
|
set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen")
|
2008-11-10 02:32:14 +01:00
|
|
|
|
2008-11-10 03:35:55 +01:00
|
|
|
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
|
|
|
|
COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
|
2008-11-10 02:32:14 +01:00
|
|
|
|
2008-11-10 03:35:55 +01:00
|
|
|
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
2008-11-10 02:32:14 +01:00
|
|
|
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
|
|
|
|
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
|
2008-11-10 03:35:55 +01:00
|
|
|
DEPENDS ${CX_NATIVE_TG_DIR}
|
|
|
|
COMMENT "Configuring native TableGen...")
|
2008-11-10 02:32:14 +01:00
|
|
|
|
2009-06-11 06:16:10 +02:00
|
|
|
add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE}
|
2008-11-10 03:35:55 +01:00
|
|
|
COMMAND ${CMAKE_BUILD_TOOL}
|
|
|
|
DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
|
|
|
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
|
2008-11-10 02:32:14 +01:00
|
|
|
COMMENT "Building native TableGen...")
|
2009-06-11 06:16:10 +02:00
|
|
|
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE})
|
2008-11-10 03:35:55 +01:00
|
|
|
|
2008-11-10 02:32:14 +01:00
|
|
|
add_dependencies(tblgen NativeTableGen)
|
|
|
|
|
2008-11-10 23:09:59 +01:00
|
|
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR})
|
2008-11-09 19:53:19 +01:00
|
|
|
endif()
|