From 56c93435fd9b0c1cf92250abbd32dd60f835524b Mon Sep 17 00:00:00 2001 From: Dudejoe870 Date: Wed, 3 Apr 2024 14:53:46 -0500 Subject: [PATCH] Improve binary size further This should actually make the binaries more reasonably sized. --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ef4bd9..9b15c84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ else() set(GODOT_COMPILE_FLAGS "-fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fexceptions -frtti -pthread") if(CMAKE_BUILD_TYPE MATCHES Debug) - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -g -fno-omit-frame-pointer -O0") + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-omit-frame-pointer -O0") else() set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -O3") endif() @@ -119,6 +119,14 @@ set_property(TARGET libopenmpt APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMP set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS}) set_property(TARGET libopenmpt APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS}) +# Only generate debug symbols for the main extension... NOT libopenmpt. +# Otherwise the binary sizes will be out of control. +# Comment this out and compile if you really need to debug what libopenmpt is doing +# (you probably don't) +if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND CMAKE_BUILD_TYPE MATCHES Debug) + set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS "-g") +endif() + # Create the correct name (godot.os.build_type.system_bits) # Synchronized with godot-cpp's CMakeLists.txt