From 357135f2f2dcd66a2ae1f9cfffc1f5d9b7ea5525 Mon Sep 17 00:00:00 2001 From: Jan Kubalek Date: Wed, 16 Jul 2025 15:42:09 +0200 Subject: [PATCH] Add yml for Examples build, fix windows issues --- .github/workflows/examples.yml | 95 ++++++++++++++++++++++++ .github/workflows/tests.yml | 2 +- example/library-interface/CMakeLists.txt | 4 +- example/library/CMakeLists.txt | 3 + 4 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/examples.yml diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 0000000..dafffda --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,95 @@ +name: Examples + +on: + push: + branches: + - master + pull_request: + branches: + - '*' + workflow_dispatch: + +env: + CMLIB_VERSION: 1.1.0 + +jobs: + examples-linux: + strategy: + matrix: + image: [ + "test_ubuntu:2404" + ] + example: [ + "example/executable", + "example/library", + "example/library-interface" + ] + + runs-on: ubuntu-latest + container: + image: ghcr.io/cmakelib/${{ matrix.image }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Run example - ${{ matrix.example }} + run: | + git config --global --add safe.directory "$(pwd)" + git remote set-url origin "${{ github.server_url }}/${{ github.repository }}" + git clone --branch "v${CMLIB_VERSION}" https://github.com/cmakelib/cmakelib.git + export CMLIB_DIR=$(pwd)/cmakelib + cd ${{ matrix.example }} + mkdir -p build + cd build + cmake .. + cmake --build . + + examples-windows: + strategy: + matrix: + example: [ + "example/executable", + "example/library", + "example/library-interface" + ] + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Run example - ${{ matrix.example }} + run: | + git config --global --add safe.directory "$(pwd)" + git remote set-url origin "${{ github.server_url }}/${{ github.repository }}" + git clone --branch "v$env:CMLIB_VERSION" https://github.com/cmakelib/cmakelib.git + $env:CMLIB_DIR = "$(pwd)/cmakelib" + cd ${{ matrix.example }} + mkdir build -ErrorAction SilentlyContinue + cd build + cmake .. + cmake --build . --config Debug + + examples-macos: + strategy: + matrix: + example: [ + "example/executable", + "example/library", + "example/library-interface" + ] + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Run example - ${{ matrix.example }} + run: | + git config --global --add safe.directory "$(pwd)" + git remote set-url origin "${{ github.server_url }}/${{ github.repository }}" + git clone --branch "v${CMLIB_VERSION}" https://github.com/cmakelib/cmakelib.git + export CMLIB_DIR=$(pwd)/cmakelib + cd ${{ matrix.example }} + mkdir -p build + cd build + cmake .. + cmake --build . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 33df4d5..135cff0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ on: workflow_dispatch: env: - CMLIB_VERSION: 1.0.0 + CMLIB_VERSION: 1.1.0 jobs: test_linux: diff --git a/example/library-interface/CMakeLists.txt b/example/library-interface/CMakeLists.txt index e4bf1f4..d911bde 100644 --- a/example/library-interface/CMakeLists.txt +++ b/example/library-interface/CMakeLists.txt @@ -13,7 +13,9 @@ SET(CMAKE_INSTALL_RPATH $ORIGIN/../lib/) # FIND_PACKAGE(CMLIB COMPONENTS CMDEF) - +IF(CMDEF_OS_WINDOWS) + SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +ENDIF() # # Set global compile options only for C++ language diff --git a/example/library/CMakeLists.txt b/example/library/CMakeLists.txt index 54b8f11..46fdf5d 100644 --- a/example/library/CMakeLists.txt +++ b/example/library/CMakeLists.txt @@ -12,6 +12,9 @@ PROJECT(${CMAKE_PROJECT_NAME}) # FIND_PACKAGE(CMLIB COMPONENTS CMDEF) +IF(CMDEF_OS_WINDOWS) + SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +ENDIF() # # Set global compile options only for C++ language