Prefer external packages when building with vcpkg

This commit is contained in:
Matthias Kuhn 2024-10-24 18:10:21 +02:00
parent e91a2c7150
commit ce93779758
3 changed files with 21 additions and 6 deletions

View File

@ -26,7 +26,6 @@ set (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be bui
set (WITH_GUI TRUE CACHE BOOL "Determines whether QGIS GUI library should be built")
set(WITH_VCPKG FALSE CACHE BOOL "Use the vcpkg submodule for dependency management.")
set(WITH_VCPKG TRUE CACHE BOOL "Use the vcpkg submodule for dependency management.")
set(SDK_PATH "" CACHE STRING "Build with VCPKG SDK")
if(NOT SDK_PATH STREQUAL "")
@ -45,6 +44,9 @@ endif()
if(WITH_VCPKG)
list(APPEND CMAKE_PROGRAM_PATH "${VCPKG_INSTALL_PREFIX}/${VCPKG_TARGET_TRIPLET}/")
set(PREFER_INTERNAL_LIBS FALSE)
else()
set(PREFER_INTERNAL_LIBS TRUE)
endif()
#############################################################
@ -272,7 +274,8 @@ if(WITH_CORE)
endif()
# try to configure and build POLY2TRI support
set (WITH_INTERNAL_POLY2TRI TRUE CACHE BOOL "Determines whether POLY2TRI should be built from internal copy")
set (WITH_INTERNAL_POLY2TRI PREFER_INTERNAL_LIBS CACHE BOOL "Determines whether POLY2TRI should be built from internal copy")
set (WITH_INTERNAL_MESHOPTIMIZER PREFER_INTERNAL_LIBS CACHE BOOL "Determines whether MESHOPTIMIZER should be built from internal copy")
# try to configure and build POSTGRESQL support
set (WITH_POSTGRESQL TRUE CACHE BOOL "Determines whether POSTGRESQL support should be built")
@ -385,7 +388,7 @@ if(WITH_CORE)
find_package(EXPAT REQUIRED)
find_package(Spatialindex REQUIRED)
find_package(LibZip REQUIRED)
set (WITH_INTERNAL_NLOHMANN_JSON ON CACHE BOOL "Determines whether the vendored copy of nlohmann-json should be used")
set (WITH_INTERNAL_NLOHMANN_JSON PREFER_INTERNAL_LIBS CACHE BOOL "Determines whether the vendored copy of nlohmann-json should be used")
find_package(nlohmann_json REQUIRED)
# The following bypasses the FindSQLite3 module introduced in CMake 3.14

View File

@ -19,6 +19,18 @@ if (WITH_PDF4QT)
SUBDIRS(${CMAKE_SOURCE_DIR}/external/PDF4QT)
endif()
if(WITH_INTERNAL_MESHOPTIMIZER)
add_library(STATIC meshoptimizer::meshoptimizer
${CMAKE_SOURCE_DIR}/external/meshOptimizer/simplifier.cpp
)
target_include_directories(meshoptimizer::meshoptimizer
${CMAKE_SOURCE_DIR}/external/meshOptimizer
)
else()
find_package(meshoptimizer CONFIG REQUIRED)
endif()
set(QGIS_CORE_SRCS
${CMAKE_SOURCE_DIR}/external/kdbush/include/kdbush.hpp
@ -30,8 +42,6 @@ set(QGIS_CORE_SRCS
${CMAKE_SOURCE_DIR}/external/nmea/time.c
${CMAKE_SOURCE_DIR}/external/nmea/tok.c
${CMAKE_SOURCE_DIR}/external/meshOptimizer/simplifier.cpp
${FLEX_QgsExpressionLexer_OUTPUTS}
${BISON_QgsExpressionParser_OUTPUTS}
${FLEX_QgsSqlStatementLexer_OUTPUTS}
@ -2434,7 +2444,6 @@ target_include_directories(qgis_core PUBLIC
${CMAKE_SOURCE_DIR}/external/kdbush/include
${CMAKE_SOURCE_DIR}/external/nmea
${CMAKE_SOURCE_DIR}/external/rtree/include
${CMAKE_SOURCE_DIR}/external/meshOptimizer
${CMAKE_SOURCE_DIR}/external/tinygltf
)
@ -2549,6 +2558,7 @@ target_link_libraries(qgis_core
${EXIV2_LIBRARY}
PROJ::proj
nlohmann_json::nlohmann_json
meshoptimizer::meshoptimizer
)
if(BUILD_WITH_QT6)

View File

@ -60,6 +60,8 @@
},
"libxml2",
"libzip",
"meshoptimizer",
"nlohmann-json",
"pdal",
"proj",
"protobuf",