From 10e59986142f88826b252a24507673c8728730e5 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 22 Mar 2026 19:42:03 +0100 Subject: [PATCH 1/2] Build wxWidgets as minimal static components --- CMakeLists.txt | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fb5d91..ae39bad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,10 +95,34 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR APPLE) endif() set(wxBUILD_SHARED OFF CACHE BOOL "" FORCE) - set(wxBUILD_MONOLITHIC ON CACHE BOOL "" FORCE) + set(wxBUILD_MONOLITHIC OFF CACHE BOOL "" FORCE) set(wxBUILD_PRECOMP OFF CACHE BOOL "" FORCE) set(wxBUILD_USE_STATIC_RUNTIME ON CACHE BOOL "" FORCE) + set(wxUSE_AUI ON CACHE BOOL "" FORCE) + set(wxUSE_DEBUGREPORT OFF CACHE BOOL "" FORCE) + set(wxUSE_FS_INET OFF CACHE BOOL "" FORCE) + set(wxUSE_GRID ON CACHE BOOL "" FORCE) + set(wxUSE_HELP OFF CACHE BOOL "" FORCE) + set(wxUSE_OPENGL OFF CACHE BOOL "" FORCE) + set(wxUSE_PRINTING_ARCHITECTURE ON CACHE BOOL "" FORCE) + set(wxUSE_PROTOCOL OFF CACHE BOOL "" FORCE) + set(wxUSE_PROTOCOL_FILE OFF CACHE BOOL "" FORCE) + set(wxUSE_PROTOCOL_FTP OFF CACHE BOOL "" FORCE) + set(wxUSE_PROTOCOL_HTTP OFF CACHE BOOL "" FORCE) + set(wxUSE_HTML OFF CACHE BOOL "" FORCE) + set(wxUSE_MEDIACTRL OFF CACHE BOOL "" FORCE) + set(wxUSE_MS_HTML_HELP OFF CACHE BOOL "" FORCE) + set(wxUSE_PROPGRID OFF CACHE BOOL "" FORCE) + set(wxUSE_RIBBON OFF CACHE BOOL "" FORCE) + set(wxUSE_RICHTEXT OFF CACHE BOOL "" FORCE) + set(wxUSE_SOCKETS OFF CACHE BOOL "" FORCE) set(wxUSE_STC OFF CACHE BOOL "" FORCE) + set(wxUSE_URL OFF CACHE BOOL "" FORCE) + set(wxUSE_WEBVIEW OFF CACHE BOOL "" FORCE) + set(wxUSE_WEBREQUEST OFF CACHE BOOL "" FORCE) + set(wxUSE_WXHTML_HELP OFF CACHE BOOL "" FORCE) + set(wxUSE_XML OFF CACHE BOOL "" FORCE) + set(wxUSE_XRC OFF CACHE BOOL "" FORCE) if(CSV_EXPLORER_MINGW_CROSS) set(wxUSE_WEBVIEW OFF CACHE BOOL "" FORCE) @@ -119,13 +143,7 @@ endif() ) FetchContent_MakeAvailable(wxwidgets) - if(TARGET wx::wx) - target_link_libraries(csv_explorer PRIVATE wx::wx) - elseif(TARGET wx::mono) - target_link_libraries(csv_explorer PRIVATE wx::mono) - elseif(TARGET wxmono) - target_link_libraries(csv_explorer PRIVATE wxmono) - elseif(TARGET wx::wxcore AND TARGET wx::wxbase) + if(TARGET wx::wxcore AND TARGET wx::wxbase) set(_wx_widgets_targets wx::wxbase wx::wxcore) if(TARGET wx::wxadv) list(APPEND _wx_widgets_targets wx::wxadv) @@ -142,13 +160,7 @@ endif() if(TARGET wx::aui) list(APPEND _wx_widgets_targets wx::aui) endif() - if(TARGET wxWidgets::wxWidgets) - target_link_libraries(csv_explorer PRIVATE wxWidgets::wxWidgets) - else() - target_link_libraries(csv_explorer PRIVATE ${_wx_widgets_targets}) - endif() - elseif(TARGET wxWidgets::wxWidgets) - target_link_libraries(csv_explorer PRIVATE wxWidgets::wxWidgets) + target_link_libraries(csv_explorer PRIVATE ${_wx_widgets_targets}) else() # As a final fallback, use the FindwxWidgets-compatible variables generated # by wxWidgetsConfig.cmake if available. From ff1621a3eee0c3abf10cf88069d0764f88f632de Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 22 Mar 2026 19:55:10 +0100 Subject: [PATCH 2/2] Strip app binaries after linking --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae39bad..b9e4398 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,14 @@ set_target_properties(csv_explorer PROPERTIES OUTPUT_NAME "csv-explorer" ) +if((APPLE OR WIN32) AND CMAKE_STRIP) + add_custom_command( + TARGET csv_explorer POST_BUILD + COMMAND "${CMAKE_STRIP}" "$" + COMMENT "Stripping csv-explorer binary" + ) +endif() + target_include_directories(csv_explorer PRIVATE ${CMAKE_CURRENT_BINARY_DIR}