From 6d8dabb15b4053bb423ed7a761f4cc3ca7acae66 Mon Sep 17 00:00:00 2001 From: James Benton Date: Wed, 30 May 2018 15:07:10 +0100 Subject: [PATCH] wut.cmake: Update to support creating RPL files, and exports. --- share/wut.cmake | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/share/wut.cmake b/share/wut.cmake index 785236c..2fe9612 100644 --- a/share/wut.cmake +++ b/share/wut.cmake @@ -1,39 +1,56 @@ cmake_minimum_required(VERSION 3.2) macro(wut_enable_newlib target) - set_property(TARGET ${target} - APPEND_STRING PROPERTY - LINK_FLAGS " -Wl,--whole-archive -lwutnewlib -Wl,--no-whole-archive") + set_property(TARGET ${target} APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,--whole-archive -lwutnewlib -Wl,--no-whole-archive") endmacro(wut_enable_newlib) macro(wut_enable_devoptab target) - set_property(TARGET ${target} - APPEND_STRING PROPERTY - LINK_FLAGS " -Wl,--whole-archive -lwutdevoptab -Wl,--no-whole-archive") + set_property(TARGET ${target} APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,--whole-archive -lwutdevoptab -Wl,--no-whole-archive") endmacro(wut_enable_devoptab) macro(wut_enable_stdcpp target) target_link_libraries(${target} stdc++) - set_property(TARGET ${target} - APPEND_STRING PROPERTY - COMPILE_FLAGS "-std=c++17") + set_property(TARGET ${target} APPEND_STRING PROPERTY + COMPILE_FLAGS "-std=c++17") - set_property(TARGET ${target} - APPEND_STRING PROPERTY - LINK_FLAGS " -Wl,--whole-archive -lwutstdc++ -Wl,--no-whole-archive") + set_property(TARGET ${target} APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,--whole-archive -lwutstdc++ -Wl,--no-whole-archive") endmacro(wut_enable_stdcpp) -macro(wut_create_rpx target source) +function(wut_create_rpl target source) + set(RPL_OPTIONS IS_RPX) + set(RPL_SINGLE_ARGS EXPORTS_FILE) + set(RPL_MULTI_ARGS "") + cmake_parse_arguments(RPL "${RPL_OPTIONS}" "${RPL_SINGLE_ARGS}" "${RPL_MULTI_ARGS}" "${ARGN}") + + if(NOT RPL_IS_RPX) + set(ELF2RPL_FLAGS ${ELF2RPL_FLAGS} --rpl) + endif() + + if(RPL_EXPORTS_FILE) + if(NOT IS_ABSOLUTE ${RPL_EXPORTS_FILE}) + set(RPL_EXPORTS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${RPL_EXPORTS_FILE}") + endif() + + set(ELF2RPL_FLAGS ${ELF2RPL_FLAGS} --exports ${RPL_EXPORTS_FILE}) + endif() + target_link_libraries(${source} wutcrt coreinit) add_custom_target(${target} ALL - COMMAND ${WUT_ELF2RPL} ${source} ${target} + COMMAND ${WUT_ELF2RPL} ${ELF2RPL_FLAGS} ${source} ${target} DEPENDS ${source} COMMENT "Converting to RPX ${target}") - add_dependencies(${target} ${source}) -endmacro(wut_create_rpx) + add_dependencies(${target} ${source}) +endfunction() + +function(wut_create_rpx) + wut_create_rpl(${ARGV} IS_RPX) +endfunction()