Skip to content

Commit 94637d4

Browse files
Update INSTALL.md (#4236)
1 parent 389dbc0 commit 94637d4

File tree

2 files changed

+293
-11
lines changed

2 files changed

+293
-11
lines changed

INSTALL.md

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- [5. Building iOS](#5-building-ios)
1515
- [6. Building macOS](#6-building-macos)
1616
- [7. Building Windows](#7-building-windows)
17-
- [8. Common problems](#8-common-problems)
17+
- [8. FAQ](#8-faq)
1818
- [9. Auto Testing](#9-auto-testing)
1919

2020
# 1. Introduction
@@ -200,8 +200,8 @@ For building ABIs see https://www.qt.io/blog/android-multi-abi-builds-are-back
200200
- See current versions of build tools (`SDK_BUILD_TOOLS`), ndk (`NDK_VERSION`) and platform (`SDK_PLATFORM`) in `.github/workflows/android.yml`
201201
- `./cmdline-tools/bin/sdkmanager --sdk_root=./ "build-tools;<current_version>" "ndk;<current_version>" "platforms;<current_version>" platform-tools tools`
202202
- flex and bison
203-
- set up your own developer keystore. Creating the key(store) can be done either with Android studio or on command line
204-
with `keytool -genkeypair`.
203+
- - set up your own developer keystore. Creating the key(store) can be done either with Android studio or on command line with this command: `keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000`
204+
(customise the validity argument if needed).
205205

206206
2. Build mobile app (update CMake command with the correct Qt and Android NDK versions)
207207

@@ -277,6 +277,18 @@ For building ABIs see https://www.qt.io/blog/android-multi-abi-builds-are-back
277277

278278
To use USE_MM_SERVER_API_KEY read [Secrets](#Secrets) section.
279279

280+
4. Build and Run
281+
282+
To build the project, go to the build folder and run the following command:
283+
```
284+
ninja
285+
```
286+
Once built, navigate to the path and run MerginMaps:
287+
```
288+
build_folder/
289+
app/
290+
MerginMaps
291+
```
280292

281293
## 4.2. Android on macOS
282294
1. Install Java
@@ -298,6 +310,10 @@ For building ABIs see https://www.qt.io/blog/android-multi-abi-builds-are-back
298310
- Get Android `sdkmanager` by following these steps https://developer.android.com/tools/sdkmanager
299311
- See current versions of build tools (`SDK_BUILD_TOOLS`), ndk (`NDK_VERSION`) and platform (`SDK_PLATFORM`) in `.github/workflows/android.yml`
300312
- Now perform `./cmdline-tools/bin/sdkmanager --sdk_root=./ "build-tools;<current_version>" "ndk;<current_version>" "platforms;<current_version>" platform-tools tools` to install all needed Android tools, make sure to double-check if the version numbers are correct
313+
- After this step, check that you have:
314+
- installed flex and bison
315+
- set up your own developer keystore. Creating the key(store) can be done either with Android studio or on command line with this command: `keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000`
316+
(customise the validity argument if needed).
301317

302318
3. Configure
303319

@@ -312,9 +328,12 @@ For building ABIs see https://www.qt.io/blog/android-multi-abi-builds-are-back
312328
mobile/
313329
```
314330

331+
To find your QT_ANDROID_KEYSTORE_ALIAS, run this command:
332+
`keytool -list -v -keystore /<path-to-keystore>/my-release-key.keystore`.
315333
This is command line to setup build system. As part of the cmake configure step it will compile all the deps (Qt, GDAL, QGIS), so it
316334
can take considerable time (e.g. an hour). Subsequent runs will be faster as the libraries without change will be taken from local
317335
binary vcpkg cache.
336+
318337

319338
```
320339
export ANDROID_NDK_HOME=/Users/<user>/android/ndk/<current_version>
@@ -323,6 +342,7 @@ For building ABIs see https://www.qt.io/blog/android-multi-abi-builds-are-back
323342
export QT_ANDROID_KEYSTORE_KEY_PASS=<password>
324343
export QT_ANDROID_KEYSTORE_STORE_PASS=<password>
325344
export QT_ANDROID_KEYSTORE_PATH=<keystore-path>
345+
export PATH=$(brew --prefix flex)/bin:$(brew --prefix bison)/bin:$(brew --prefix gettext)/bin:$PATH;
326346
327347
cmake \
328348
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -372,7 +392,19 @@ For building ABIs see https://www.qt.io/blog/android-multi-abi-builds-are-back
372392

373393

374394
To use USE_MM_SERVER_API_KEY read [Secrets](#Secrets) section.
375-
395+
396+
4. Build and Run
397+
398+
To build the project, go to the build folder and run the following command:
399+
```
400+
ninja
401+
```
402+
Once built, navigate to the path and run MerginMaps:
403+
```
404+
build_folder/
405+
app/
406+
MerginMaps
407+
```
376408

377409
## 4.3. Android on Windows
378410

@@ -445,12 +477,20 @@ Now you can create a build (either on command line or by setting these variables
445477
cd build
446478
447479
xcodebuild \
448-
-project Input.xcodeproj/ \
449-
-scheme Input \
480+
-project MerginMaps.xcodeproj/ \
481+
-scheme MerginMaps \
450482
-sdk iphoneos \
451483
-configuration Release \
452-
archive -archivePath Input.xcarchive
484+
archive -archivePath MerginMaps.xcarchive
453485
```
486+
Alternatively, navigate to the build folder and open the Xcode Project:
487+
488+
```
489+
build_folder/
490+
MerginMaps.xcodeproj
491+
```
492+
Once the project is opened, build it from Xcode.
493+
454494

455495
# 6. Building macOS
456496

@@ -512,7 +552,7 @@ Now you can create a build (either on command line or by setting these variables
512552

513553
5. Run the mobile app
514554
```
515-
./app/Input.app/Contents/MacOS/Input
555+
./app/MerginMaps.app/Contents/MacOS/MerginMaps
516556
```
517557

518558
# 7. Building Windows
@@ -570,10 +610,10 @@ Now you can create a build (either on command line or by setting these variables
570610

571611
5. Run the mobile app
572612
```
573-
./app/input.exe
613+
./app/MerginMaps.exe
574614
```
575615

576-
# 8. Common problems
616+
# 8. FAQ
577617

578618
- If you have "error: undefined reference to 'stdout'" or so, make sure that in BUILD ENV you have ANDROID_NDK_PLATFORM=android-24 or later!
579619
![image](https://user-images.githubusercontent.com/22449698/166630970-a776576f-c505-4265-b4c8-ffbe212c6745.png)
@@ -583,6 +623,7 @@ Now you can create a build (either on command line or by setting these variables
583623
- If images in feature forms are not getting loaded it's again probably problem with `QGIS_QUICK_DATA_PATH`
584624
- Use absolute path instead of relative path
585625
- Make sure it's targeting **build** directory
626+
- If using Visual Studio Code to configure and build the project, check the template in the `docs` folder.
586627

587628
# 9. Auto Testing
588629

@@ -600,4 +641,4 @@ TEST_API_PASSWORD=<your_password>
600641
```
601642

602643
Build binary, and you can run tests either with `ctest` or you can run individual tests by adding `--test<TestName>`
603-
e.g. ` ./input --testMerginApi`
644+
e.g. ` ./MerginMaps --testMerginApi`

docs/CMakePresets-Template.json

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 21,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "default",
11+
"hidden": true,
12+
"cacheVariables": {
13+
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../vcpkg/scripts/buildsystems/vcpkg.cmake",
14+
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
15+
"USE_MM_SERVER_API_KEY": "FALSE"
16+
}
17+
},
18+
{
19+
"name": "linux-debug",
20+
"displayName": "Linux Debug",
21+
"inherits": "default",
22+
"generator": "Ninja",
23+
"binaryDir": "${sourceDir}/../build-linux-debug",
24+
"cacheVariables": {
25+
"CMAKE_BUILD_TYPE": "Debug",
26+
"VCPKG_TARGET_TRIPLET": "x64-linux",
27+
"ENABLE_TESTS": "TRUE"
28+
}
29+
},
30+
{
31+
"name": "linux-release",
32+
"displayName": "Linux Release",
33+
"inherits": "default",
34+
"generator": "Ninja",
35+
"binaryDir": "${sourceDir}/../build-linux-release",
36+
"cacheVariables": {
37+
"CMAKE_BUILD_TYPE": "Release",
38+
"VCPKG_TARGET_TRIPLET": "x64-linux"
39+
}
40+
},
41+
{
42+
"name": "android-base",
43+
"hidden": true,
44+
"inherits": "default",
45+
"generator": "Ninja",
46+
"cacheVariables": {
47+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
48+
"ANDROID_ABI": "arm64-v8a",
49+
"QT_ANDROID_ABIS": "arm64-v8a",
50+
"VCPKG_TARGET_TRIPLET": "arm64-android",
51+
"VCPKG_INSTALL_OPTIONS": "--allow-unsupported",
52+
"QT_ANDROID_SIGN_APK": "Yes"
53+
},
54+
"environment": {
55+
"ANDROID_NDK_HOME": "<add_the_path_to_NDK_home>",
56+
"ANDROID_SDK_ROOT": "<add_the_path_to_SDK_root>",
57+
"QT_ANDROID_KEYSTORE_PATH": "<add_the_path_to_the_ketstore",
58+
"QT_ANDROID_KEYSTORE_ALIAS": "<add_the_keystore_alias>",
59+
"QT_ANDROID_KEYSTORE_STORE_PASS": "<add_the_keystore_password",
60+
"QT_ANDROID_KEYSTORE_KEY_PASS": "<add_the_key_password>"
61+
}
62+
},
63+
{
64+
"name": "android-linux",
65+
"displayName": "Android (Linux Host)",
66+
"inherits": "android-base",
67+
"binaryDir": "${sourceDir}/../build-android",
68+
"cacheVariables": {
69+
"VCPKG_HOST_TRIPLET": "x64-linux"
70+
}
71+
},
72+
{
73+
"name": "android-macos",
74+
"displayName": "Android (macOS Host - ARM)",
75+
"inherits": "android-base",
76+
"binaryDir": "${sourceDir}/../build-android",
77+
"cacheVariables": {
78+
"VCPKG_HOST_TRIPLET": "arm64-osx"
79+
},
80+
"environment": {
81+
"PATH": "$penv{PATH}:$env{HOMEBREW_PREFIX}/opt/flex/bin:$env{HOMEBREW_PREFIX}/opt/bison/bin:$env{HOMEBREW_PREFIX}/opt/gettext/bin:/Applications/CMake.app/Contents/bin"
82+
}
83+
},
84+
{
85+
"name": "android-macos-intel",
86+
"displayName": "Android (macOS Host - Intel)",
87+
"inherits": "android-base",
88+
"binaryDir": "${sourceDir}/../build-android",
89+
"cacheVariables": {
90+
"VCPKG_HOST_TRIPLET": "x64-osx"
91+
},
92+
"environment": {
93+
"PATH": "$penv{PATH}:$env{HOMEBREW_PREFIX}/opt/flex/bin:$env{HOMEBREW_PREFIX}/opt/bison/bin:$env{HOMEBREW_PREFIX}/opt/gettext/bin:/Applications/CMake.app/Contents/bin"
94+
}
95+
},
96+
{
97+
"name": "ios-release",
98+
"displayName": "iOS Release",
99+
"inherits": "default",
100+
"generator": "Xcode",
101+
"binaryDir": "${sourceDir}/../build-ios",
102+
"cacheVariables": {
103+
"CMAKE_BUILD_TYPE": "Release",
104+
"VCPKG_HOST_TRIPLET": "arm64-osx",
105+
"CMAKE_SYSTEM_PROCESSOR": "aarch64",
106+
"VCPKG_TARGET_TRIPLET": "arm64-ios",
107+
"ENABLE_BITCODE": "OFF",
108+
"ENABLE_ARC": "ON",
109+
"CMAKE_CXX_VISIBILITY_PRESET": "hidden",
110+
"CMAKE_SYSTEM_NAME": "iOS",
111+
"IOS": "TRUE"
112+
},
113+
"environment": {
114+
"PATH": "$penv{PATH}:$env{HOMEBREW_PREFIX}/opt/flex/bin:$env{HOMEBREW_PREFIX}/opt/bison/bin:$env{HOMEBREW_PREFIX}/opt/gettext/bin:/Applications/CMake.app/Contents/bin"
115+
}
116+
},
117+
{
118+
"name": "macos-debug-arm",
119+
"displayName": "macOS Debug (Apple Silicon)",
120+
"inherits": "default",
121+
"generator": "Ninja",
122+
"binaryDir": "${sourceDir}/../build-macos",
123+
"cacheVariables": {
124+
"CMAKE_BUILD_TYPE": "Debug",
125+
"VCPKG_TARGET_TRIPLET": "arm64-osx",
126+
"ENABLE_TESTS": "TRUE"
127+
},
128+
"environment": {
129+
"PATH": "$penv{PATH}:$env{HOMEBREW_PREFIX}/opt/flex/bin:$env{HOMEBREW_PREFIX}/opt/bison/bin:$env{HOMEBREW_PREFIX}/opt/gettext/bin:/Applications/CMake.app/Contents/bin"
130+
}
131+
},
132+
{
133+
"name": "macos-release-arm",
134+
"displayName": "macOS Release (Apple Silicon)",
135+
"inherits": "default",
136+
"generator": "Ninja",
137+
"binaryDir": "${sourceDir}/../build-macos-release",
138+
"cacheVariables": {
139+
"CMAKE_BUILD_TYPE": "Release",
140+
"VCPKG_TARGET_TRIPLET": "arm64-osx"
141+
},
142+
"environment": {
143+
"PATH": "$penv{PATH}:$env{HOMEBREW_PREFIX}/opt/flex/bin:$env{HOMEBREW_PREFIX}/opt/bison/bin:$env{HOMEBREW_PREFIX}/opt/gettext/bin:/Applications/CMake.app/Contents/bin"
144+
}
145+
},
146+
{
147+
"name": "macos-debug-intel",
148+
"displayName": "macOS Debug (Intel)",
149+
"inherits": "default",
150+
"generator": "Ninja",
151+
"binaryDir": "${sourceDir}/../build-macos-debug",
152+
"cacheVariables": {
153+
"CMAKE_BUILD_TYPE": "Debug",
154+
"VCPKG_TARGET_TRIPLET": "x64-osx",
155+
"ENABLE_TESTS": "TRUE"
156+
},
157+
"environment": {
158+
"PATH": "$penv{PATH}:$env{HOMEBREW_PREFIX}/opt/flex/bin:$env{HOMEBREW_PREFIX}/opt/bison/bin:$env{HOMEBREW_PREFIX}/opt/gettext/bin:/Applications/CMake.app/Contents/bin"
159+
}
160+
},
161+
{
162+
"name": "macos-release-intel",
163+
"displayName": "macOS Release (Intel)",
164+
"inherits": "default",
165+
"generator": "Ninja",
166+
"binaryDir": "${sourceDir}/../build-macos-release",
167+
"cacheVariables": {
168+
"CMAKE_BUILD_TYPE": "Release",
169+
"VCPKG_TARGET_TRIPLET": "x64-osx"
170+
},
171+
"environment": {
172+
"PATH": "$penv{PATH}:$env{HOMEBREW_PREFIX}/opt/flex/bin:$env{HOMEBREW_PREFIX}/opt/bison/bin:$env{HOMEBREW_PREFIX}/opt/gettext/bin:/Applications/CMake.app/Contents/bin"
173+
}
174+
},
175+
{
176+
"name": "windows-debug",
177+
"displayName": "Windows Debug",
178+
"inherits": "default",
179+
"generator": "Visual Studio 17 2022",
180+
"architecture": "x64",
181+
"binaryDir": "${sourceDir}/../build-windows-debug",
182+
"cacheVariables": {
183+
"CMAKE_BUILD_TYPE": "Debug",
184+
"VCPKG_TARGET_TRIPLET": "x64-windows",
185+
"ENABLE_TESTS": "TRUE"
186+
}
187+
},
188+
{
189+
"name": "windows-release",
190+
"displayName": "Windows Release",
191+
"inherits": "default",
192+
"generator": "Visual Studio 17 2022",
193+
"architecture": "x64",
194+
"binaryDir": "${sourceDir}/../build-windows-release",
195+
"cacheVariables": {
196+
"CMAKE_BUILD_TYPE": "Release",
197+
"VCPKG_TARGET_TRIPLET": "x64-windows"
198+
}
199+
}
200+
],
201+
"buildPresets": [
202+
{
203+
"name": "linux-debug",
204+
"configurePreset": "linux-debug"
205+
},
206+
{
207+
"name": "linux-release",
208+
"configurePreset": "linux-release"
209+
},
210+
{
211+
"name": "android-linux",
212+
"configurePreset": "android-linux"
213+
},
214+
{
215+
"name": "android-macos",
216+
"configurePreset": "android-macos"
217+
},
218+
{
219+
"name": "ios-release",
220+
"configurePreset": "ios-release"
221+
},
222+
{
223+
"name": "macos-debug-arm",
224+
"configurePreset": "macos-debug-arm"
225+
},
226+
{
227+
"name": "macos-release-arm",
228+
"configurePreset": "macos-release-arm"
229+
},
230+
{
231+
"name": "windows-debug",
232+
"configurePreset": "windows-debug",
233+
"configuration": "Debug"
234+
},
235+
{
236+
"name": "windows-release",
237+
"configurePreset": "windows-release",
238+
"configuration": "Release"
239+
}
240+
]
241+
}

0 commit comments

Comments
 (0)