From 10e59986142f88826b252a24507673c8728730e5 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 22 Mar 2026 19:42:03 +0100 Subject: [PATCH 1/5] 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/5] 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} From b387c0d8df443118995f2930f010b6b290875b64 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 22 Mar 2026 20:07:46 +0100 Subject: [PATCH 3/5] Use Ninja and build universal macOS binaries --- .github/workflows/ci.yml | 12 ++++++------ CMakeLists.txt | 4 ++++ CMakePresets.json | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acf6af9..5476b88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: sudo apt-get install -y \ ccache \ cmake \ - make \ + ninja-build \ g++ \ "$WX_PKG" @@ -55,7 +55,7 @@ jobs: ccache --zero-stats - name: Configure - run: cmake -S . -B build/linux -DCMAKE_BUILD_TYPE=Release + run: cmake -S . -B build/linux -G Ninja -DCMAKE_BUILD_TYPE=Release - name: Build run: cmake --build build/linux --config Release @@ -83,8 +83,8 @@ jobs: path: ~/.cache/ccache key: ccache-${{ runner.os }}-${{ github.job }}-v1 - - name: Install ccache - run: brew install ccache + - name: Install build tools + run: brew install ccache ninja - name: Prime ccache run: | @@ -92,7 +92,7 @@ jobs: ccache --zero-stats - name: Configure - run: cmake -S . -B build/macos + run: cmake -S . -B build/macos -G Ninja - name: Build run: cmake --build build/macos @@ -126,7 +126,7 @@ jobs: sudo apt-get install -y \ ccache \ cmake \ - make \ + ninja-build \ g++-mingw-w64-x86-64 \ xz-utils \ mingw-w64 diff --git a/CMakeLists.txt b/CMakeLists.txt index b9e4398..f87d6cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.24) project(CSVExplorer VERSION 0.3.0 LANGUAGES CXX) +if(APPLE) + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "Build universal macOS binaries" FORCE) +endif() + set(CSV_EXPLORER_VERSION "${PROJECT_VERSION}") set(CSV_EXPLORER_LICENSE "MIT") set(CSV_EXPLORER_AUTHOR "Yvan Janssens") diff --git a/CMakePresets.json b/CMakePresets.json index 48a6191..c2fe76f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,7 +5,7 @@ "name": "windows-mingw64", "displayName": "Windows x64 MinGW (cross-compile)", "description": "Configure CSV Explorer for 64-bit Windows using a MinGW cross toolchain with static wxWidgets.", - "generator": "Unix Makefiles", + "generator": "Ninja", "binaryDir": "${sourceDir}/build/windows-mingw64", "toolchainFile": "${sourceDir}/cmake/toolchains/mingw-x86_64.cmake", "cacheVariables": { From a0130a5ba6607f17c9d5f9aa00cdbe4248b3c739 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 22 Mar 2026 20:12:01 +0100 Subject: [PATCH 4/5] Package macOS app as DMG --- .github/workflows/ci.yml | 7 +++++-- CMakeLists.txt | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5476b88..eaff10e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,14 +97,17 @@ jobs: - name: Build run: cmake --build build/macos + - name: Package + run: cmake --build build/macos --target package + - name: Show ccache stats run: ccache --show-stats - name: Upload macOS artifact uses: actions/upload-artifact@v4 with: - name: wxcsv-macos - path: build/macos/wxCsv.app + name: csv-explorer-macos-dmg + path: build/macos/*.dmg windows-mingw: name: Windows (MinGW cross, Ubuntu container) diff --git a/CMakeLists.txt b/CMakeLists.txt index f87d6cf..002a5f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR APPLE) endif() set(wxBUILD_SHARED OFF CACHE BOOL "" FORCE) + set(wxBUILD_INSTALL OFF 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) @@ -206,6 +207,18 @@ if(APPLE) ${CSV_EXPLORER_BUNDLE_ICON} ${CSV_EXPLORER_WINDOW_ICON} ) + + install(TARGETS csv_explorer BUNDLE DESTINATION .) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION .) + + set(CPACK_GENERATOR DragNDrop) + set(CPACK_PACKAGE_NAME "csv-explorer") + set(CPACK_PACKAGE_VENDOR "${CSV_EXPLORER_COMPANY}") + set(CPACK_PACKAGE_VERSION "${CSV_EXPLORER_VERSION}") + set(CPACK_PACKAGE_FILE_NAME "csv-explorer-${CSV_EXPLORER_VERSION}-macos-universal") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CSV Explorer") + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + include(CPack) endif() if(WIN32) From 7883653f5b6a475954be37e8a0577eec5ee1a9ac Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 22 Mar 2026 20:13:19 +0100 Subject: [PATCH 5/5] Publish macOS package with tagged releases --- .github/workflows/ci.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaff10e..7490365 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,10 +154,12 @@ jobs: name: csv-explorer-windows path: build/windows-mingw64/csv-explorer.exe - release-windows: - name: Publish Windows binary on tag + release-binaries: + name: Publish release binaries on tag if: startsWith(github.ref, 'refs/tags/') - needs: windows-mingw + needs: + - windows-mingw + - macos runs-on: ubuntu-latest permissions: contents: write @@ -168,7 +170,15 @@ jobs: name: csv-explorer-windows path: dist + - name: Download macOS artifact + uses: actions/download-artifact@v4 + with: + name: csv-explorer-macos-dmg + path: dist + - name: Attach to GitHub Release uses: softprops/action-gh-release@v2 with: - files: dist/csv-explorer.exe + files: | + dist/csv-explorer.exe + dist/*.dmg