summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 33 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef072ec..7000d0a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,9 +4,10 @@ project(demo64k LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
-#-- - Configuration Options -- -
+#-- - Configuration Options -- -
option(DEMO_SIZE_OPT "Enable size optimization flags" OFF)
option(DEMO_STRIP_ALL "Strip all unnecessary code for final build" OFF)
+option(DEMO_FINAL_STRIP "Strip ALL error checking for final-final build" OFF)
option(DEMO_BUILD_TESTS "Build tests" OFF)
option(DEMO_BUILD_TOOLS "Build tools" OFF)
option(DEMO_ENABLE_COVERAGE "Enable code coverage generation (macOS only)" OFF)
@@ -18,6 +19,15 @@ if (DEMO_ALL_OPTIONS)
set(DEMO_STRIP_ALL ON)
set(DEMO_BUILD_TESTS ON)
set(DEMO_BUILD_TOOLS ON)
+ # NOTE: DEMO_FINAL_STRIP is NOT included here (too dangerous for testing)
+endif()
+
+# FINAL_STRIP: Most aggressive stripping (removes ALL error checking)
+# Implies STRIP_ALL (stricter superset)
+if (DEMO_FINAL_STRIP)
+ add_definitions(-DFINAL_STRIP)
+ set(DEMO_STRIP_ALL ON)
+ message(STATUS "FINAL_STRIP enabled - all error checking will be removed")
endif()
if (DEMO_STRIP_ALL)
@@ -308,6 +318,28 @@ if (DEMO_SIZE_OPT)
endif()
# ==============================================================================
+# Final Build Target (make final)
+# ==============================================================================
+# Convenience target for final production build with all stripping enabled
+# Usage: make final
+# This reconfigures CMake with FINAL_STRIP and rebuilds demo64k
+# Note: Only create this target if we're NOT already in FINAL_STRIP mode
+
+if (NOT DEMO_FINAL_STRIP)
+ add_custom_target(final
+ COMMAND ${CMAKE_COMMAND} -E echo "Building FINAL production binary..."
+ COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DDEMO_FINAL_STRIP=ON -DDEMO_SIZE_OPT=ON
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target demo64k -j8
+ COMMAND ${CMAKE_COMMAND} -E echo ""
+ COMMAND ${CMAKE_COMMAND} -E echo "Final build complete!"
+ COMMAND ${CMAKE_COMMAND} -E echo "Binary: ${CMAKE_BINARY_DIR}/demo64k"
+ COMMAND ls -lh ${CMAKE_BINARY_DIR}/demo64k
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMENT "Building final production binary with FINAL_STRIP"
+ )
+endif()
+
+# ==============================================================================
# Test Demo (Audio/Visual Sync Tool)
# ==============================================================================