Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unvendor meshoptimizer #5755

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 2 additions & 0 deletions cmake/qgis-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ if(TRUE) # Should possibly have a "static only" check
endif()
find_package(poly2tri CONFIG)
target_link_libraries(QGIS::Core INTERFACE poly2tri::poly2tri)
find_package(meshoptimizer CONFIG REQUIRED)
target_link_libraries(QGIS::Core INTERFACE meshoptimizer::meshoptimizer)

pkg_check_modules(freexl REQUIRED IMPORTED_TARGET freexl)
target_link_libraries(QGIS::Core INTERFACE PkgConfig::freexl)
Expand Down
60 changes: 60 additions & 0 deletions vcpkg/ports/qgis/meshoptimizer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e299cb1d617..ae6482b4e90 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -255,6 +255,7 @@ if(WITH_CORE)

# 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_MESHOPTIMIZER TRUE 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")
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 94c0e143001..777bd4bcb21 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -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}
@@ -2375,7 +2385,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
)

@@ -2485,6 +2494,7 @@ target_link_libraries(qgis_core
${ZLIB_LIBRARIES}
${EXIV2_LIBRARY}
PROJ::proj
+ meshoptimizer::meshoptimizer
)

if(BUILD_WITH_QT6)
2 changes: 2 additions & 0 deletions vcpkg/ports/qgis/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ vcpkg_from_github(
include-qthread.patch
processing.patch # Needed to avoid link issue with tinygltf (ATM embedded into QGIS) and _GEOSQueryCallback defined multiple times
font_download.patch
meshoptimizer.patch # Unvendor meshoptimizer
)

file(REMOVE ${SOURCE_PATH}/cmake/FindGDAL.cmake)
Expand All @@ -38,6 +39,7 @@ list(APPEND QGIS_OPTIONS "-DWITH_QSPATIALITE:BOOL=OFF")
list(APPEND QGIS_OPTIONS "-DWITH_PDAL:BOOL=OFF")
list(APPEND QGIS_OPTIONS "-DWITH_DRACO:BOOL=ON")
list(APPEND QGIS_OPTIONS "-DWITH_INTERNAL_POLY2TRI:BOOL=OFF")
list(APPEND QGIS_OPTIONS "-DWITH_INTERNAL_MESHOPTIMIZER:BOOL=OFF")

list(APPEND QGIS_OPTIONS "-DBISON_EXECUTABLE=${BISON}")
list(APPEND QGIS_OPTIONS "-DFLEX_EXECUTABLE=${FLEX}")
Expand Down
1 change: 1 addition & 0 deletions vcpkg/ports/qgis/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"libxml2",
"libzip",
"meshoptimizer",
"proj",
"protobuf",
{
Expand Down
Loading
Loading