build: explicitly inject OF include paths to fix cross-compile find() failures

This commit is contained in:
Timothy Hofland
2026-03-15 21:47:30 +01:00
parent ff3fa766ae
commit 538043b7f2

View File

@ -205,6 +205,28 @@ unset PKG_CONFIG_LIBDIR
ARM64_PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
# OF's config.shared.mk uses $(shell find ...) to discover OF source subdirectory
# include paths and thirdparty lib headers. This can return empty in Docker
# cross-compile environments, causing "ofConstants.h: No such file or directory".
# Work around it by computing the include paths here and injecting them via
# PLATFORM_CFLAGS (which appears in the project compile command regardless).
OF_EXTRA_INCLUDES="-I$OF_DIR/libs/openFrameworks"
# OF source subdirectories (app, utils, math, gl, graphics, events, etc.)
for d in "$OF_DIR/libs/openFrameworks"/*/; do
[ -d "$d" ] && OF_EXTRA_INCLUDES="$OF_EXTRA_INCLUDES -I${d%/}"
done
# Thirdparty header-only libs bundled with OF (glm, json, kiss, tess2, utf8, ...)
for lib in "$OF_DIR/libs"/*/; do
libname=$(basename "$lib")
[ "$libname" = "openFrameworks" ] && continue
[ "$libname" = "openFrameworksCompiled" ] && continue
incdir="${lib}include"
[ -d "$incdir" ] || continue
while IFS= read -r subdir; do
OF_EXTRA_INCLUDES="$OF_EXTRA_INCLUDES -I$subdir"
done < <(find "$incdir" -type d)
done
make clean 2>/dev/null || true
make -j1 \
PKG_CONFIG="$PKGCFG_WRAPPER" \
@ -216,7 +238,7 @@ make -j1 \
CXX=aarch64-linux-gnu-g++ \
AR=aarch64-linux-gnu-ar \
LD=aarch64-linux-gnu-ld \
PLATFORM_CFLAGS="$GLOBAL_FLAGS -I$ADDON_DIR/src" \
PLATFORM_CFLAGS="$GLOBAL_FLAGS $OF_EXTRA_INCLUDES -I$ADDON_DIR/src" \
USER_CFLAGS="$GLOBAL_FLAGS" \
USER_CPPFLAGS="-std=c++11" \
OF_PROJECT_OPTIMIZATION_FLAGS="-O0"