2008-11-10 01:32:14 +00:00
|
|
|
|
|
|
|
if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
|
2008-11-10 22:09:59 +00:00
|
|
|
set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
|
2008-11-10 02:35:55 +00:00
|
|
|
set(LLVM_TABLEGEN "${CX_NATIVE_TG_DIR}/bin/tblgen")
|
2008-11-10 01:32:14 +00:00
|
|
|
|
2008-11-10 02:35:55 +00: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 01:32:14 +00:00
|
|
|
|
2008-11-10 02:35:55 +00:00
|
|
|
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
2008-11-10 01:32:14 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
|
|
|
|
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
|
2008-11-10 02:35:55 +00:00
|
|
|
DEPENDS ${CX_NATIVE_TG_DIR}
|
|
|
|
COMMENT "Configuring native TableGen...")
|
2008-11-10 01:32:14 +00:00
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${LLVM_TABLEGEN}
|
2008-11-10 02:35:55 +00:00
|
|
|
COMMAND ${CMAKE_BUILD_TOOL}
|
|
|
|
DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
|
|
|
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
|
2008-11-10 01:32:14 +00:00
|
|
|
COMMENT "Building native TableGen...")
|
|
|
|
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN})
|
2008-11-10 02:35:55 +00:00
|
|
|
|
2008-11-10 01:32:14 +00:00
|
|
|
add_dependencies(tblgen NativeTableGen)
|
|
|
|
|
2008-11-10 22:09:59 +00:00
|
|
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR})
|
2008-11-09 18:53:19 +00:00
|
|
|
endif()
|