Use one Release SDK build for Qt samples

Compared with 8282724:

- Replace configuration-dependent SDK build discovery with one explicit GVFG_SDK_RELEASE_DIR used by every Qt sample configuration.

- Default the SDK Release directory to the existing Qt Creator MSVC Release build, which contains the shared runtime DLLs plus both MSVC and MinGW import libraries.

- Keep MSVC and MinGW sample builds selecting only their corresponding import-library filename while loading the same Release gvfg, gvfg_preview, and giga_ioctl DLLs.

- Simplify the documented internal workflow to Release SDK and Release sample builds, leaving customer-package filtering and internal/public artifact separation for the release stage.

Validation: git diff --cached --check passed. CMake configure completed for MSVC Release and MinGW Release samples against the same existing SDK Release directory. No compilation, linking, runtime launch, capture, audio playback, device-event, shutdown, or hardware validation was run.
This commit is contained in:
Mark.lin
2026-09-11 17:32:27 +08:00
parent 8282724e47
commit cde6c89a83
2 changed files with 33 additions and 50 deletions
+12 -25
View File
@@ -19,8 +19,14 @@ endif()
set(GVFG_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../GVFG_SDK"
CACHE PATH "GVFG SDK source root containing public headers")
set(GVFG_SDK_BUILD_DIR "${GVFG_SDK_ROOT}/build"
CACHE PATH "Prebuilt GVFG SDK directory containing bin and lib")
set(_GVFG_DEFAULT_RELEASE_DIR
"${GVFG_SDK_ROOT}/build/Desktop_Qt_6_10_2_MSVC2022_64bit-Release")
set(GVFG_SDK_RELEASE_DIR "${_GVFG_DEFAULT_RELEASE_DIR}"
CACHE PATH "One fixed Release GVFG SDK build directory containing bin and lib")
if (GVFG_SDK_RELEASE_DIR STREQUAL "${GVFG_SDK_ROOT}/build-release")
set(GVFG_SDK_RELEASE_DIR "${_GVFG_DEFAULT_RELEASE_DIR}"
CACHE PATH "One fixed Release GVFG SDK build directory containing bin and lib" FORCE)
endif()
set(_GVFG_INCLUDE_DIR "${GVFG_SDK_ROOT}/sdk/gvfg/include")
set(_GVFG_PREVIEW_INCLUDE_DIR "${GVFG_SDK_ROOT}/helpers/gvfg_preview/include")
@@ -35,31 +41,12 @@ else()
message(FATAL_ERROR "Unsupported compiler. Use MSVC or MinGW on Windows x64.")
endif()
# Accept either one exact SDK build directory or the parent `build` directory
# created by Qt Creator. In the latter case, select the current configuration's
# child only when it contains this compiler's import libraries.
set(_GVFG_RESOLVED_BUILD_DIR "${GVFG_SDK_BUILD_DIR}")
if (NOT EXISTS "${_GVFG_RESOLVED_BUILD_DIR}/lib/${_GVFG_IMPLIB_NAME}")
if (CMAKE_BUILD_TYPE)
file(GLOB _GVFG_BUILD_CANDIDATES LIST_DIRECTORIES true
"${GVFG_SDK_BUILD_DIR}/*-${CMAKE_BUILD_TYPE}")
foreach(_candidate IN LISTS _GVFG_BUILD_CANDIDATES)
if (EXISTS "${_candidate}/bin/gvfg.dll" AND
EXISTS "${_candidate}/lib/${_GVFG_IMPLIB_NAME}" AND
EXISTS "${_candidate}/lib/${_GVFG_PREVIEW_IMPLIB_NAME}")
set(_GVFG_RESOLVED_BUILD_DIR "${_candidate}")
break()
endif()
endforeach()
endif()
endif()
set(_GVFG_BIN_DIR "${_GVFG_RESOLVED_BUILD_DIR}/bin")
set(_GVFG_LIB_DIR "${_GVFG_RESOLVED_BUILD_DIR}/lib")
set(_GVFG_BIN_DIR "${GVFG_SDK_RELEASE_DIR}/bin")
set(_GVFG_LIB_DIR "${GVFG_SDK_RELEASE_DIR}/lib")
set(_GVFG_IMPLIB "${_GVFG_LIB_DIR}/${_GVFG_IMPLIB_NAME}")
set(_GVFG_PREVIEW_IMPLIB "${_GVFG_LIB_DIR}/${_GVFG_PREVIEW_IMPLIB_NAME}")
message(STATUS "GVFG SDK build: ${_GVFG_RESOLVED_BUILD_DIR}")
message(STATUS "GVFG SDK Release build: ${GVFG_SDK_RELEASE_DIR}")
foreach(_required_file
"${_GVFG_INCLUDE_DIR}/gvfg_capture.h"
@@ -72,7 +59,7 @@ foreach(_required_file
if (NOT EXISTS "${_required_file}")
message(FATAL_ERROR
"Required prebuilt GVFG SDK file was not found: ${_required_file}\n"
"Build/install GVFG_SDK first or set GVFG_SDK_BUILD_DIR.")
"Build GVFG_SDK Release first or set GVFG_SDK_RELEASE_DIR.")
endif()
endforeach()