Files
GVFG_Standalone/GVFG_SDK/helpers/gvfg_preview/CMakeLists.txt
T
Mark.lin 1214e720d2 Support MSVC and MinGW SDK consumers
Compared with dc08a95:

- Add explicit module-definition files for the capture and preview DLLs so their public C export names remain stable and can be consumed without compiler-specific C++ symbol conventions.

- Keep the SDK implementation built with MSVC while automatically using MinGW dlltool to generate libgvfg.dll.a and libgvfg_preview.dll.a alongside the existing MSVC import libraries.

- Make the public capture header portable by including SAL only under MSVC and defining no-op annotations required by non-MSVC C and C++ compilers.

- Replace the Qt sample's compiler-specific wait on std::thread::native_handle() with an explicit atomic worker-completion state while preserving synchronous window-message servicing during shutdown.

- Document that MSVC and MinGW consumers use different import libraries while loading the same gvfg.dll and gvfg_preview.dll at runtime.

Validation: MSVC Debug and Release SDK builds passed and produced both MSVC and MinGW import libraries. Qt MSVC Debug, Qt MinGW Debug, and Qt MinGW Release sample builds and links passed. MinGW C and C++ public-header syntax checks passed, the MinGW executable import table references the expected GVFG DLLs and C exports, and git diff --check passed. No runtime launch, capture, audio playback, clean-machine deployment, or hardware validation was run.
2026-09-11 14:52:24 +08:00

68 lines
1.6 KiB
CMake

project(gvfg_preview LANGUAGES CXX)
add_library(gvfg_preview SHARED
gvfg_preview.def
include/gvfg_preview.h
../../sdk/gvfg/src/gpu/d3d_conversion_pipeline.cpp
../../sdk/gvfg/src/gpu/d3d_conversion_pipeline.h
src/gvfg_preview.cpp
)
set_target_properties(gvfg_preview PROPERTIES
AUTOMOC OFF
AUTOUIC OFF
AUTORCC OFF
)
target_include_directories(gvfg_preview
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/gvfg/src/gpu
)
target_compile_definitions(gvfg_preview PRIVATE
GVFG_PREVIEW_BUILD
GVFG_INTERNAL_DIAGNOSTICS=$<IF:$<CONFIG:Debug>,1,0>
)
target_link_libraries(gvfg_preview
PRIVATE
user32
dxgi
d3d11
D3DCompiler
)
if (MSVC)
target_compile_options(gvfg_preview PRIVATE /utf-8 /EHsc)
endif()
if (MSVC AND GVFG_MINGW_DLLTOOL)
add_custom_command(TARGET gvfg_preview POST_BUILD
COMMAND "${GVFG_MINGW_DLLTOOL}"
-d "${CMAKE_CURRENT_SOURCE_DIR}/gvfg_preview.def"
-D gvfg_preview.dll
-l libgvfg_preview.dll.a
WORKING_DIRECTORY "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}"
COMMENT "Generating MinGW import library for gvfg_preview.dll"
VERBATIM
)
endif()
install(TARGETS gvfg_preview
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(FILES include/gvfg_preview.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if (MSVC AND GVFG_MINGW_DLLTOOL)
install(FILES "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libgvfg_preview.dll.a"
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()