2018-05-23 00:08:13 +02:00
|
|
|
cmake_minimum_required(VERSION 3.2)
|
|
|
|
|
2018-05-27 13:12:49 +02:00
|
|
|
macro(wut_enable_newlib target)
|
2018-05-30 16:07:10 +02:00
|
|
|
set_property(TARGET ${target} APPEND_STRING PROPERTY
|
|
|
|
LINK_FLAGS " -Wl,--whole-archive -lwutnewlib -Wl,--no-whole-archive")
|
2018-05-27 13:12:49 +02:00
|
|
|
endmacro(wut_enable_newlib)
|
|
|
|
|
|
|
|
macro(wut_enable_devoptab target)
|
2018-05-30 16:07:10 +02:00
|
|
|
set_property(TARGET ${target} APPEND_STRING PROPERTY
|
|
|
|
LINK_FLAGS " -Wl,--whole-archive -lwutdevoptab -Wl,--no-whole-archive")
|
2018-05-27 13:12:49 +02:00
|
|
|
endmacro(wut_enable_devoptab)
|
|
|
|
|
2018-05-25 18:21:59 +02:00
|
|
|
macro(wut_enable_stdcpp target)
|
|
|
|
target_link_libraries(${target}
|
2018-05-27 13:12:49 +02:00
|
|
|
stdc++)
|
|
|
|
|
2018-05-30 16:07:10 +02:00
|
|
|
set_property(TARGET ${target} APPEND_STRING PROPERTY
|
|
|
|
COMPILE_FLAGS "-std=c++17")
|
2018-05-25 18:21:59 +02:00
|
|
|
|
2018-05-30 16:07:10 +02:00
|
|
|
set_property(TARGET ${target} APPEND_STRING PROPERTY
|
|
|
|
LINK_FLAGS " -Wl,--whole-archive -lwutstdc++ -Wl,--no-whole-archive")
|
2018-05-25 18:21:59 +02:00
|
|
|
endmacro(wut_enable_stdcpp)
|
|
|
|
|
2018-05-30 19:54:41 +02:00
|
|
|
macro(wut_add_exports target exports_file)
|
|
|
|
set(RPL_EXPORTS_FILE ${exports_file})
|
|
|
|
if(NOT IS_ABSOLUTE ${exports_file})
|
|
|
|
set(RPL_EXPORTS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${exports_file}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT rpl_exports.s
|
|
|
|
COMMAND ${WUT_RPLEXPORTGEN} ${RPL_EXPORTS_FILE} rpl_exports.s
|
|
|
|
DEPENDS ${RPL_EXPORTS_FILE})
|
|
|
|
target_sources(${target} PRIVATE rpl_exports.s)
|
|
|
|
|
|
|
|
set_source_files_properties(rpl_exports.s PROPERTIES LANGUAGE C)
|
|
|
|
endmacro(wut_add_exports)
|
|
|
|
|
2018-05-30 16:07:10 +02:00
|
|
|
function(wut_create_rpl target source)
|
|
|
|
set(RPL_OPTIONS IS_RPX)
|
2018-05-30 19:54:41 +02:00
|
|
|
set(RPL_SINGLE_ARGS "")
|
2018-05-30 16:07:10 +02:00
|
|
|
set(RPL_MULTI_ARGS "")
|
|
|
|
cmake_parse_arguments(RPL "${RPL_OPTIONS}" "${RPL_SINGLE_ARGS}" "${RPL_MULTI_ARGS}" "${ARGN}")
|
|
|
|
|
2018-05-30 22:56:18 +02:00
|
|
|
if(RPL_IS_RPX)
|
|
|
|
target_link_libraries(${source}
|
|
|
|
wutcrt)
|
|
|
|
else()
|
2018-05-30 16:07:10 +02:00
|
|
|
set(ELF2RPL_FLAGS ${ELF2RPL_FLAGS} --rpl)
|
2018-05-30 22:56:18 +02:00
|
|
|
target_link_libraries(${source}
|
|
|
|
wutcrtrpl)
|
2018-05-30 16:07:10 +02:00
|
|
|
endif()
|
|
|
|
|
2018-05-25 12:31:38 +02:00
|
|
|
target_link_libraries(${source}
|
2018-05-27 13:12:49 +02:00
|
|
|
coreinit)
|
2018-05-25 12:31:38 +02:00
|
|
|
|
|
|
|
add_custom_target(${target} ALL
|
2018-05-30 16:07:10 +02:00
|
|
|
COMMAND ${WUT_ELF2RPL} ${ELF2RPL_FLAGS} ${source} ${target}
|
2018-05-27 13:12:49 +02:00
|
|
|
DEPENDS ${source}
|
|
|
|
COMMENT "Converting to RPX ${target}")
|
2018-05-25 12:31:38 +02:00
|
|
|
|
2018-05-30 16:07:10 +02:00
|
|
|
add_dependencies(${target} ${source})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(wut_create_rpx)
|
|
|
|
wut_create_rpl(${ARGV} IS_RPX)
|
|
|
|
endfunction()
|