2 if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
3 set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
4 set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen")
6 add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}
7 COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
8 COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
10 add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
11 COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
12 WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
13 DEPENDS ${CX_NATIVE_TG_DIR}
14 COMMENT "Configuring native TableGen...")
16 add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE}
17 COMMAND ${CMAKE_BUILD_TOOL}
18 DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
19 WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
20 COMMENT "Building native TableGen...")
21 add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE})
23 add_dependencies(tblgen NativeTableGen)
25 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR})