Enable experimental OpenGL backend library build
This commit is contained in:
+31
-1
@@ -89,7 +89,34 @@ set_target_properties(libolive-editor PROPERTIES PREFIX "")
|
||||
|
||||
option(OAK_ENABLE_DYNAMIC_RENDER_BACKEND "Build and use the experimental dynamic render backend adapter" OFF)
|
||||
if (OAK_ENABLE_DYNAMIC_RENDER_BACKEND)
|
||||
message(FATAL_ERROR "OAK_ENABLE_DYNAMIC_RENDER_BACKEND is scaffolded but not linkable yet. Split the OpenGL backend dependency boundary before enabling it.")
|
||||
set_target_properties(libolive-editor PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
target_compile_definitions(libolive-editor PRIVATE OAK_ENABLE_DYNAMIC_RENDER_BACKEND)
|
||||
|
||||
foreach(target olivecore kddockwidgets)
|
||||
if (TARGET ${target})
|
||||
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_library(oakgl SHARED
|
||||
render/opengl/openglbackend_c.cpp
|
||||
$<TARGET_OBJECTS:libolive-editor>
|
||||
)
|
||||
target_include_directories(oakgl PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/app
|
||||
${CMAKE_SOURCE_DIR}/third_party/openfx/include
|
||||
${CMAKE_SOURCE_DIR}/third_party/openfx/HostSupport/include
|
||||
${OLIVE_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(oakgl PRIVATE ${OLIVE_LIBRARIES} OfxHost)
|
||||
target_compile_definitions(oakgl PRIVATE ${OLIVE_DEFINITIONS})
|
||||
target_compile_options(oakgl PRIVATE ${OLIVE_COMPILE_OPTIONS})
|
||||
set_target_properties(oakgl PROPERTIES
|
||||
OUTPUT_NAME oakgl
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(oakgl-cabi-check OBJECT
|
||||
@@ -114,6 +141,9 @@ add_executable(olive-editor
|
||||
target_include_directories(olive-editor PUBLIC pluginSupport)
|
||||
target_link_libraries(olive-editor PUBLIC OfxHost)
|
||||
add_dependencies(olive-editor oakgl-cabi-check)
|
||||
if (OAK_ENABLE_DYNAMIC_RENDER_BACKEND)
|
||||
add_dependencies(olive-editor oakgl)
|
||||
endif()
|
||||
|
||||
# Add render worker process (olive-render-worker).
|
||||
# Reuses the libolive-editor object library so the worker shares the exact same render/node/codec
|
||||
|
||||
@@ -55,12 +55,14 @@
|
||||
- 非 PIC 静态依赖会阻塞共享库链接,例如 `KDDockWidgets`。
|
||||
- 主程序和后端库会复制全局状态,增加配置、cache、单例和 Qt meta-object 的一致性风险。
|
||||
|
||||
因此动态后端接管默认 renderer 前,需要把 OpenGL 后端库的链接边界收敛到最小集合:
|
||||
当前实验构建已经可以通过 `OAK_ENABLE_DYNAMIC_RENDER_BACKEND=ON` 生成 `liboakgl.so`,做法是把相关 object/static 依赖切到 PIC 后链接进 OpenGL 后端库。这满足“动态库一侧 C++ 实现 + C ABI 导出”的第一步,但它仍不是最终边界:后端库暂时会带入较多 editor 代码和全局状态。
|
||||
|
||||
因此动态后端成为默认路径前,仍需要把 OpenGL 后端库的链接边界收敛到最小集合:
|
||||
|
||||
- 后端库只拥有 OpenGL/Vulkan native 操作和必要的后端私有状态。
|
||||
- 主程序侧保留项目、节点、任务、cache、OpenFX host 等 editor 状态。
|
||||
- 如果某个后端函数需要主程序创建 `Texture` 或访问 cache,用 C callback table 从后端回调主程序,而不是把完整 editor 链进后端库。
|
||||
- `OAK_ENABLE_DYNAMIC_RENDER_BACKEND` 打开前必须完成最小链接边界拆分并通过 CI。
|
||||
- `OAK_ENABLE_DYNAMIC_RENDER_BACKEND` 可用于实验构建和加载验证;默认启用前必须完成最小链接边界拆分并通过 CI。
|
||||
|
||||
## 阶段 3:Vulkan 后端
|
||||
|
||||
|
||||
Reference in New Issue
Block a user