Skip to content

Commit 76b65ba

Browse files
authored
Fix android missing proj & qgis resources on android (#4155)
1 parent a7bc88a commit 76b65ba

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.gitignore

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ core/merginsecrets.cpp
1111
test/temp_projects/
1212
test/temp_extra_projects/
1313
input.pro.user*
14-
app/android/assets/qgis-data/proj_custom/
15-
app/android/assets/qgis-data/projects/
16-
app/android/assets/qgis-data/proj
17-
app/android/assets/qgis-data/resources
18-
app/android/assets/projects/
14+
app/android/assets
1915
app/android/AndroidManifest.xml
16+
app/android/build.gradle
17+
app/android/.gradle
2018
*.gpkg-wal
2119
*.gpkg-shm
2220
Input_keystore.keystore
2321
CMakeLists.txt.user
24-
app/android/build.gradle
25-
app/android/.gradle/*
26-
app/android/.gradle
2722
.github/secrets/ios/LutraConsulting*.mobileprovision

CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,16 +380,25 @@ endif ()
380380
# RESOURCES
381381
# ########################################################################################
382382
message(STATUS "Copying proj and qgis resources to android/assets/qgis-data")
383-
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/app/android/assets/qgis-data/resources)
383+
384+
# On android we need to copy the resources into the source tree and then Qt will copy it
385+
# to the android build directory with QT_ANDROID_PACKAGE_SOURCE_DIR
386+
if (ANDROID)
387+
set(ASSETS_DIR_PATH ${CMAKE_CURRENT_SOURCE_DIR})
388+
else ()
389+
set(ASSETS_DIR_PATH ${CMAKE_BINARY_DIR})
390+
endif ()
391+
392+
file(MAKE_DIRECTORY ${ASSETS_DIR_PATH}/app/android/assets/qgis-data/resources)
384393
file(COPY ${QGIS_RESOURCE_DIR}/qgis.db
385-
DESTINATION ${CMAKE_BINARY_DIR}/app/android/assets/qgis-data/resources/
394+
DESTINATION ${ASSETS_DIR_PATH}/app/android/assets/qgis-data/resources/
386395
)
387396
file(COPY ${QGIS_RESOURCE_DIR}/srs.db
388-
DESTINATION ${CMAKE_BINARY_DIR}/app/android/assets/qgis-data/resources/
397+
DESTINATION ${ASSETS_DIR_PATH}/app/android/assets/qgis-data/resources/
389398
)
390399
file(
391400
COPY ${PROJ_DIR}
392-
DESTINATION ${CMAKE_BINARY_DIR}/app/android/assets/qgis-data/
401+
DESTINATION ${ASSETS_DIR_PATH}/app/android/assets/qgis-data/
393402
PATTERN "*.cmake" EXCLUDE
394403
PATTERN "vcpkg*" EXCLUDE
395404
)

0 commit comments

Comments
 (0)