mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
CMake: generalize the system that creates custom targets for
tablegenning to all libraries and executables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135908 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6d0ac80d5e
commit
ddfb69cd47
@ -2,6 +2,7 @@ include(LLVMProcessSources)
|
|||||||
include(LLVM-Config)
|
include(LLVM-Config)
|
||||||
|
|
||||||
macro(add_llvm_library name)
|
macro(add_llvm_library name)
|
||||||
|
create_tablegenning_custom_target( ${name} )
|
||||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||||
add_library( ${name} ${ALL_FILES} )
|
add_library( ${name} ${ALL_FILES} )
|
||||||
set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
|
set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
|
||||||
@ -32,6 +33,7 @@ macro(add_llvm_library name)
|
|||||||
add_dependencies(${name} ${CURRENT_LLVM_TARGET})
|
add_dependencies(${name} ${CURRENT_LLVM_TARGET})
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
|
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
|
||||||
|
add_tablegenning_dependency( ${name} )
|
||||||
endmacro(add_llvm_library name)
|
endmacro(add_llvm_library name)
|
||||||
|
|
||||||
|
|
||||||
@ -75,6 +77,7 @@ endmacro(add_llvm_loadable_module name)
|
|||||||
|
|
||||||
|
|
||||||
macro(add_llvm_executable name)
|
macro(add_llvm_executable name)
|
||||||
|
create_tablegenning_custom_target( ${name} )
|
||||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||||
if( EXCLUDE_FROM_ALL )
|
if( EXCLUDE_FROM_ALL )
|
||||||
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
|
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
|
||||||
@ -88,6 +91,7 @@ macro(add_llvm_executable name)
|
|||||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
||||||
endif( LLVM_COMMON_DEPENDS )
|
endif( LLVM_COMMON_DEPENDS )
|
||||||
link_system_libs( ${name} )
|
link_system_libs( ${name} )
|
||||||
|
add_tablegenning_dependency( ${name} )
|
||||||
endmacro(add_llvm_executable name)
|
endmacro(add_llvm_executable name)
|
||||||
|
|
||||||
|
|
||||||
@ -124,16 +128,7 @@ endmacro(add_llvm_utility name)
|
|||||||
|
|
||||||
|
|
||||||
macro(add_llvm_target target_name)
|
macro(add_llvm_target target_name)
|
||||||
if( TABLEGEN_OUTPUT )
|
|
||||||
add_custom_target(${target_name}Table_gen
|
|
||||||
DEPENDS ${TABLEGEN_OUTPUT})
|
|
||||||
add_dependencies(${target_name}Table_gen ${LLVM_COMMON_DEPENDS})
|
|
||||||
endif( TABLEGEN_OUTPUT )
|
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
|
add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
|
||||||
if ( TABLEGEN_OUTPUT )
|
|
||||||
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
|
|
||||||
set_target_properties(${target_name}Table_gen PROPERTIES FOLDER "Tablegenning")
|
|
||||||
endif (TABLEGEN_OUTPUT)
|
|
||||||
set( CURRENT_LLVM_TARGET LLVM${target_name} )
|
set( CURRENT_LLVM_TARGET LLVM${target_name} )
|
||||||
endmacro(add_llvm_target)
|
endmacro(add_llvm_target)
|
||||||
|
@ -44,3 +44,24 @@ macro(tablegen ofn)
|
|||||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||||
PROPERTIES GENERATED 1)
|
PROPERTIES GENERATED 1)
|
||||||
endmacro(tablegen)
|
endmacro(tablegen)
|
||||||
|
|
||||||
|
|
||||||
|
function(create_tablegenning_custom_target target)
|
||||||
|
# Creates the global target that runs the file-level dependencies
|
||||||
|
# for tablegenning.
|
||||||
|
if( TABLEGEN_OUTPUT )
|
||||||
|
add_custom_target(${target}Table_gen
|
||||||
|
DEPENDS ${TABLEGEN_OUTPUT})
|
||||||
|
add_dependencies(${target}Table_gen ${LLVM_COMMON_DEPENDS})
|
||||||
|
endif( TABLEGEN_OUTPUT )
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(add_tablegenning_dependency target)
|
||||||
|
# Makes the tablegenning step created with
|
||||||
|
# create_tablegenning_custom_target dependent on `target'.
|
||||||
|
if ( TABLEGEN_OUTPUT )
|
||||||
|
add_dependencies(${target} ${target}Table_gen)
|
||||||
|
set_target_properties(${target}Table_gen PROPERTIES FOLDER "Tablegenning")
|
||||||
|
endif (TABLEGEN_OUTPUT)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user