Skip to content

Commit 07df19b

Browse files
jcelerierclaude
andauthored
cmake: converge to generic find_package(Avendish) + avnd_addon_* setup (#2)
* ci: use ossia/actions/avendish-template composite action * ci: point avendish-template action at @master * cmake: migrate to find_package(Avendish) + avnd_addon_* (builds as score addon or standalone) * cmake: bump avendish pin * ci: replace legacy CI with avnd-addon.yml + portability workflows builds.yaml calls avnd-addon.yml@master with the texture/video back-ends this template emits (max, gstreamer, touchdesigner, godot, python). portability.yml calls avnd-portability.yml@master (iOS off). Drop legacy build_cmake.yml; re-pin avendish to main (7f7dac9). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * cmake: add explicit dump backend for the portability CI The BACKENDS form (unlike the CATEGORY presets) doesn't emit the <C_NAME>_dump target, so the portability workflow had nothing plain-C++ to build and failed (no dump target + halp/ headers off the include path). List `dump` explicitly — better than relying on an implicit avendish-side change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * cmake: bump avendish pin to main (post enum-control fix #107) Moves off the temporary feature-branch SHA to avendish main, which now includes the wasm enum-control fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5aa89fb commit 07df19b

6 files changed

Lines changed: 88 additions & 90 deletions

File tree

.github/workflows/build_cmake.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/builds.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main, master]
7+
tags: ['v*']
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
ci:
15+
uses: ossia/actions/.github/workflows/avnd-addon.yml@master
16+
secrets: inherit
17+
with:
18+
# Texture / video back-ends:
19+
# BACKENDS ossia max gstreamer:TEXTURE touchdesigner:TOP godot:TEXTURE python
20+
max: true
21+
gstreamer: true
22+
touchdesigner: true
23+
godot: true
24+
python: true

.github/workflows/portability.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Portability
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main, master]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-portability-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
smoke:
14+
uses: ossia/actions/.github/workflows/avnd-portability.yml@master
15+
secrets: inherit
16+
with:
17+
# iOS off: Xcode multi-config plumbing fails and iOS isn't a meaningful
18+
# target. The other 20 lanes cover the portability surface.
19+
ios: false

CMakeLists.txt

Lines changed: 44 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,68 @@
1-
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
22

33
project(MyVideo CXX)
44

5-
include(dependencies.cmake)
5+
# Use the Avendish the host already provides (e.g. ossia score); otherwise fetch it.
6+
# The same CMakeLists builds these as ossia/score add-on objects or as standalone objects.
7+
find_package(Avendish QUIET)
8+
if(NOT Avendish_FOUND)
9+
include(FetchContent)
10+
FetchContent_Declare(
11+
Avendish
12+
GIT_REPOSITORY "https://github.com/celtera/avendish"
13+
GIT_TAG 6dacc12)
14+
FetchContent_Populate(Avendish)
15+
list(APPEND CMAKE_PREFIX_PATH "${avendish_SOURCE_DIR}")
16+
find_package(Avendish REQUIRED)
17+
endif()
18+
19+
avnd_addon_init(NAME MyVideo)
620

721
# This template ships three canonical video objects, one per role:
8-
#
922
# * MyVideoGenerator (src/Generator.hpp) - a source: texture output, no input
1023
# * MyVideoFilter (src/Filter.hpp) - a filter: texture input + output
11-
# * MyVideoSink (src/Sink.hpp) - a sink: texture input, no output
12-
#
13-
# avnd_make_texture instantiates, for each object, the video / texture back-ends:
14-
# - ossia (for use inside ossia score)
15-
# - Max/MSP (a Jitter matrix / texture object)
16-
# - GStreamer (a video/x-raw element: source / transform / sink)
17-
# - TouchDesigner TOP (Texture Operator)
18-
# - Godot GDExtension (a Node exposing an ImageTexture)
24+
# * MyVideoSink (src/Sink.hpp) - a sink: texture input, no output
1925
#
20-
# avnd_make_python additionally emits a Python extension module (py<c_name>) per
21-
# object, importable from Python (requires pybind11 + the Python dev headers).
22-
#
23-
# The relevant SDK paths must be passed to CMake for the optional back-ends to be
24-
# built (see the README). Back-ends whose SDK is not found are silently skipped.
25-
function(add_video_object target main_class c_name source impl)
26-
add_library(${target} STATIC "${impl}" "${source}")
27-
28-
avnd_make_texture(
29-
TARGET ${target}
30-
MAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${source}"
31-
MAIN_CLASS ${main_class}
26+
# BACKENDS lists the texture back-ends (ossia, Max/MSP Jitter, GStreamer video, TD TOP,
27+
# Godot) plus a Python extension module, and `dump` — the plain-C++ introspection
28+
# target the portability CI builds (the CATEGORY presets include it implicitly; the
29+
# explicit BACKENDS form does not, so we list it). In a score build the back-end list
30+
# is ignored and only the ossia process is produced. Back-ends whose SDK is absent
31+
# are skipped.
32+
function(add_video_object main_class c_name source impl)
33+
avnd_addon_object(
34+
BASE MyVideo
3235
C_NAME ${c_name}
33-
)
34-
35-
avnd_make_python(
36-
TARGET ${target}
36+
CLASS ${main_class}
37+
BACKENDS dump ossia max gstreamer:TEXTURE touchdesigner:TOP godot:TEXTURE python
3738
MAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${source}"
38-
MAIN_CLASS ${main_class}
39-
C_NAME ${c_name}
40-
)
39+
SOURCES "${impl}" "${source}")
4140

