Skip to content
Open
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
103 changes: 103 additions & 0 deletions .github/workflows/of.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,109 @@ jobs:

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# CMake build (libs/openFrameworksCompiled/project/CMake): core + examples, with
# each example's CMakeLists.txt generated by projectGenerator -t cmake
build-cmake:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- { name: linux64, runner: ubuntu-24.04 }
- { name: macos, runner: macos-15 }
- { name: vs-x64, runner: windows-2022 }
- { name: linuxaarch64, runner: ubuntu-24.04-arm }
- { name: emscripten, runner: ubuntu-24.04 }
name: build-cmake (${{ matrix.name }})
steps:
- uses: actions/checkout@v6
- name: ccache
if: matrix.name != 'vs-x64' && matrix.name != 'emscripten'
uses: hendrikmuhs/ccache-action@v1.2.23
with:
key: cmake-${{ matrix.name }}

- name: Libs, dependencies and projectGenerator (linux64)
if: matrix.name == 'linux64'
run: |
./scripts/linux/download_libs.sh -t $RELEASE -a 64gcc6
./scripts/ci/linux64/install.sh
sudo apt-get install -y ninja-build
mkdir -p ~/pg && cd ~/pg
curl -fsSL -o pg.tar.bz2 https://github.com/openframeworks/projectGenerator/releases/download/nightly/projectGenerator-linux.tar.bz2
tar -xjf pg.tar.bz2 && rm pg.tar.bz2
echo "PG=$(find ~/pg -type f -name 'projectGenerator*' -perm -u+x | head -1)" >> $GITHUB_ENV
- name: Build (linux64)
if: matrix.name == 'linux64'
run: scripts/ci/cmake/build.sh --pg "$PG" --platform linux64 -- -G Ninja

# 64-bit Raspberry Pi OS / arm64 Linux
- name: Libs, dependencies and projectGenerator (linuxaarch64)
if: matrix.name == 'linuxaarch64'
run: |
./scripts/linux/download_libs.sh -t $RELEASE -a aarch64
./scripts/ci/linux64/install.sh
# ofxOpenCv links -lblas -llapack on linuxaarch64 (rpi-build gets them from multistrap)
sudo apt-get install -y ninja-build libblas-dev liblapack-dev
mkdir -p ~/pg && cd ~/pg
curl -fsSL -o pg.tar.bz2 https://github.com/openframeworks/projectGenerator/releases/download/nightly/projectGenerator-linux-arm64.tar.bz2
tar -xjf pg.tar.bz2 && rm pg.tar.bz2
echo "PG=$(find ~/pg -type f -name 'projectGenerator*' -perm -u+x | head -1)" >> $GITHUB_ENV
- name: Build (linuxaarch64)
if: matrix.name == 'linuxaarch64'
run: scripts/ci/cmake/build.sh --pg "$PG" --platform linuxaarch64 -- -G Ninja -DOF_PRECOMPILED_HEADER=ON

# same emsdk image as build-emscripten; emcmake sets the Emscripten toolchain
- name: Libs and emsdk (emscripten)
if: matrix.name == 'emscripten'
run: |
./scripts/emscripten/download_libs.sh -t $RELEASE
docker run -di --name emscripten -v $PWD:/src emscripten/emsdk:6.0.11 bash
- name: Build (emscripten)
if: matrix.name == 'emscripten'
run: >-
docker exec -i -e CMAKE_WRAPPER=emcmake
-e OF_CMAKE_EXAMPLES="templates/emptyExample:Release,Debug graphics/graphicsExample:Release gui/guiExample:Release"
emscripten bash -c "cd /src && scripts/ci/cmake/build.sh"

- name: Libs (macos)
if: matrix.name == 'macos'
run: |
./scripts/osx/download_libs.sh -t $RELEASE
brew install ninja || true
- name: Build (macos)
if: matrix.name == 'macos'
run: scripts/ci/cmake/build.sh -- -G Ninja
env:
DEVELOPER_DIR: "/Applications/Xcode.app/Contents/Developer"

