cmake: Generate import file for linking to an rpl with wut_add_exports.

This commit is contained in:
James Benton 2020-06-06 16:00:05 +01:00 committed by James
parent a3eefa84e6
commit 07e77e9136

View File

@ -28,14 +28,24 @@ function(wut_add_exports target exports_file)
endif()
set(RPL_EXPORT_GEN_OUTPUT ${target}_exports.s)
add_custom_command(
OUTPUT ${RPL_EXPORT_GEN_OUTPUT}
COMMAND ${WUT_RPLEXPORTGEN} ${RPL_EXPORTS_FILE} ${RPL_EXPORT_GEN_OUTPUT}
DEPENDS ${RPL_EXPORTS_FILE})
target_sources(${target} PRIVATE ${RPL_EXPORT_GEN_OUTPUT})
set_source_files_properties(${RPL_EXPORT_GEN_OUTPUT} PROPERTIES LANGUAGE C)
set(RPL_IMPORT_GEN_OUTPUT ${target}_imports.s)
set(RPL_IMPORT_GEN_LD ${target}_imports.ld)
add_custom_command(
OUTPUT ${RPL_IMPORT_GEN_OUTPUT} ${RPL_IMPORT_GEN_LD}
COMMAND ${WUT_RPLIMPORTGEN} ${RPL_EXPORTS_FILE} ${RPL_IMPORT_GEN_OUTPUT} ${RPL_IMPORT_GEN_LD}
DEPENDS ${RPL_EXPORTS_FILE})
set_source_files_properties(${RPL_IMPORT_GEN_OUTPUT} PROPERTIES LANGUAGE C)
add_library(${target}_imports STATIC ${RPL_IMPORT_GEN_OUTPUT})
set_target_properties(${target}_imports PROPERTIES PREFIX "")
get_filename_component(RPL_IMPORT_LINKER_SCRIPT ${target}_imports.ld REALPATH BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(${target}_imports INTERFACE "-T${RPL_IMPORT_LINKER_SCRIPT}")
endfunction()
function(wut_create_rpl_deprecated target source)