Files
GVFG_Standalone/GVFG_SDK/sdk/gvfg/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

88 lines
2.2 KiB
CMake

# Inherit the version from the standalone root project. The root project()
# declaration is the single source of truth for the public SDK version.
set(_GVFG_VERSION "${PROJECT_VERSION}")
project(gvfg VERSION ${_GVFG_VERSION} LANGUAGES CXX)
add_library(gvfg SHARED
gvfg.def
include/gvfg_capture.h
include/gvfg_debug.h
src/backend/pcies2mm/pcies2mm_backend_types.h
src/backend/pcies2mm/pcies2mm_capture_session.cpp
src/backend/pcies2mm/pcies2mm_capture_session.h
src/backend/pcies2mm/pcies2mm_device.cpp
src/backend/pcies2mm/pcies2mm_device.h
src/backend/pcies2mm/pcies2mm_reg.h
src/backend/pcies2mm/pcies2mm_video_format.cpp
src/backend/pcies2mm/pcies2mm_video_format.h
src/gpu/d3d_conversion_pipeline.cpp
src/gpu/d3d_conversion_pipeline.h
src/gpu/gvfg_gpu_convert.cpp
src/gvfg_error_state.h
src/gvfg_capture.cpp
)
set_target_properties(gvfg PROPERTIES
AUTOMOC OFF
AUTOUIC OFF
AUTORCC OFF
)
target_include_directories(gvfg
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/backend/pcies2mm
${CMAKE_CURRENT_SOURCE_DIR}/src/gpu
)
target_compile_definitions(gvfg PRIVATE
GVFG_BUILD
GVFG_VERSION_STRING="${PROJECT_VERSION}"
)
target_compile_definitions(gvfg PRIVATE
GVFG_INTERNAL_DIAGNOSTICS=$<IF:$<CONFIG:Debug>,1,0>
)
target_link_libraries(gvfg PRIVATE
giga_ioctl
setupapi
user32
dxgi
d3d11
D3DCompiler
)
if (MSVC)
target_compile_options(gvfg PRIVATE /utf-8 /EHsc)
endif()
if (MSVC AND GVFG_MINGW_DLLTOOL)
add_custom_command(TARGET gvfg POST_BUILD
COMMAND "${GVFG_MINGW_DLLTOOL}"
-d "${CMAKE_CURRENT_SOURCE_DIR}/gvfg.def"
-D gvfg.dll
-l libgvfg.dll.a
WORKING_DIRECTORY "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}"
COMMENT "Generating MinGW import library for gvfg.dll"
VERBATIM
)
endif()
install(TARGETS gvfg
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(FILES include/gvfg_capture.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if (MSVC AND GVFG_MINGW_DLLTOOL)
install(FILES "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libgvfg.dll.a"
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()