# unit tests in tests/ through CTest (Debug, like the makefile CI)
- name: Tests (ctest)
if: matrix.name == 'linux64' || matrix.name == 'macos'
run: |
cmake -S libs/openFrameworksCompiled/project/CMake -B build/cmake-tests -G Ninja -DCMAKE_BUILD_TYPE=Debug -DOF_BUILD_TESTS=ON
cmake --build build/cmake-tests --parallel
if [ "$RUNNER_OS" = "Linux" ]; then RUN="xvfb-run -a"; fi
$RUN ctest --test-dir build/cmake-tests --output-on-failure --timeout 300
env:
DEVELOPER_DIR: "/Applications/Xcode.app/Contents/Developer"

- uses: msys2/setup-msys2@v2
if: matrix.name == 'vs-x64'
with:
update: true
install: >-
git
unzip
- name: Libs and projectGenerator (vs-x64)
if: matrix.name == 'vs-x64'
shell: msys2 {0}
run: ./scripts/ci/vs/install.sh -a x64
- name: Build (vs-x64)
if: matrix.name == 'vs-x64'
shell: bash
run: scripts/ci/cmake/build.sh --pg "$PWD/projectGenerator/projectGenerator.exe" --platform vs -- -G "Visual Studio 17 2022" -A x64 -DOF_PRECOMPILED_HEADER=ON

build-vs:
runs-on: ${{ matrix.runner }}
strategy:
Expand Down
2 changes: 2 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
# Linux
/*/*/Makefile
/*/*/config.make
# CMake (scripts/templates/cmake, generated by the Project Generator)
/*/*/CMakeLists.txt
# Leave Android files in until project generation works
!/android/*/Makefile
!/android/*/config.make
Expand Down
45 changes: 45 additions & 0 deletions libs/openFrameworksCompiled/project/CMake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# openFrameworks core library
#
# Builds libs/openFrameworksCompiled/lib/<platform>[/<arch>]/<core library>.
# Apps include openFrameworks.cmake and link it with of_add_app(); they build
# this project themselves if the library isn't there yet.
#
# cmake -S libs/openFrameworksCompiled/project/CMake -B build/core -DCMAKE_BUILD_TYPE=Release
# cmake --build build/core
#
# -DOF_BUILD_TESTS=ON adds the unit tests in tests/ and registers them with CTest:
# cmake --build build/core && ctest --test-dir build/core --output-on-failure
# -DOF_BUILD_EXAMPLES=ON adds every example (not built by default) and a
# build_all_examples target, in IDE folders, so one solution opens them all:
# cmake --build build/core --target build_all_examples

cmake_minimum_required(VERSION 3.22)
project(openFrameworks LANGUAGES C CXX)

include("${CMAKE_CURRENT_LIST_DIR}/openFrameworks.cmake")

option(OF_BUILD_TESTS "Build the unit tests in tests/ and register them with CTest" OFF)
option(OF_BUILD_EXAMPLES "Add examples/ and a build_all_examples target" OFF)

# IDE folders: openFrameworks, tests/<group>, examples/<group>
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

of_add_core_library()
if(TARGET openFrameworks)
set_target_properties(openFrameworks PROPERTIES FOLDER openFrameworks)
endif()

if(OF_BUILD_TESTS)
if(OF_PLATFORM MATCHES "^(emscripten|ios|tvos)$")
message(WARNING "openFrameworks: OF_BUILD_TESTS is for desktop platforms; skipping on ${OF_PLATFORM}")
else()
enable_testing()
include("${CMAKE_CURRENT_LIST_DIR}/OFProjects.cmake")
of_add_projects(tests "${OF_ROOT}/tests" TESTS)
endif()
endif()

if(OF_BUILD_EXAMPLES)
include("${CMAKE_CURRENT_LIST_DIR}/OFProjects.cmake")
of_add_projects(examples "${OF_ROOT}/examples" EXCLUDE_FROM_ALL)
endif()
Loading
Loading