Skip to content

Commit

Permalink
Ci Runners for Windows & Mac (#45)
Browse files Browse the repository at this point in the history
* add windows build to ci

* windows ci

* windows ci

* windows ci

* windows ci

* download w/ bash

* curl

* curl

* windows ci

* MSBuild path

* paths

* use microsoft/setup-msbuild

* windows ci

* ci

* build

* add mac

* mac cd

* mac cd

* windows install w/ bash

* windows

* mac build

* windows build

* windows

* download windows binary

* typo

* mac

* windows

* windows

* windows

* windows

* extract

* windows

* windows

* windows

* windows

* windows

* print

* paths

* path

* paths

* download headers

* try props

* Update ci.yml

* update ci.yml

* fix typo

* Update ci.yml

* Update CMakeLists.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update CMakeLists.txt

* Update ci.yml

* Update CMakeLists.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update CMakeLists.txt

* Update ci.yml

* Update ci.yml

* mac runner

* add wx-config to path

* wx-config

* wx config

* clean ci.yml

* add doc for WXWIN

* fix versions of wx

* setup wxwidget build

* windows archive

* linux archive

* windows archive

* multi process

* syntax

* set env vars

* add prints

* fix windows path

* fix paths

* windows paths

* windows

* fix platform

* cleanup

* update versions

* fix name

* naming

* update versions

* update archive

* try macos13

* build wx in $HOME

* revert broken windows

* fix wx artifact path

* fix paths for artifacts

* use env for artifact

* reduce windows artifact size

* clean up

* update wx version

* use caching

* fix caching on windows

* check caching

* only artifact if not cached
  • Loading branch information
dguittet authored Oct 14, 2024
1 parent 964178d commit a14e2a1
Show file tree
Hide file tree
Showing 2 changed files with 204 additions and 22 deletions.
188 changes: 175 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ on:
push:
pull_request:

env:
WX_VERSION: '3.2.4'

jobs:
build-on-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.12
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.24.x'

- name: Test cmake version
run: cmake --version

- name: Install OS dependencies
run: |
sudo apt-get update
Expand All @@ -27,29 +32,186 @@ jobs:
libgtk2.0-dev \
mesa-common-dev \
unzip
- name: Get GCC version
run: gcc --version
- name: Get libc version
run: ldd --version
- name: Set relative paths
run: |
WXMSW3=$HOME/wx-$WX_VERSION
echo "WXMSW3=$WXMSW3" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Get cached build of wxWidgets
uses: actions/cache@v4
id: cachedwx
with:
path: ${{env.WXMSW3}}/
key: wxWidgets-${{ env.WX_VERSION }}-linux

- name: Install wxWidgets
if: steps.cachedwx.outputs.cache-hit != 'true'
run: |
sudo apt-get install -y libwxgtk*-dev
sudo ln -s $(which wx-config) /usr/local/bin/wx-config-3
wx-config-3 --cflags | grep I
curl -L https://github.com/wxWidgets/wxWidgets/releases/download/v$WX_VERSION/wxWidgets-$WX_VERSION.tar.bz2 -o wxWidgets-$WX_VERSION.tar.bz2
tar jxf wxWidgets-$WX_VERSION.tar.bz2
cd wxWidgets-$WX_VERSION
./configure --prefix=$HOME/wx-$WX_VERSION --enable-shared=no --enable-debug=no --with-gtk=2 --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --without-libjbig --without-liblzma --without-gtkprint --with-libnotify=no --with-libmspack=no --with-gnomevfs=no --with-opengl=yes --with-sdl=no --with-cxx=11
make -j4
make install
sudo ln -s $HOME/wx-$WX_VERSION/bin/wx-config /usr/local/bin/wx-config-3
wx-config-3 --cflags
echo $HOME/wx-$WX_VERSION/bin >> $GITHUB_PATH
- name: Checkout
uses: actions/checkout@v2
- name: Save wxWidgets build
if: steps.cachedwx.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: wxWidgets-${{ env.WX_VERSION }}-linux
path: |
${{ env.WXMSW3 }}
- name: Build LK
run: |
cmake -Bbuild_linux -DCMAKE_BUILD_TYPE=Debug
cmake --build build_linux -- -j
cmake --build build_linux -- -j4
- name: Save static lib & lksandbox
uses: actions/upload-artifact@v2
if: steps.cachedwx.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: LK-${{ env.RUNS_ON }}-x86_64
name: LK-linux
path: |
build_linux/lk_sandbox*
build_linux/lk*.a
build-on-windows:
runs-on: windows-latest
steps:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Set relative paths
shell: bash
run: |
WXMSW3=$GITHUB_WORKSPACE/wx-$WX_VERSION
echo "WXMSW3=$WXMSW3" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Get cached build of wxWidgets
uses: actions/cache@v4
id: cachedwx
with:
path: ${{env.WXMSW3}}/
key: wxWidgets-${{ env.WX_VERSION }}-windows

- name: Download wxWidgets
if: steps.cachedwx.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L https://github.com/wxWidgets/wxWidgets/releases/download/v$WX_VERSION/wxWidgets-$WX_VERSION.tar.bz2 -o wxWidgets-$WX_VERSION.tar.bz2
tar jxf wxWidgets-$WX_VERSION.tar.bz2
- name: Install wxWidgets
if: steps.cachedwx.outputs.cache-hit != 'true'
run: |
cd wxWidgets-$env:WX_VERSION
msbuild build/msw/wx_vc17.sln /t:Build /p:Configuration=Release /p:Platform=x64
- name: Make wxWidgets archive
if: steps.cachedwx.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir wx-$WX_VERSION
cp -r wxWidgets-$WX_VERSION/include wx-$WX_VERSION
cp -r wxWidgets-$WX_VERSION/lib wx-$WX_VERSION
- name: Save wxWidgets build
uses: actions/upload-artifact@v4
with:
name: wxWidgets-${{ env.WX_VERSION }}-windows
path: |
wx-${{env.WX_VERSION}}
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.24.x'

- name: Build LK
run: |
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES="Release" -DCMAKE_SYSTEM_VERSION=10 ..
MSBuild.exe .\lk.sln /t:Build /p:Configuration=Release
- name: Save static lib & lksandbox
if: steps.cachedwx.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: LK-windows
path: |
build/Release/lk_sandbox*
build/Release/lk*.a
build-on-mac:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14-large, macos-latest]
steps:
- name: Set relative paths
run: |
WXMSW3=$HOME/wx-$WX_VERSION
echo "WXMSW3=$WXMSW3" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Get cached build of wxWidgets
uses: actions/cache@v4
id: cachedwx
with:
path: ${{env.WXMSW3}}/
key: wxWidgets-${{ env.WX_VERSION }}-${{ matrix.os }}

