PR-Q3a.0: install daedalus-decoder.pc for sibling consumers #17

Merged
marfrit merged 1 commits from noether/decoder-pkgconfig into main 2026-05-26 11:56:04 +00:00
+39 -3
View File
@@ -237,12 +237,48 @@ endif()
# ---- Install ------------------------------------------------------
#
# Library + public header. Stage 2/3 will add a pkg-config file and
# CMake config exports once the API stabilises; pre-0.1 the scaffold
# install just gives the static archive a home.
# Installs:
# - libdaedalus_decoder.a → ${CMAKE_INSTALL_LIBDIR}
# - include/daedalus_decoder.h → ${CMAKE_INSTALL_INCLUDEDIR}
# - daedalus-decoder.pc → ${CMAKE_INSTALL_LIBDIR}/pkgconfig
#
# The .pc lets sibling consumers (daedalus-v4l2 daemon, the
# daedalus_decode_h264 CLI when built externally) discover the static
# archive + headers via pkg-config. daedalus-fourier is declared as a
# public `Requires:` because the consumer (which static-links
# libdaedalus_decoder.a) also needs daedalus-fourier in its own link
# line to resolve the daedalus_ctx_* / daedalus_recipe_* symbols this
# archive references.
#
# Relocatable-prefix scheme mirrors daedalus-fourier's .pc generation:
# `prefix` is derived from ${pcfiledir} so `cmake --install --prefix /foo`
# produces a .pc that resolves prefix=/foo at lookup time, regardless of
# what CMAKE_INSTALL_PREFIX was at configure time.
include(GNUInstallDirs)
install(TARGETS daedalus_decoder
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES include/daedalus_decoder.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
file(RELATIVE_PATH PKGCONFIG_PCDIR_TO_PREFIX
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig"
"${CMAKE_INSTALL_PREFIX}")
set(PKGCONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/daedalus-decoder.pc)
file(WRITE ${PKGCONFIG_OUT}
"prefix=\${pcfiledir}/${PKGCONFIG_PCDIR_TO_PREFIX}
exec_prefix=\${prefix}
libdir=\${prefix}/${CMAKE_INSTALL_LIBDIR}
includedir=\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}
Name: daedalus-decoder
Description: Frame-major H.264 decoder on V3D7 via daedalus-fourier primitives
Version: ${PROJECT_VERSION}
Libs: -L\${libdir} -ldaedalus_decoder
Requires: daedalus-fourier
Cflags: -I\${includedir}
")
install(FILES ${PKGCONFIG_OUT}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)