mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-26 19:43:35 +01:00
cmake: make the linker script a link dependency of projects
This way when we update the linker script in the upcoming LTO support commit, it will be used automatically without a full rebuild.
This commit is contained in:
parent
4a2b60b785
commit
ea5f21d1dc
1 changed files with 16 additions and 5 deletions
|
@ -1,20 +1,30 @@
|
|||
macro(get_linker_script_path OUTVAR NAME)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-file-name=${NAME}
|
||||
OUTPUT_VARIABLE ${OUTVAR}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endmacro()
|
||||
|
||||
# Determine platform Code
|
||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
set(PC cg)
|
||||
set(INTF_DEFN FXCG50)
|
||||
set(INTF_LINK "-T;$<IF:$<CONFIG:FastLoad>,fxcg50_fastload.ld,fxcg50.ld>")
|
||||
get_linker_script_path(LS1 fxcg50_fastload.ld)
|
||||
get_linker_script_path(LS2 fxcg50.ld)
|
||||
set(INTF_LINKER_SCRIPT
|
||||
"$<IF:$<CONFIG:FastLoad>,${LS1},${LS2}>")
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||
set(PC fx)
|
||||
set(INTF_DEFN FX9860G)
|
||||
set(INTF_LINK "-T;fx9860g.ld")
|
||||
get_linker_script_path(INTF_LINKER_SCRIPT "fx9860g.ld")
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A)
|
||||
set(PC fxg3a)
|
||||
set(INTF_DEFN FX9860G_G3A)
|
||||
set(INTF_LINK "-T;fxcg50.ld")
|
||||
get_linker_script_path(INTF_LINKER_SCRIPT "fxcg50.ld")
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCP)
|
||||
set(PC cp)
|
||||
set(INTF_DEFN FXCP)
|
||||
set(INTF_LINK "-T;fxcp_hh2.ld")
|
||||
get_linker_script_path(INTF_LINKER_SCRIPT "fxcp_hh2.ld")
|
||||
else()
|
||||
message(FATAL_ERROR "gint: unknown fxSDK platform '${FXSDK_PLATFORM}'")
|
||||
endif()
|
||||
|
@ -73,7 +83,8 @@ if(Gint_FOUND)
|
|||
INTERFACE_COMPILE_OPTIONS -fstrict-volatile-bitfields
|
||||
INTERFACE_COMPILE_DEFINITIONS "${INTF_DEFN}"
|
||||
INTERFACE_LINK_LIBRARIES "-lopenlibm;-lgcc"
|
||||
INTERFACE_LINK_OPTIONS "${INTF_LINK}")
|
||||
INTERFACE_LINK_OPTIONS "-T;${INTF_LINKER_SCRIPT}"
|
||||
INTERFACE_LINK_DEPENDS "${INTF_LINKER_SCRIPT}")
|
||||
|
||||
target_link_libraries(Gint::Gint INTERFACE Gint::Fxlibc)
|
||||
target_link_libraries(Gint::Fxlibc INTERFACE Gint::Gint)
|
||||
|
|
Loading…
Reference in a new issue