mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
CMake: Support for cross-compiling. For now, requires a previously
built native tblgen which is passed to cmake in the variable LLVM_TABLEGEN. See http://www.cmake.org/Wiki/CmakeMingw for a quick example on how to cross-compile with CMake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58939 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
22b91d7fc4
commit
3ab40ca3d5
@ -111,10 +111,17 @@ add_subdirectory(lib/System)
|
||||
# Everything else depends on Support and System:
|
||||
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
|
||||
|
||||
set(LLVM_TABLEGEN "tblgen" CACHE
|
||||
STRING "Native TableGen executable.")
|
||||
|
||||
if( CMAKE_CROSSCOMPILING )
|
||||
include( CrossCompileLLVM )
|
||||
endif( CMAKE_CROSSCOMPILING )
|
||||
|
||||
add_subdirectory(utils/TableGen)
|
||||
|
||||
add_custom_command(OUTPUT ${llvm_builded_incs_dir}/Intrinsics.gen
|
||||
COMMAND tblgen -gen-intrinsic -I ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen
|
||||
COMMAND ${LLVM_TABLEGEN} -gen-intrinsic -I ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen
|
||||
DEPENDS tblgen
|
||||
COMMENT "Building intrinsics.gen...")
|
||||
|
||||
|
@ -24,7 +24,7 @@ macro(add_partially_linked_object lib)
|
||||
DEPENDS ${lib}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
|
||||
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
COMMAND ld "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
|
||||
COMMAND ${CMAKE_LINKER} "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
|
||||
COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION}
|
||||
)
|
||||
target_name_of_partially_linked_object(${lib} tnplo)
|
||||
|
6
cmake/modules/CrossCompileLLVM.cmake
Normal file
6
cmake/modules/CrossCompileLLVM.cmake
Normal file
@ -0,0 +1,6 @@
|
||||
# TODO: Build a native tblgen when cross-compiling, if the user
|
||||
# didn't set LLVM_TABLEGEN. Then, remove this check:
|
||||
if( CMAKE_CROSSCOMPILING AND ${LLVM_TABLEGEN} STREQUAL "tblgen" )
|
||||
message(FATAL_ERROR
|
||||
"Set LLVM_TABLEGEN to the full route to a native tblgen executable")
|
||||
endif()
|
@ -4,7 +4,7 @@
|
||||
|
||||
macro(tablegen ofn)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn}
|
||||
COMMAND ${LLVM_TABLEGEN} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn}
|
||||
DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS}
|
||||
COMMENT "Building ${ofn}..."
|
||||
)
|
||||
|
@ -63,8 +63,16 @@ set(LLVM_CONFIG_IN ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in)
|
||||
# set(LIBDEPS_TMP LibDeps.txt.tmp)
|
||||
# set(FINAL_LIBDEPS FinalLibDeps.txt)
|
||||
|
||||
if( CMAKE_CROSSCOMPILING )
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
endif()
|
||||
|
||||
if( NOT NM_PATH )
|
||||
message(FATAL_ERROR "`nm' was not found")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${LIBDEPS_TMP}
|
||||
COMMAND ${PERL_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/GenLibDeps.pl -flat ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} > ${LIBDEPS_TMP}
|
||||
COMMAND ${PERL_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/GenLibDeps.pl -flat ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} ${NM_PATH} > ${LIBDEPS_TMP}
|
||||
COMMENT "Regenerating ${LIBDEPS_TMP}")
|
||||
|
||||
add_custom_command(OUTPUT ${LIBDEPS}
|
||||
|
@ -3,7 +3,7 @@ set(LLVM_REQUIRES_EH 1)
|
||||
|
||||
macro(tgen ofn)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td -o ${ofn}
|
||||
COMMAND ${LLVM_TABLEGEN} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td -o ${ofn}
|
||||
DEPENDS
|
||||
tblgen
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/CompilerDriver/Common.td
|
||||
|
Loading…
Reference in New Issue
Block a user