mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-08 13:50:42 +01:00
4374621f4b
ld will now auto-link everything to __rpx_start and pull in the correct crt *unless* rpl.specs is given on the commandline
67 lines
2.5 KiB
CMake
67 lines
2.5 KiB
CMake
cmake_minimum_required(VERSION 3.2)
|
|
|
|
# Links against wutnewlib
|
|
macro(wut_enable_newlib target)
|
|
message(DEPRECATION "wut_enable_newlib is deprecated and has no effect - it is always enabled; and the macro will be removed in a future release. Please remove it from your CMakeLists.")
|
|
endmacro()
|
|
|
|
# Links against stdc++ wutstdc++ and set -std=c++17
|
|
macro(wut_enable_stdcpp target)
|
|
message(DEPRECATION "wut_enable_stdcpp is deprecated and has no effect - it is always enabled when using C++; and the macro will be removed in a future release. Please remove it from your CMakeLists.")
|
|
endmacro()
|
|
|
|
# Links against devoptab
|
|
macro(wut_enable_devoptab target)
|
|
message(DEPRECATION "wut_enable_devoptab is deprecated and has no effect - it is always enabled; and the macro will be removed in a future release. Please remove it from your CMakeLists.")
|
|
endmacro()
|
|
|
|
# Links against wutmalloc
|
|
macro(wut_default_malloc target)
|
|
message(DEPRECATION "wut_default_malloc is deprecated and has no effect - it is always enabled; and the macro will be removed in a future release. Please remove it from your CMakeLists.")
|
|
endmacro()
|
|
|
|
# Generates ${target}_exports.s from an exports file and adds it to the build
|
|
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()
|
|
|
|
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)
|
|
endmacro()
|
|
|
|
function(wut_create_rpl target source)
|
|
set(RPL_OPTIONS IS_RPX)
|
|
set(RPL_SINGLE_ARGS "")
|
|
set(RPL_MULTI_ARGS "")
|
|
cmake_parse_arguments(RPL "${RPL_OPTIONS}" "${RPL_SINGLE_ARGS}" "${RPL_MULTI_ARGS}" "${ARGN}")
|
|
|
|
if(RPL_IS_RPX)
|
|
# Do nothing - the defaults are good for RPX
|
|
else()
|
|
set(ELF2RPL_FLAGS ${ELF2RPL_FLAGS} --rpl)
|
|
set_property(TARGET ${source} APPEND_STRING PROPERTY
|
|
LINK_FLAGS "-specs=${WUT_ROOT}/share/rpl.specs")
|
|
endif()
|
|
|
|
add_custom_target(${target} ALL
|
|
COMMAND ${CMAKE_STRIP} -g ${source}
|
|
COMMAND ${WUT_ELF2RPL} ${ELF2RPL_FLAGS} ${source} ${target}
|
|
DEPENDS ${source}
|
|
COMMENT "Converting to RPX ${target}")
|
|
|
|
add_dependencies(${target} ${source})
|
|
endfunction()
|
|
|
|
function(wut_create_rpx)
|
|
wut_create_rpl(${ARGV} IS_RPX)
|
|
endfunction()
|