ci: declare all oakengine handle types opaque for Qt metatypes; defer gtest discovery on Windows

- Linux GCC rejects QMetaType instantiation over incomplete types
  (static_assert(sizeof(T))); Q_DECLARE_OPAQUE_POINTER every opaque
  OakEngine* handle in the public headers so QList<OakEngineTask*> etc
  compile
- Windows: gtest discovery ran the fresh exe before the DLLs were next
  to it; use DISCOVERY_MODE PRE_TEST on WIN32 and copy the DLLs for
  ctest time
This commit is contained in:
2026-08-02 17:44:51 +08:00
parent d57c812fa6
commit 824e352da1
16 changed files with 46 additions and 8 deletions
+6 -3
View File
@@ -31,11 +31,14 @@ target_include_directories(oakcore_gtest PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../include/olive/core" "${CMAKE_CURRENT_SOURCE_DIR}/../include/olive/core"
) )
gtest_discover_tests(oakcore_gtest)
if (WIN32) if (WIN32)
# gtest discovery executes the binary at build time; it needs the DLL next to it # gtest discovery would run the freshly linked exe at build time before the
# DLLs are copied; defer discovery to ctest time on Windows.
gtest_discover_tests(oakcore_gtest DISCOVERY_MODE PRE_TEST)
# The test exe needs the DLL next to it (both for ctest and discovery)
add_custom_command(TARGET oakcore_gtest POST_BUILD add_custom_command(TARGET oakcore_gtest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:olivecore> $<TARGET_FILE_DIR:oakcore_gtest>) $<TARGET_FILE:olivecore> $<TARGET_FILE_DIR:oakcore_gtest>)
else ()
gtest_discover_tests(oakcore_gtest)
endif () endif ()
+6 -3
View File
@@ -291,10 +291,11 @@ if (BUILD_TESTS)
endif () endif ()
# Freshly linked binaries can exceed the 5s default discovery # Freshly linked binaries can exceed the 5s default discovery
# timeout on first run (dyld cold cache + Qt/OCIO init) # timeout on first run (dyld cold cache + Qt/OCIO init)
gtest_discover_tests(${name} DISCOVERY_TIMEOUT 60)
if (WIN32) if (WIN32)
# gtest discovery executes the binary at build time; it needs # Defer discovery to ctest time; at build time the DLLs are not
# the engine DLLs next to it # next to the exe yet (copied below).
gtest_discover_tests(${name} DISCOVERY_TIMEOUT 60
DISCOVERY_MODE PRE_TEST)
add_custom_command(TARGET ${name} POST_BUILD add_custom_command(TARGET ${name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:oakengine> $<TARGET_FILE_DIR:${name}> $<TARGET_FILE:oakengine> $<TARGET_FILE_DIR:${name}>
@@ -302,6 +303,8 @@ if (BUILD_TESTS)
$<TARGET_FILE:olivecore> $<TARGET_FILE_DIR:${name}> $<TARGET_FILE:olivecore> $<TARGET_FILE_DIR:${name}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:ffmpeg_bridge> $<TARGET_FILE_DIR:${name}>) $<TARGET_FILE:ffmpeg_bridge> $<TARGET_FILE_DIR:${name}>)
else ()
gtest_discover_tests(${name} DISCOVERY_TIMEOUT 60)
endif () endif ()
endfunction() endfunction()
+1
View File
@@ -325,6 +325,7 @@ OAKENGINE_API OakAudioParams *oakengine_audio_processor_output_params(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineAudioProcessor *)
#endif #endif
#endif /* OAKENGINE_AUDIO_H */ #endif /* OAKENGINE_AUDIO_H */
+3
View File
@@ -292,6 +292,9 @@ OAKENGINE_API int oakengine_color_transform_job_set_processor(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineColorManager *)
Q_DECLARE_OPAQUE_POINTER(OakEngineColorProcessor *)
Q_DECLARE_OPAQUE_POINTER(OakEngineColorConfig *)
#endif #endif
#endif /* OAKENGINE_COLOR_H */ #endif /* OAKENGINE_COLOR_H */
+1
View File
@@ -500,6 +500,7 @@ oakengine_encoding_start_audio_recording(const OakEngineEncodingParams *params,
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineEncodingParams *)
#endif #endif
#endif /* OAKENGINE_ENCODING_H */ #endif /* OAKENGINE_ENCODING_H */
+1
View File
@@ -511,6 +511,7 @@ OAKENGINE_API int oakengine_footage_invalidate(OakEngineFootage *self);
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineFootage *)
#endif #endif
#endif /* OAKENGINE_FOOTAGE_H */ #endif /* OAKENGINE_FOOTAGE_H */
+3
View File
@@ -2087,6 +2087,9 @@ oakengine_node_get_video_frame_cache(const OakEngineNode *self);
Q_DECLARE_OPAQUE_POINTER(OakEngineNode *) Q_DECLARE_OPAQUE_POINTER(OakEngineNode *)
Q_DECLARE_OPAQUE_POINTER(OakEngineKeyframe *) Q_DECLARE_OPAQUE_POINTER(OakEngineKeyframe *)
Q_DECLARE_OPAQUE_POINTER(OakEngineNodeDragger *) Q_DECLARE_OPAQUE_POINTER(OakEngineNodeDragger *)
Q_DECLARE_OPAQUE_POINTER(OakEngineFrameCache *)
Q_DECLARE_OPAQUE_POINTER(OakEngineThumbnailCache *)
Q_DECLARE_OPAQUE_POINTER(OakEngineWaveformCache *)
#endif #endif
#endif /* OAKENGINE_NODE_H */ #endif /* OAKENGINE_NODE_H */
+1
View File
@@ -213,6 +213,7 @@ OAKENGINE_API int oakengine_playback_last_error(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEnginePlayback *)
#endif #endif
#endif /* OAKENGINE_PLAYBACK_H */ #endif /* OAKENGINE_PLAYBACK_H */
+1
View File
@@ -246,6 +246,7 @@ OAKENGINE_API void oakengine_preview_request_free(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEnginePreviewRequest *)
#endif #endif
#endif /* OAKENGINE_PREVIEW_H */ #endif /* OAKENGINE_PREVIEW_H */
+4
View File
@@ -339,6 +339,10 @@ OAKENGINE_API int oakengine_project_set_color_reference_space(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineNode *)
Q_DECLARE_OPAQUE_POINTER(OakEnginePlaybackCache *)
Q_DECLARE_OPAQUE_POINTER(OakEngineProject *)
Q_DECLARE_OPAQUE_POINTER(OakEngineSequence *)
#endif #endif
#endif /* OAKENGINE_PROJECT_H */ #endif /* OAKENGINE_PROJECT_H */
+3
View File
@@ -245,6 +245,9 @@ OAKENGINE_API void oakengine_audio_free(OakEngineAudioBuffer *self);
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineRenderer *)
Q_DECLARE_OPAQUE_POINTER(OakEngineFrame *)
Q_DECLARE_OPAQUE_POINTER(OakEngineAudioBuffer *)
#endif #endif
#endif /* OAKENGINE_RENDERER_H */ #endif /* OAKENGINE_RENDERER_H */
+2
View File
@@ -249,6 +249,8 @@ OAKENGINE_API int oakengine_clipboard_foreach_connection(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineClipboard *)
Q_DECLARE_OPAQUE_POINTER(OakEngineMarker *)
#endif #endif
#endif /* OAKENGINE_SERIALIZER_H */ #endif /* OAKENGINE_SERIALIZER_H */
+1
View File
@@ -288,6 +288,7 @@ oakengine_task_save_get_project(OakEngineTask *task);
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineTask *)
#endif #endif
#endif /* OAKENGINE_TASK_H */ #endif /* OAKENGINE_TASK_H */
+8 -2
View File
@@ -1310,9 +1310,15 @@ oakengine_clip_get_connected_viewer(const OakEngineBlock *clip);
} }
// Qt6 on some toolchains requires complete types in meta-type instantiations // Qt6 on some toolchains requires complete types in meta-type instantiations
// (e.g. QList<OakEngineBlock*> in TimelinePanel signals); declare the handle // (e.g. QList<OakEngineBlock*> in TimelinePanel signals); declare the handles
// opaque instead of pulling the engine definition into the public header. // opaque instead of pulling the engine definitions into the public header.
Q_DECLARE_OPAQUE_POINTER(OakEngineBlock *) Q_DECLARE_OPAQUE_POINTER(OakEngineBlock *)
Q_DECLARE_OPAQUE_POINTER(OakEngineClip *)
Q_DECLARE_OPAQUE_POINTER(OakEngineMarkerList *)
Q_DECLARE_OPAQUE_POINTER(OakEngineMarker *)
Q_DECLARE_OPAQUE_POINTER(OakEngineWorkarea *)
Q_DECLARE_OPAQUE_POINTER(OakEngineTrack *)
Q_DECLARE_OPAQUE_POINTER(OakEngineTrackList *)
#endif #endif
#endif /* OAKENGINE_TIMELINE_H */ #endif /* OAKENGINE_TIMELINE_H */
+1
View File
@@ -162,6 +162,7 @@ OAKENGINE_API int oakengine_traverse_transform(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEngineTraverseDb *)
#endif #endif
#endif /* OAKENGINE_TRAVERSE_H */ #endif /* OAKENGINE_TRAVERSE_H */
+4
View File
@@ -440,6 +440,10 @@ OAKENGINE_API int oakengine_waveform_cache_get_summary(
#ifdef __cplusplus #ifdef __cplusplus
} }
Q_DECLARE_OPAQUE_POINTER(OakEnginePlaybackCache *)
Q_DECLARE_OPAQUE_POINTER(OakEngineFrameCache *)
Q_DECLARE_OPAQUE_POINTER(OakEngineThumbnailCache *)
Q_DECLARE_OPAQUE_POINTER(OakEngineWaveformCache *)
#endif #endif
#endif /* OAKENGINE_VIEWER_H */ #endif /* OAKENGINE_VIEWER_H */