Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ NOTE: icon must be without transparency
- Update secret (passports) on github

## QGIS debugging
When you want to debug QGIS code it's necessary to first build the QGIS dependency in `RelWithDebugInfo` mode. This can be achieved by specifying these environment variables:

| Name | Value |
|:---------------------:|:------------------:|
| `QGIS_DEBUG_BUILD` | 1 |
| `VCPKG_KEEP_ENV_VARS` | `QGIS_DEBUG_BUILD` |
When you want to debug QGIS code it's necessary to first build the QGIS dependency in `Debug` or `RelWithDebugInfo` mode.
The build type of the QGIS dependency can be selected by setting the `QGIS_BUILD_TYPE` environment variable before calling `cmake`.
Valid values are `Debug` and `RelWithDebugInfo`, any other value or an unset variable will result in having QGIS built in `Release`, which is the default.
Once the QGIS dependency is built in all modes, switching between them should be fast as the vcpkg cache is used and no rebuild is required.

Furthermore, to debug android version of Mergin Maps it's highly recommended to use QtCreator, even though it should be possible also without it.
Furthermore, to debug android version of Mergin Maps it's highly recommended to use QtCreator, even though it should be possible also without it.
13 changes: 10 additions & 3 deletions vcpkg/ports/qgis/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,16 @@ if (VCPKG_CROSSCOMPILING)
)
endif ()

if (DEFINED ENV{QGIS_DEBUG_BUILD})
message(STATUS "Building requested QGIS RelWithDebInfo build")
list(APPEND QGIS_OPTIONS_RELEASE -DCMAKE_BUILD_TYPE=RelWithDebInfo)
if (DEFINED ENV{QGIS_BUILD_TYPE})
set(QGIS_BUILD_TYPE $ENV{QGIS_BUILD_TYPE})
if (QGIS_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
message(STATUS "Building requested QGIS ${QGIS_BUILD_TYPE} build")
list(APPEND QGIS_OPTIONS_RELEASE -DCMAKE_BUILD_TYPE=${QGIS_BUILD_TYPE})
else ()
message(WARNING "QGIS_BUILD_TYPE value '${QGIS_BUILD_TYPE}' is not valid, ignoring. Valid values are Debug or RelWithDebInfo.")
endif ()
else ()
message(STATUS "Building requested QGIS Release build")
endif ()

vcpkg_configure_cmake(
Expand Down
2 changes: 2 additions & 0 deletions vcpkg/triplets/arm-android.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ set(ANDROID_SDK_ROOT $ENV{ANDROID_SDK_ROOT})
set(VCPKG_CXX_FLAGS "-fstack-protector-strong")
set(VCPKG_C_FLAGS "-fstack-protector-strong")
set(VCPKG_LINKER_FLAGS "-lunwind -Wl,--exclude-libs=libunwind.a")

include("${CMAKE_CURRENT_LIST_DIR}/qgis-build-type.cmake")
2 changes: 2 additions & 0 deletions vcpkg/triplets/arm64-android.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ set(ANDROID_SDK_ROOT $ENV{ANDROID_SDK_ROOT})

set(VCPKG_CXX_FLAGS "-fstack-protector-strong")
set(VCPKG_C_FLAGS "-fstack-protector-strong")

include("${CMAKE_CURRENT_LIST_DIR}/qgis-build-type.cmake")
2 changes: 2 additions & 0 deletions vcpkg/triplets/arm64-ios.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ set(VCPKG_MAKE_BUILD_TRIPLET "--host=aarch64-apple-ios${VCPKG_OSX_DEPLOYMENT_TAR
set(VCPKG_BUILD_TYPE release)
set(VCPKG_CXX_FLAGS "-fvisibility=hidden")
set(VCPKG_C_FLAGS "-fvisibility=hidden")

include("${CMAKE_CURRENT_LIST_DIR}/qgis-build-type.cmake")
2 changes: 2 additions & 0 deletions vcpkg/triplets/arm64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ set(VCPKG_OSX_DEPLOYMENT_TARGET 11.0)
# See https://github.com/microsoft/vcpkg/issues/10038
set(VCPKG_C_FLAGS -mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET})
set(VCPKG_CXX_FLAGS -mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET})

include("${CMAKE_CURRENT_LIST_DIR}/qgis-build-type.cmake")
3 changes: 3 additions & 0 deletions vcpkg/triplets/qgis-build-type.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if (PORT STREQUAL "qgis" AND "$ENV{QGIS_BUILD_TYPE}" MATCHES "^(Debug|RelWithDebInfo)$")
list(APPEND VCPKG_ENV_PASSTHROUGH QGIS_BUILD_TYPE)
endif ()
2 changes: 2 additions & 0 deletions vcpkg/triplets/x64-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_BUILD_TYPE release)

set(VCPKG_FIXUP_ELF_RPATH ON)

include("${CMAKE_CURRENT_LIST_DIR}/qgis-build-type.cmake")
2 changes: 2 additions & 0 deletions vcpkg/triplets/x64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ set(VCPKG_OSX_DEPLOYMENT_TARGET 11.0)
# See https://github.com/microsoft/vcpkg/issues/10038
set(VCPKG_C_FLAGS -mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET})
set(VCPKG_CXX_FLAGS -mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET})

include("${CMAKE_CURRENT_LIST_DIR}/qgis-build-type.cmake")
2 changes: 2 additions & 0 deletions vcpkg/triplets/x64-windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_BUILD_TYPE release)

include("${CMAKE_CURRENT_LIST_DIR}/qgis-build-type.cmake")
Loading