Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
sudo apt-get install -y \
ccache \
cmake \
make \
ninja-build \
g++ \
"$WX_PKG"

Expand All @@ -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
Expand Down Expand Up @@ -83,28 +83,31 @@ 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: |
ccache --set-config=max_size=2G
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

- 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)
Expand All @@ -126,7 +129,7 @@ jobs:
sudo apt-get install -y \
ccache \
cmake \
make \
ninja-build \
g++-mingw-w64-x86-64 \
xz-utils \
mingw-w64
Expand All @@ -151,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
Expand All @@ -165,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
67 changes: 52 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -75,6 +79,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}" "$<TARGET_FILE:csv_explorer>"
COMMENT "Stripping csv-explorer binary"
)
endif()

target_include_directories(csv_explorer
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -95,10 +107,35 @@ 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_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)
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)
Expand All @@ -119,13 +156,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)
Expand All @@ -142,13 +173,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.
Expand Down Expand Up @@ -182,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)
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading