]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | if(NOT DEFINED LLVM_NATIVE_BUILD) |
2 | set(LLVM_NATIVE_BUILD "${CMAKE_BINARY_DIR}/native") | |
3 | message(STATUS "Setting native build dir to ${LLVM_NATIVE_BUILD}") | |
4 | endif(NOT DEFINED LLVM_NATIVE_BUILD) | |
5 | ||
6 | add_custom_command(OUTPUT ${LLVM_NATIVE_BUILD} | |
7 | COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_NATIVE_BUILD} | |
8 | COMMENT "Creating ${LLVM_NATIVE_BUILD}...") | |
9 | ||
10 | add_custom_command(OUTPUT ${LLVM_NATIVE_BUILD}/CMakeCache.txt | |
11 | COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${CMAKE_SOURCE_DIR} | |
12 | WORKING_DIRECTORY ${LLVM_NATIVE_BUILD} | |
13 | DEPENDS ${LLVM_NATIVE_BUILD} | |
14 | COMMENT "Configuring native LLVM...") | |
15 | ||
16 | add_custom_target(ConfigureNativeLLVM DEPENDS ${LLVM_NATIVE_BUILD}/CMakeCache.txt) | |
17 | ||
18 | set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${LLVM_NATIVE_BUILD}) | |
19 | ||
20 | if(NOT IS_DIRECTORY ${LLVM_NATIVE_BUILD}) | |
21 | if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin") | |
22 | set(HOST_SYSROOT_FLAGS -DCMAKE_OSX_SYSROOT=macosx) | |
23 | endif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin") | |
24 | ||
25 | message(STATUS "Configuring native build...") | |
26 | execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory | |
27 | ${LLVM_NATIVE_BUILD} ) | |
28 | ||
29 | message(STATUS "Configuring native targets...") | |
30 | execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release | |
31 | -G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD} ${HOST_SYSROOT_FLAGS} ${CMAKE_SOURCE_DIR} | |
32 | WORKING_DIRECTORY ${LLVM_NATIVE_BUILD} ) | |
33 | endif(NOT IS_DIRECTORY ${LLVM_NATIVE_BUILD}) |