Files
oak-editor/worker/CMakeLists.txt
T
Mike-Solar 4fc8b80d7e core: turn olivecore into liboakcore.so with a pure C ABI
liboakcore is now a shared library that exposes only a C ABI:
- every value class (Rational, TimeRange, Color, Bezier, AudioParams,
  SampleBuffer) and the free-function groups (StringUtils, fraction
  utils, Timecode) is wrapped in an opaque-handle C API under
  core/include/olive/core/oakcore/ (init/copy/free + self-first
  functions), implemented in core/src/capi/
- consumers keep the original C++ API unchanged through same-name
  wrapper classes that hold the handle and forward across the C
  boundary; original implementations moved to core/src/oliveimpl
  (namespace olive::core::internal) and are hidden from export
- TimeRangeList/TimeRangeListFrameIterator are reimplemented inline
  over the wrapper (iterators/containers don't cross C ABI)
- generic Value container stays internal (unused by consumers) and is
  no longer part of the public umbrella header
- hidden visibility + OAKCORE_BUILD export macro; nm shows zero
  olive::* symbols exported
- install into the platform's standard libdir (GNUInstallDirs);
  Windows DLLs next to the executables, macOS into the app bundle
- TimelineWorkArea::in/out/length now return by value: the wrapped
  TimeRange getters return values, and forwarding them through const
  references dangled (found via RenderWorkerFootageTest crash)
- tests: 9 new pure C ABI test executables (oakcore_*_test) covering
  every public C function; 4 stale legacy core tests removed (they
  targeted a long-renamed API and were never built due to a malformed
  option() that also kept OLIVECORE_BUILD_TESTS off)
- CI/CD: oakcore.dll staged for NSIS, liboakcore.so added to the
  AppImage validation list, build-tree DLL copies on Windows
2026-07-19 23:49:40 +08:00

85 lines
3.5 KiB
CMake

# Oak - Non-Linear Video Editor
# Copyright (C) 2026 Oak Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Render worker process (oak-render-worker).
#
# The worker is a headless render process spawned by the editor through
# RenderWorkerPool. It reuses the libolive-editor object library so it
# shares the exact same render/node/codec code as the editor. The link set
# is currently the full OLIVE_LIBRARIES for simplicity; trimming UI-only
# dependencies is a later-phase cleanup (render-process-isolation plan).
add_executable(olive-render-worker
workermain.cpp
$<TARGET_OBJECTS:libolive-editor>
$<TARGET_OBJECTS:olive-version-obj>
)
set_target_properties(olive-render-worker PROPERTIES OUTPUT_NAME "oak-render-worker")
if (APPLE)
target_sources(olive-render-worker PRIVATE workermain_mac.mm)
target_link_libraries(olive-render-worker PRIVATE "-framework Cocoa")
endif ()
# CMAKE_INCLUDE_CURRENT_DIR only covers the app/ scope, so add the app
# include roots explicitly now that the worker lives outside it
target_include_directories(olive-render-worker PRIVATE
${CMAKE_SOURCE_DIR}/app
${CMAKE_BINARY_DIR}/app
${CMAKE_SOURCE_DIR}/app/pluginSupport
${OLIVE_INCLUDE_DIRS})
target_link_libraries(olive-render-worker PUBLIC OfxHost)
target_link_libraries(olive-render-worker PRIVATE ${OLIVE_LIBRARIES})
target_compile_options(olive-render-worker PRIVATE ${OLIVE_COMPILE_OPTIONS})
target_compile_definitions(olive-render-worker PRIVATE ${OLIVE_DEFINITIONS})
if (OAK_ENABLE_DYNAMIC_RENDER_BACKEND)
target_compile_definitions(olive-render-worker PRIVATE OAK_ENABLE_DYNAMIC_RENDER_BACKEND)
add_dependencies(olive-render-worker oakgl)
if (TARGET oakvulkan)
add_dependencies(olive-render-worker oakvulkan)
endif ()
endif ()
# The ffmpeg_bridge shared library ships next to the binaries: inside the
# macOS app bundle (Contents/MacOS, resolved via @loader_path), and in the
# standard lib directory on other platforms.
if (APPLE)
set_target_properties(olive-render-worker PROPERTIES
BUILD_RPATH "@loader_path"
INSTALL_RPATH "@loader_path")
elseif (UNIX)
set_target_properties(olive-render-worker PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib")
endif ()
# The editor always needs the worker next to it (macOS bundle POST_BUILD
# copies, Linux install() into the same bin directory)
add_dependencies(olive-editor olive-render-worker)
if (WIN32)
# Windows has no RPATH: shared libraries must sit next to the executable
add_custom_command(TARGET olive-render-worker POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:ffmpeg_bridge> $<TARGET_FILE_DIR:olive-render-worker>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:olivecore> $<TARGET_FILE_DIR:olive-render-worker>
)
endif ()
# Install the render worker alongside the editor on Linux.
if (UNIX AND NOT APPLE)
install(TARGETS olive-render-worker RUNTIME DESTINATION bin)
endif ()