From 0bcceb78e0853f609a130f07fb9c61132e899b23 Mon Sep 17 00:00:00 2001 From: Kilidsch <62540829+Kilidsch@users.noreply.github.com> Date: Thu, 20 Mar 2025 15:17:26 +0100 Subject: [PATCH 1/3] Create cmake-multi-platform.yml --- .github/workflows/cmake-multi-platform.yml | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/cmake-multi-platform.yml diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml new file mode 100644 index 0000000..928972d --- /dev/null +++ b/.github/workflows/cmake-multi-platform.yml @@ -0,0 +1,89 @@ +# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml +name: CMake on multiple platforms + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + # Set up a matrix to run the following 3 configurations: + # 1. + # 2. + # 3. + # + # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [Release] + c_compiler: [gcc, clang, cl] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + - os: windows-latest + c_compiler: gcc + - os: windows-latest + c_compiler: clang + - os: ubuntu-latest + c_compiler: cl + + steps: + - uses: actions/checkout@v4 + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Setup vcpkg + uses: lukka/run-vcpkg@v11 + id: runvcpkg + with: + # This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch. + vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' + # The vcpkg.json file, which will be part of cache key computation. + vcpkgJsonGlob: '${{ github.workspace }}/vcpkg.json' + runVcpkgInstall: true + + - name: Prints output of run-vcpkg's action + run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}'" + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake + -S ${{ github.workspace }} + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + +# - name: Test +# working-directory: ${{ steps.strings.outputs.build-output-dir }} +# # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). +# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail +# run: ctest --build-config ${{ matrix.build_type }} From 427c9abf1477ac6866dd8625a008f925316664c8 Mon Sep 17 00:00:00 2001 From: Deniz Kilic Date: Thu, 20 Mar 2025 15:28:30 +0100 Subject: [PATCH 2/3] Remove unnecessary OpenGL dependency --- src/fltk_main.cpp | 3 +++ vcpkg.json | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fltk_main.cpp b/src/fltk_main.cpp index 47a66fb..f5f39bf 100644 --- a/src/fltk_main.cpp +++ b/src/fltk_main.cpp @@ -1,8 +1,11 @@ #include #include +#include #include #include "aruco.h" +#include "fltk_parameters.h" +#include "ratetimer.h" #include "sceneview.h" #include "source.h" #include diff --git a/vcpkg.json b/vcpkg.json index 8765c6a..d1a738e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -13,10 +13,7 @@ }, { "name": "fltk", - "default-features": false, - "features": [ - "opengl" - ] + "default-features": false }, "argparse" ], From 27774cad5c93c7c9d2edac8cc40504e7c9cca4db Mon Sep 17 00:00:00 2001 From: Deniz Kilic Date: Thu, 20 Mar 2025 15:32:51 +0100 Subject: [PATCH 3/3] Install system dependencies and compile static --- .github/workflows/cmake-multi-platform.yml | 36 +++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 928972d..ab32fc2 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -1,5 +1,3 @@ -# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. -# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml name: CMake on multiple platforms on: @@ -13,15 +11,12 @@ jobs: runs-on: ${{ matrix.os }} strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. - fail-fast: false + fail-fast: true # Set up a matrix to run the following 3 configurations: # 1. # 2. # 3. - # - # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. matrix: os: [ubuntu-latest, windows-latest] build_type: [Release] @@ -54,32 +49,45 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + - name: Install system dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt install libx11-dev nasm + + - name: Set windows triplet to static + if: matrix.os == 'windows-latest' + run: | + Add-Content -Path ${env:GITHUB_ENV} -Value "triplet=x64-windows-static" + + - name: Set linux triplet to static + if: matrix.os == 'ubuntu-latest' + shell: bash + run: | + echo "triplet=x64-linux" >> "$GITHUB_ENV" + - name: Setup vcpkg uses: lukka/run-vcpkg@v11 id: runvcpkg with: # This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch. - vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' - # The vcpkg.json file, which will be part of cache key computation. - vcpkgJsonGlob: '${{ github.workspace }}/vcpkg.json' - runVcpkgInstall: true + vcpkgDirectory: '${{ github.workspace }}/b/vcpkg' + vcpkgJsonGlob: 'vcpkg.json' - name: Prints output of run-vcpkg's action run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}'" - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake + -DCMAKE_TOOLCHAIN_FILE=${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}/scripts/buildsystems/vcpkg.cmake + -DVCPKG_TARGET_TRIPLET=${{ env.triplet }} -S ${{ github.workspace }} - name: Build - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} # - name: Test