42-
# Workaround: avnd_make_python builds the module as a plain shared library, so it
43-
# inherits the platform-default name (lib-prefixed .dylib on macOS, .dll on Windows).
44-
# CPython only imports an extension module from a file named "<module>.so" (Unix) or
45-
# "<module>.pyd" (Windows) with no "lib" prefix, so force that here — otherwise the
46-
# module is unimportable on macOS/Windows (Linux's default .so happens to work).
47-
if(TARGET ${target}_python)
48-
set_target_properties(${target}_python PROPERTIES PREFIX "")
41+
# avnd_make_python builds the module as a plain shared library, so it inherits the
42+
# platform-default name (lib-prefixed .dylib on macOS, .dll on Windows). CPython only
43+
# imports an extension module named "<module>.so" (Unix) / "<module>.pyd" (Windows)
44+
# with no "lib" prefix, so force that here (no-op in a score build: no _python target).
45+
if(TARGET ${c_name}_python)
46+
set_target_properties(${c_name}_python PROPERTIES PREFIX "")
4947
if(WIN32)
50-
set_target_properties(${target}_python PROPERTIES SUFFIX ".pyd")
48+
set_target_properties(${c_name}_python PROPERTIES SUFFIX ".pyd")
5149
else()
52-
set_target_properties(${target}_python PROPERTIES SUFFIX ".so")
50+
set_target_properties(${c_name}_python PROPERTIES SUFFIX ".so")
5351
endif()
5452
endif()
55-
56-
# Workaround: when godot-cpp is pulled in via FetchContent, its only targets are
57-
# `godot-cpp` (+ alias `godot::cpp`) — there is no `godot-cpp::godot-cpp`. Avendish's
58-
# avnd_make_godot doesn't always resolve the target, so the generated headers under
59-
# <godot-cpp-build>/gen/include never make it onto the GDExtension's include path and
60-
# compilation fails with "godot_cpp/classes/node.hpp not found". Re-linking the target
61-
# here (at a scope where it is visible) propagates godot-cpp's PUBLIC include dirs.
62-
if(TARGET ${target}_TEXTURE_godot AND TARGET godot-cpp)
63-
target_link_libraries(${target}_TEXTURE_godot PRIVATE godot-cpp)
64-
endif()
6553
endfunction()
6654

67-
add_video_object(MyVideoGenerator MyVideoGenerator my_video_generator src/Generator.hpp src/Generator.cpp)
68-
add_video_object(MyVideoFilter MyVideoFilter my_video_filter src/Filter.hpp src/Filter.cpp)
69-
add_video_object(MyVideoSink MyVideoSink my_video_sink src/Sink.hpp src/Sink.cpp)
55+
add_video_object(MyVideoGenerator my_video_generator src/Generator.hpp src/Generator.cpp)
56+
add_video_object(MyVideoFilter my_video_filter src/Filter.hpp src/Filter.cpp)
57+
add_video_object(MyVideoSink my_video_sink src/Sink.hpp src/Sink.cpp)
58+
59+
avnd_addon_finalize(NAME MyVideo UUID 7ecd8671-33ca-4362-a514-1076c579c1c2 VERSION 1.0.0)
7060

7161
# Unit tests exercising the Python back-end (tests/test_python_bindings.py). Registered
7262
# only when the Python modules were actually built (pybind11 + Python dev headers found).
7363
# Run with: ctest --test-dir <build> --output-on-failure
74-
#
75-
# Re-resolve the interpreter in this scope (Avendish found it GLOBAL, but the
76-
# Python_EXECUTABLE variable lives in the package's scope, not ours); this reuses the
77-
# cache and is the same interpreter the modules were compiled against.
7864
find_package(Python COMPONENTS Interpreter QUIET)
79-
if(TARGET MyVideoGenerator_python AND Python_EXECUTABLE)
65+
if(TARGET my_video_generator_python AND Python_EXECUTABLE)
8066
enable_testing()
8167

8268
add_test(
@@ -85,9 +71,7 @@ if(TARGET MyVideoGenerator_python AND Python_EXECUTABLE)
8571
-s "${CMAKE_CURRENT_SOURCE_DIR}/tests" -p "test_*.py" -v
8672
)
8773

88-
# The compiled extension modules only import under the interpreter that built them;
89-
# point the test at the build's python/ output dir and run it with that same Python.
9074
set_tests_properties(python_bindings PROPERTIES
91-
ENVIRONMENT "AVND_PYTHON_MODULE_DIR=$<TARGET_FILE_DIR:MyVideoGenerator_python>"
75+
ENVIRONMENT "AVND_PYTHON_MODULE_DIR=$<TARGET_FILE_DIR:my_video_generator_python>"
9276
)
9377
endif()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ what makes it a sink is the absence of a *texture* output.
2727

2828
## What gets built
2929

30-
The `avnd_make_texture(...)` calls in `CMakeLists.txt` instantiate the texture back-ends.
30+
The `avnd_addon_object(... BACKENDS ...)` calls in `CMakeLists.txt` instantiate the texture back-ends (and a Python module). The same file also builds as an ossia/score add-on via `find_package(Avendish)`.
3131
For each of the three objects you get:
3232

3333
| Back-end | Object kind | SDK required |

dependencies.cmake

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)