- name: Install wxWidgets
if: steps.cachedwx.outputs.cache-hit != 'true'
run: |
curl -L https://github.com/wxWidgets/wxWidgets/releases/download/v$WX_VERSION/wxWidgets-$WX_VERSION.tar.bz2 -o wxWidgets-$WX_VERSION.tar.bz2
tar jxf wxWidgets-$WX_VERSION.tar.bz2
cd wxWidgets-$WX_VERSION
./configure --prefix=$HOME/wx-$WX_VERSION --enable-stl=yes --enable-shared=no --disable-debug_flag --with-cocoa --enable-universal_binary=x86_64,arm64 --enable-unicode --enable-webview --disable-mediactrl --with-cxx=11 --with-macosx-version-min=10.15 --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin
make -j3
make install
sudo ln -s $HOME/wx-$WX_VERSION/bin/wx-config /usr/local/bin/wx-config-3
wx-config-3 --cflags
echo ${HOME}/wx-$WX_VERSION/bin >> $GITHUB_PATH
- name: Save wxWidgets build
if: steps.cachedwx.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: wxWidgets-${{ env.WX_VERSION }}-${{ matrix.os }}
path: |
${{ env.WXMSW3 }}
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.24.x'

- name: Build LK
run: |
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j3
- name: Save static lib & lksandbox
if: steps.cachedwx.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: LK-${{ matrix.os }}
path: |
build/lk_sandbox*
build/lk*.a
38 changes: 29 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,23 @@ endif (MSVC)
if (UNIX)
if(EXISTS /usr/local/bin/wx-config-3)
set(wxWidgets_CONFIG_EXECUTABLE /usr/local/bin/wx-config-3)
find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base)
else ()
else()
set(wxWidgets_CONFIG_EXECUTABLE $ENV{WXMSW3}/bin/wx-config)
find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base)
endif ()
find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base)
include(${wxWidgets_USE_FILE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
else ()
set(wxWidgets_ROOT_DIR $ENV{WXMSW3})
find_package(wxWidgets REQUIRED qa webview aui richtext html propgrid adv net stc core base scintilla)
# WXWIN is the environment variable used within the wxwidgets.props from the binary distribution of wxWidgets
if(NOT EXISTS "$ENV{WXWIN}/wxwidgets.props")
message("env $ENV{WXMSW3}")
set(wxWidgets_ROOT_DIR $ENV{WXMSW3})
find_package(wxWidgets REQUIRED qa webview aui richtext html propgrid adv net stc core base scintilla)
include(${wxWidgets_USE_FILE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
endif()
endif ()

include(${wxWidgets_USE_FILE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")


#####################################################################################################################
#
Expand Down Expand Up @@ -151,5 +155,21 @@ if (NOT SAM_SKIP_TOOLS)
target_link_libraries(lk_sandbox -ldl)
endif ()

target_link_libraries(lk_sandbox lk ${wxWidgets_LIBRARIES})
if (MSVC AND EXISTS "$ENV{WXWIN}/wxwidgets.props")
set_property(
TARGET lk_sandbox
PROPERTY VS_USER_PROPS "$ENV{WXWIN}/wxwidgets.props"
)
else()
target_link_libraries(lk_sandbox ${wxWidgets_LIBRARIES})
endif()
endif()

if (MSVC AND EXISTS "$ENV{WXWIN}/wxwidgets.props")
set_property(
TARGET lk
PROPERTY VS_USER_PROPS "$ENV{WXWIN}/wxwidgets.props"
)
else()
target_link_libraries(lk ${wxWidgets_LIBRARIES})
endif()

0 comments on commit a14e2a1

Please sign in to comment.