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

Enable Qt Quick3D support #5752

Merged
merged 7 commits into from
Oct 22, 2024
Merged
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: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if (ANDROID)
set(ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_BINARY_DIR}/android-template)
endif()

find_package(Qt6 COMPONENTS Concurrent Core Qml Gui Xml Positioning Widgets Network Quick Svg Sql Sensors WebView Multimedia Bluetooth Nfc WebSockets REQUIRED)
find_package(Qt6 COMPONENTS Concurrent Core Qml Gui Xml Positioning Widgets Network Quick Svg Sql Sensors WebView Multimedia Bluetooth Nfc WebSockets Quick3D REQUIRED)

if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
find_package(Qt6 COMPONENTS PrintSupport REQUIRED)
Expand Down
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
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ target_link_libraries(
Qt::WebView
Qt::Multimedia
Qt::WebSockets
Qt::Quick3D
QGIS::Core
QGIS::Analysis
ZXing::ZXing
Expand Down
9 changes: 9 additions & 0 deletions src/qml/Dummy.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is used to add extra imports for the qml import scanner to add additional modules
import QtQuick3D
import QtQuick3D.AssetUtils
import QtQuick3D.Helpers
import QtQuick3D.Particles3D
import QtWebSockets

Item {
}
3 changes: 1 addition & 2 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
* (at your option) any later version. *
* *
***************************************************************************/
import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Effects
import QtQuick.Window
import QtQml
import QtSensors
import QtCore
import QtWebSockets // Not used here but added so QML registers its dependencies for plugins to use
import org.qgis
import org.qfield
import Theme
Expand Down
1 change: 1 addition & 0 deletions src/qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<file>CoordinateLocator.qml</file>
<file>DashBoard.qml</file>
<file>DigitizingToolbar.qml</file>
<file>Dummy.qml</file>
<file>ElevationProfile.qml</file>
<file>FeatureForm.qml</file>
<file>FeatureListForm.qml</file>
Expand Down
1 change: 1 addition & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"qml"
]
},
"qtquick3d",
{
"name": "qtsensors",
"features": [
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