From 821bc04a7ae3061bcecd58bcea922b212f4359b5 Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Fri, 29 Sep 2017 22:31:35 +0200 Subject: [PATCH] set -ffunction-sections option on libretro and libConsole, and use gc-sections in Samples/HelloWorld. --- Console/CMakeLists.txt | 3 +++ Samples/HelloWorld/CMakeLists.txt | 10 ++++++++++ libretro/CMakeLists.txt | 3 +++ 3 files changed, 16 insertions(+) diff --git a/Console/CMakeLists.txt b/Console/CMakeLists.txt index d00754a988..f8524c0571 100644 --- a/Console/CMakeLists.txt +++ b/Console/CMakeLists.txt @@ -26,6 +26,9 @@ add_library(RetroConsole MacUtils.h InitConsole.cc ) +set_target_properties(retrocrt + PROPERTIES + COMPILE_OPTIONS -ffunction-sections) install(TARGETS RetroConsole DESTINATION lib) diff --git a/Samples/HelloWorld/CMakeLists.txt b/Samples/HelloWorld/CMakeLists.txt index 6b71e5f3e2..6d1d92fc63 100644 --- a/Samples/HelloWorld/CMakeLists.txt +++ b/Samples/HelloWorld/CMakeLists.txt @@ -10,3 +10,13 @@ add_application(HelloWorld hello.c CONSOLE ) + + # make the result as small as possible + # by removing unused code (gc-sections) + # and by removing macsbug function names + # (don't do this when debugging...) +set_target_properties(HelloWorld + PROPERTIES + COMPILE_OPTIONS -ffunction-sections + LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-strip-macsbug" + ) diff --git a/libretro/CMakeLists.txt b/libretro/CMakeLists.txt index 7ea19e6cc8..b6426aa4b0 100644 --- a/libretro/CMakeLists.txt +++ b/libretro/CMakeLists.txt @@ -71,5 +71,8 @@ add_library(retrocrt consolehooks.c ${ARCH_FILES} ) +set_target_properties(retrocrt + PROPERTIES + COMPILE_OPTIONS -ffunction-sections) install(TARGETS retrocrt DESTINATION lib)