mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 00:11:00 +00:00
901166c939
The basic idea is similar to the existing cross compilation support. A directory must be configured to build host versions of tablegen tools and llvm-config. This directory can be user provided (and configured), or it can be created during the build. During a build the native build directory will be configured and built to supply the tablegen tools used during the build. A user could also explicitly provide the tablegen executables to run on the CMake command line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217105 91177308-0d34-0410-b5e6-96231b3b80d8
34 lines
1.4 KiB
CMake
34 lines
1.4 KiB
CMake
if(NOT DEFINED LLVM_NATIVE_BUILD)
|
|
set(LLVM_NATIVE_BUILD "${CMAKE_BINARY_DIR}/native")
|
|
message(STATUS "Setting native build dir to ${LLVM_NATIVE_BUILD}")
|
|
endif(NOT DEFINED LLVM_NATIVE_BUILD)
|
|
|
|
add_custom_command(OUTPUT ${LLVM_NATIVE_BUILD}
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_NATIVE_BUILD}
|
|
COMMENT "Creating ${LLVM_NATIVE_BUILD}...")
|
|
|
|
add_custom_command(OUTPUT ${LLVM_NATIVE_BUILD}/CMakeCache.txt
|
|
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${CMAKE_SOURCE_DIR}
|
|
WORKING_DIRECTORY ${LLVM_NATIVE_BUILD}
|
|
DEPENDS ${LLVM_NATIVE_BUILD}
|
|
COMMENT "Configuring native LLVM...")
|
|
|
|
add_custom_target(ConfigureNativeLLVM DEPENDS ${LLVM_NATIVE_BUILD}/CMakeCache.txt)
|
|
|
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${LLVM_NATIVE_BUILD})
|
|
|
|
if(NOT IS_DIRECTORY ${LLVM_NATIVE_BUILD})
|
|
if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
|
|
set(HOST_SYSROOT_FLAGS -DCMAKE_OSX_SYSROOT=macosx)
|
|
endif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
message(STATUS "Configuring native build...")
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
|
${LLVM_NATIVE_BUILD} )
|
|
|
|
message(STATUS "Configuring native targets...")
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release
|
|
-G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD} ${HOST_SYSROOT_FLAGS} ${CMAKE_SOURCE_DIR}
|
|
WORKING_DIRECTORY ${LLVM_NATIVE_BUILD} )
|
|
endif(NOT IS_DIRECTORY ${LLVM_NATIVE_BUILD})
|