ci: make Windows render plugins entry-point-only (fix duplicate symbols)

oakengine-obj already contains openglrenderer.cpp and its moc output;
compiling them again into oakgl.dll plus embedding oakengine-obj caused
duplicate definitions and a stray k_app_version reference. On Windows
the plugins now compile only the C entry point and link oakengine-obj +
olive-version-obj.
This commit is contained in:
2026-08-03 13:52:28 +08:00
parent 1af7ab7838
commit 960d6361d5
+20 -11
View File
@@ -165,18 +165,23 @@ if (OAK_ENABLE_DYNAMIC_RENDER_BACKEND)
endif () endif ()
endforeach () endforeach ()
if (WIN32)
# Engine-internal C++ symbols are not exported from liboakengine.dll,
# so embed the object library like the engine tests do. oakengine-obj
# already contains openglrenderer.cpp and its moc output, so on
# Windows the plugin only needs the C entry point (duplicating the
# sources would cause duplicate definitions at link time). MinGW
# compares type_info by name, so cross-DLL RTTI still works.
add_library(oakgl SHARED render/opengl/openglbackend_c.cpp)
set_target_properties(oakgl PROPERTIES AUTOMOC OFF)
target_link_libraries(oakgl PRIVATE oakengine-obj
$<TARGET_OBJECTS:olive-version-obj>)
else ()
add_library(oakgl SHARED add_library(oakgl SHARED
render/opengl/openglbackend_c.cpp render/opengl/openglbackend_c.cpp
render/opengl/openglrenderer.cpp render/opengl/openglrenderer.cpp
render/opengl/openglrenderer.h render/opengl/openglrenderer.h
) )
if (WIN32)
# Engine-internal C++ symbols (olive::Renderer, FileFunctions, ...) are
# not exported from liboakengine.dll; embed the object library like the
# engine tests do. MinGW compares type_info by name, so cross-DLL RTTI
# with the shared engine still works.
target_link_libraries(oakgl PRIVATE oakengine-obj)
else ()
target_link_libraries(oakgl PRIVATE oakengine) target_link_libraries(oakgl PRIVATE oakengine)
endif () endif ()
if (COMMAND oak_copy_otio_runtime) if (COMMAND oak_copy_otio_runtime)
@@ -200,15 +205,19 @@ if (OAK_ENABLE_DYNAMIC_RENDER_BACKEND)
) )
if (Vulkan_FOUND) if (Vulkan_FOUND)
if (WIN32)
# Same treatment as oakgl (see above): entry point only, engine
# objects come from oakengine-obj.
add_library(oakvulkan SHARED render/vulkan/vulkanbackend_c.cpp)
set_target_properties(oakvulkan PROPERTIES AUTOMOC OFF)
target_link_libraries(oakvulkan PRIVATE oakengine-obj
$<TARGET_OBJECTS:olive-version-obj>)
else ()
add_library(oakvulkan SHARED add_library(oakvulkan SHARED
render/vulkan/vulkanbackend_c.cpp render/vulkan/vulkanbackend_c.cpp
render/vulkan/vulkanrenderer.cpp render/vulkan/vulkanrenderer.cpp
render/vulkan/vulkanrenderer.h render/vulkan/vulkanrenderer.h
) )
if (WIN32)
# Same as oakgl: embed the engine objects on Windows (see above).
target_link_libraries(oakvulkan PRIVATE oakengine-obj)
else ()
target_link_libraries(oakvulkan PRIVATE oakengine) target_link_libraries(oakvulkan PRIVATE oakengine)
endif () endif ()
if (COMMAND oak_copy_otio_runtime) if (COMMAND oak_copy_otio_runtime)