diff --git a/share/wut.cmake b/share/wut.cmake index d2bedfc..12d0484 100644 --- a/share/wut.cmake +++ b/share/wut.cmake @@ -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)