From 35dedc550ace5f7e2ac1e33c15f6ccf00bce33a3 Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Wed, 9 Jan 2019 00:11:12 +0100 Subject: [PATCH] setup -carbon flag in toolchain file --- Samples/HelloWorld/CMakeLists.txt | 1 - Samples/Raytracer/CMakeLists.txt | 17 ++++++++--------- cmake/add_application.cmake | 8 +++----- cmake/intreecarbon.toolchain.cmake.in | 3 ++- cmake/retrocarbon.toolchain.cmake.in | 1 + 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Samples/HelloWorld/CMakeLists.txt b/Samples/HelloWorld/CMakeLists.txt index 19b8b032fe..b69d2e22f6 100644 --- a/Samples/HelloWorld/CMakeLists.txt +++ b/Samples/HelloWorld/CMakeLists.txt @@ -18,7 +18,6 @@ add_application(HelloWorld set_target_properties(HelloWorld PROPERTIES COMPILE_OPTIONS -ffunction-sections) if(CMAKE_SYSTEM_NAME MATCHES Retro68) set_target_properties(HelloWorld PROPERTIES LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-strip-macsbug") - else() set_target_properties(HelloWorld PROPERTIES LINK_FLAGS "-Wl,-gc-sections") endif() diff --git a/Samples/Raytracer/CMakeLists.txt b/Samples/Raytracer/CMakeLists.txt index b604fa94cf..25ec891081 100644 --- a/Samples/Raytracer/CMakeLists.txt +++ b/Samples/Raytracer/CMakeLists.txt @@ -36,23 +36,22 @@ if(APPLE) target_link_libraries(Raytracer "-framework Carbon") target_link_libraries(Raytracer2 "-framework Carbon") else() - # save 200KB of code by removing unused stuff - set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections") - add_application(Raytracer raytracer.c ) - target_link_libraries(Raytracer "-lm") + target_link_libraries(Raytracer "-lm") add_application(Raytracer2 raytracer2.cc fixed.h fixed.cc - ) - if(NOT (CMAKE_SYSTEM_NAME MATCHES RetroCarbon)) + ) - add_application(FixedBenchmark CONSOLE - FILES fixedbenchmark.cc fixed.h fixed.cc) - endif() + add_application(FixedBenchmark CONSOLE + FILES fixedbenchmark.cc fixed.h fixed.cc) + + # save 200KB of code by removing unused stuff + set_target_properties(Raytracer PROPERTIES LINK_FLAGS "-Wl,-gc-sections") + set_target_properties(Raytracer2 PROPERTIES LINK_FLAGS "-Wl,-gc-sections") endif() diff --git a/cmake/add_application.cmake b/cmake/add_application.cmake index 60b46222ca..f1a33d7503 100644 --- a/cmake/add_application.cmake +++ b/cmake/add_application.cmake @@ -5,7 +5,7 @@ cmake_policy(SET CMP0012 NEW) function(add_application name) - set(options DEBUGBREAK CONSOLE CARBON CLASSIC) + set(options DEBUGBREAK CONSOLE) set(oneValueArgs TYPE CREATOR) set(multiValueArgs FILES MAKEAPPL_ARGS) @@ -15,7 +15,7 @@ function(add_application name) set(REZ_FLAGS) if(CMAKE_SYSTEM_NAME MATCHES RetroPPC OR CMAKE_SYSTEM_NAME MATCHES RetroCarbon) - if((CMAKE_SYSTEM_NAME MATCHES RetroCarbon OR ARGS_CARBON) AND NOT ARGS_CLASSIC) + if(CMAKE_SYSTEM_NAME MATCHES RetroCarbon) set(REZ_FLAGS -DTARGET_API_MAC_CARBON=1) endif() endif() @@ -95,10 +95,8 @@ function(add_application name) add_custom_target(${name}_APPL ALL DEPENDS ${name}.bin) elseif(CMAKE_SYSTEM_NAME MATCHES RetroPPC OR CMAKE_SYSTEM_NAME MATCHES RetroCarbon) - if((CMAKE_SYSTEM_NAME MATCHES RetroCarbon OR ARGS_CARBON) AND NOT ARGS_CLASSIC) + if(CMAKE_SYSTEM_NAME MATCHES RetroCarbon) set(REZ_TEMPLATE "${REZ_TEMPLATES_PATH}/RetroCarbonAPPL.r") - target_compile_definitions(${name} PUBLIC -DTARGET_API_MAC_CARBON=1) - target_link_libraries(${name} -carbon) else() set(REZ_TEMPLATE "${REZ_TEMPLATES_PATH}/RetroPPCAPPL.r") endif() diff --git a/cmake/intreecarbon.toolchain.cmake.in b/cmake/intreecarbon.toolchain.cmake.in index 092d1adb5a..13a94170b1 100644 --- a/cmake/intreecarbon.toolchain.cmake.in +++ b/cmake/intreecarbon.toolchain.cmake.in @@ -28,7 +28,8 @@ set( REZ_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/RIncludes" ) set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-gcc" ) set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-g++" ) +set( CMAKE_EXE_LINKER_FLAGS_INIT "-carbon" ) list( APPEND CMAKE_MODULE_PATH "@CMAKE_SOURCE_DIR@/cmake" ) -add_definitions( -DTARGET_API_MAC_CARBON=1 ) \ No newline at end of file +add_definitions( -DTARGET_API_MAC_CARBON=1 ) diff --git a/cmake/retrocarbon.toolchain.cmake.in b/cmake/retrocarbon.toolchain.cmake.in index 54c2d5180b..a74b35af7a 100644 --- a/cmake/retrocarbon.toolchain.cmake.in +++ b/cmake/retrocarbon.toolchain.cmake.in @@ -28,6 +28,7 @@ set( REZ_INCLUDE_PATH "${RETRO68_ROOT}/m68k-apple-macos/RIncludes" ) set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-gcc" ) set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-g++" ) +set( CMAKE_EXE_LINKER_FLAGS_INIT "-carbon" ) set( REZ_TEMPLATES_PATH ${REZ_INCLUDE_PATH})