Merge pull request #61641 from NathanW2/win_build

#59249 - Add qgis.env.in and cmake step to generate when using vcpkg
This commit is contained in:
Matthias Kuhn 2025-05-07 13:37:19 +02:00 committed by GitHub
commit 3b6759013d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -44,6 +44,7 @@ else()
message(STATUS "Building with system libraries --")
endif()
if(WITH_VCPKG)
if(WIN32)
list(APPEND CMAKE_PROGRAM_PATH "${VCPKG_INSTALL_PREFIX}/${VCPKG_TARGET_TRIPLET}/tools/python3/Scripts/")
@ -1102,6 +1103,14 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIB_SUBDIR})
# if run from the build directory QGIS will detect it and alter the paths
file(WRITE ${QGIS_OUTPUT_DIRECTORY}/${QGIS_BIN_SUBDIR}/qgisbuildpath.txt "${CMAKE_SOURCE_DIR}\n${QGIS_OUTPUT_DIRECTORY}")
# Write the qgis.env file to the bin folder to allow running qgis.exe correctly from build folder
# and find the SDK installed folders. Only runs when VCPKG_APPLOCAL_DEPS=OFF because ON means it is packaged together
if(WITH_VCPKG AND NOT VCPKG_APPLOCAL_DEPS AND WIN32)
# Used in the env.in file to setup the correct paths to the SDK folder
set(VCPKG_TARGET_PATH "${VCPKG_INSTALL_PREFIX}/${VCPKG_TARGET_TRIPLET}")
configure_file("${CMAKE_SOURCE_DIR}/ms-windows/dev/qgis.env.in" "${QGIS_OUTPUT_DIRECTORY}/${QGIS_BIN_SUBDIR}/qgis.env")
endif()
# manual page - makes sense only on unix systems
if (UNIX AND NOT APPLE)
set (DEFAULT_MANUAL_SUBDIR man)

View File

@ -0,0 +1,5 @@
PATH=@VCPKG_TARGET_PATH@\bin;$ENV{WINDIR};$ENV{WINDIR}\system32\WBem
PYTHONPATH=@QGIS_OUTPUT_DIRECTORY@\python;@VCPKG_TARGET_PATH@/tools/python3/Lib;@VCPKG_TARGET_PATH@/tools/python3/Lib/site-packages
PROJ_DATA=@VCPKG_TARGET_PATH@/share/proj
QT_PLUGIN_PATH=@VCPKG_TARGET_PATH@/Qt6/plugins;@VCPKG_TARGET_PATH@/bin/Qca
PYTHONHOME=@VCPKG_TARGET_PATH@\tools\python3