Skip to content

Commit 3b67590

Browse files
authored
Merge pull request qgis#61641 from NathanW2/win_build
qgis#59249 - Add qgis.env.in and cmake step to generate when using vcpkg
2 parents adc68b2 + 44c0ee1 commit 3b67590

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ else()
4444
message(STATUS "Building with system libraries --")
4545
endif()
4646

47+
4748
if(WITH_VCPKG)
4849
if(WIN32)
4950
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})
11021103
# if run from the build directory QGIS will detect it and alter the paths
11031104
file(WRITE ${QGIS_OUTPUT_DIRECTORY}/${QGIS_BIN_SUBDIR}/qgisbuildpath.txt "${CMAKE_SOURCE_DIR}\n${QGIS_OUTPUT_DIRECTORY}")
11041105

1106+
# Write the qgis.env file to the bin folder to allow running qgis.exe correctly from build folder
1107+
# and find the SDK installed folders. Only runs when VCPKG_APPLOCAL_DEPS=OFF because ON means it is packaged together
1108+
if(WITH_VCPKG AND NOT VCPKG_APPLOCAL_DEPS AND WIN32)
1109+
# Used in the env.in file to setup the correct paths to the SDK folder
1110+
set(VCPKG_TARGET_PATH "${VCPKG_INSTALL_PREFIX}/${VCPKG_TARGET_TRIPLET}")
1111+
configure_file("${CMAKE_SOURCE_DIR}/ms-windows/dev/qgis.env.in" "${QGIS_OUTPUT_DIRECTORY}/${QGIS_BIN_SUBDIR}/qgis.env")
1112+
endif()
1113+
11051114
# manual page - makes sense only on unix systems
11061115
if (UNIX AND NOT APPLE)
11071116
set (DEFAULT_MANUAL_SUBDIR man)

ms-windows/dev/qgis.env.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PATH=@VCPKG_TARGET_PATH@\bin;$ENV{WINDIR};$ENV{WINDIR}\system32\WBem
2+
PYTHONPATH=@QGIS_OUTPUT_DIRECTORY@\python;@VCPKG_TARGET_PATH@/tools/python3/Lib;@VCPKG_TARGET_PATH@/tools/python3/Lib/site-packages
3+
PROJ_DATA=@VCPKG_TARGET_PATH@/share/proj
4+
QT_PLUGIN_PATH=@VCPKG_TARGET_PATH@/Qt6/plugins;@VCPKG_TARGET_PATH@/bin/Qca
5+
PYTHONHOME=@VCPKG_TARGET_PATH@\tools\python3

0 commit comments

Comments
 (0)