Skip to content

Commit c177f56

Browse files
committed
Add example
1 parent bd22c79 commit c177f56

40 files changed

+3761
-0
lines changed

example/FelgoCV/CMakeLists.txt

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(FelgoCV VERSION 0.1 LANGUAGES CXX)
4+
5+
set(CMAKE_AUTOMOC ON)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
8+
find_package(Felgo REQUIRED)
9+
10+
# Project identifier and version
11+
# More information: https://felgo.com/doc/felgo-publishing/#project-configuration
12+
set(PRODUCT_IDENTIFIER "com.yourcompany.wizardEVAP.FelgoCV")
13+
set(PRODUCT_VERSION_NAME "1.0.0")
14+
set(PRODUCT_VERSION_CODE 1)
15+
16+
# Set either "test" or "publish" stage:
17+
set(PRODUCT_STAGE "test")
18+
19+
# Optionally set a license key that is used instead of the license key from
20+
# main.qml file (App::licenseKey for your app or GameWindow::licenseKey for your game)
21+
# Only used for local builds and Felgo Cloud Builds (https://felgo.com/cloud-builds)
22+
# Not used if using Felgo Live
23+
set(PRODUCT_LICENSE_KEY "")
24+
25+
set(FELGO_PLUGINS
26+
)
27+
28+
# Find all QML/JS files for the QML compiler:
29+
file(GLOB_RECURSE QmlFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} qml/*.qml qml/*.js)
30+
31+
# Find all non-QML/JS files in the qml and assets folder to add as resources:
32+
file(GLOB_RECURSE AssetsFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} assets/* qml/*)
33+
list(REMOVE_ITEM AssetsFiles ${QmlFiles})
34+
35+
36+
37+
38+
qt_add_executable(appFelgoCV
39+
main.cpp
40+
${QmlFiles}
41+
${AssetsFiles}
42+
)
43+
44+
45+
46+
felgo_configure_executable(appFelgoCV)
47+
48+
# Deploy resources to build folder/package directly
49+
# comment for publishing
50+
deploy_resources("${QmlFiles};${AssetsFiles}")
51+
52+
# Add QML files and resources to QML module to included them via QRC automatically:
53+
qt_add_qml_module(appFelgoCV
54+
URI FelgoCV
55+
VERSION 1.0
56+
# uncomment for publishing:
57+
# QML_FILES ${QmlFiles}
58+
# RESOURCES ${AssetsFiles}
59+
NO_RESOURCE_TARGET_PATH
60+
)
61+
62+
add_subdirectory(ocvdecoder ${CMAKE_BINARY_DIR}/ocvdecoder)
63+
64+
65+
# NOTE: for PUBLISHING, perform the following steps:
66+
# 1. comment the deploy_resources line above, to avoid shipping your qml files with the application (instead they get compiled to the app binary)
67+
# 2. uncomment the QML_FILES and RESOURCES above; this compiles your qml files and js files to the app binary and protects your source code
68+
# 3. change the setMainQmlFile() call in main.cpp to the one starting with "qrc:/" - this loads the qml files from the resources
69+
# for more details see the "Deployment Guides" in the Felgo Documentation
70+
71+
# during development, use the deploy_resources because you then get shorter compilation times (the qml files do not need to be compiled to the binary but are just copied)
72+
# also, for quickest deployment on Desktop disable the "Shadow Build" option in Projects/Builds - you can then select "Run Without Deployment" from the Build menu in Qt Creator if you only changed QML files; this speeds up application start, because your app is not copied & re-compiled but just re-interpreted
73+
74+
target_compile_definitions(appFelgoCV
75+
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
76+
77+
target_link_libraries(appFelgoCV PRIVATE Felgo ocvdecoder)
78+
79+
target_include_directories(appFelgoCV PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/opencv/include/)
80+
81+
#target_link_libraries(appFelgoCV PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor/opencv/ios/libfatstatic.a)
82+
83+
84+
85+
# uncomment this line to add the Live Client Module and use live reloading with your custom C++ code
86+
# for the remaining steps to build a custom Live Code Reload app see here: https://felgo.com/custom-code-reload-app/
87+
#find_package(FelgoLive REQUIRED)
88+
#target_link_libraries(appFelgoCV PRIVATE FelgoLive)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0"?>
2+
<manifest package="com.yourcompany.wizardEVAP.FelgoCV" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
3+
<application android:allowNativeHeapPointerTagging="false" android:hardwareAccelerated="true" android:extractNativeLibs="true" android:name="com.felgo.helper.FelgoApplication" android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
4+
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="com.felgo.helper.FelgoActivity" android:exported="true" android:launchMode="singleTop" android:label="@string/app_name" android:screenOrientation="sensor">
5+
<intent-filter>
6+
<action android:name="android.intent.action.MAIN"/>
7+
<category android:name="android.intent.category.LAUNCHER"/>
8+
</intent-filter>
9+
<!-- Qt internal meta data -->
10+
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
11+
<meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
12+
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
13+
</activity>
14+
<!-- file provider needed for letting external apps (like camera) write to a file of the app -->
15+
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
16+
17+
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/>
18+
</provider>
19+
</application>
20+
21+
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
22+
23+
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
24+
Remove the comment if you do not require these default permissions. -->
25+
<!-- %%INSERT_PERMISSIONS -->
26+
27+
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
28+
Remove the comment if you do not require these default features. -->
29+
<!-- %%INSERT_FEATURES -->
30+
31+
</manifest>

example/FelgoCV/android/build.gradle

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
7+
dependencies {
8+
classpath "com.android.tools.build:gradle:${androidGradleToolsVersion}"
9+
}
10+
}
11+
12+
allprojects {
13+
repositories {
14+
google()
15+
mavenCentral()
16+
maven { url 'https://install.felgo.com/maven/' }
17+
}
18+
}
19+
20+
apply plugin: 'com.android.application'
21+
22+
dependencies {
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
25+
implementation "androidx.appcompat:appcompat:1.2.0"
26+
27+
28+
}
29+
30+
android {
31+
/*******************************************************
32+
* The following variables:
33+
* - androidBuildToolsVersion,
34+
* - androidCompileSdkVersion
35+
* - qt5AndroidDir - holds the path to qt android files
36+
* needed to build any Qt application
37+
* on Android.
38+
*
39+
* are defined in gradle.properties file. This file is
40+
* updated by QtCreator and androiddeployqt tools.
41+
* Changing them manually might break the compilation!
42+
*******************************************************/
43+
44+
compileSdkVersion androidCompileSdkVersion.toInteger()
45+
buildToolsVersion androidBuildToolsVersion
46+
47+
compileOptions {
48+
sourceCompatibility 1.8
49+
targetCompatibility 1.8
50+
}
51+
52+
defaultConfig {
53+
multiDexEnabled true
54+
targetSdkVersion androidCompileSdkVersion.toInteger()
55+
applicationId = productIdentifier
56+
versionCode = productVersionCode.toInteger()
57+
versionName = productVersionName
58+
minSdkVersion = project.hasProperty("qtMinSdkVersion") ? qtMinSdkVersion.toInteger() : 23
59+
60+
}
61+
62+
sourceSets {
63+
main {
64+
manifest.srcFile 'AndroidManifest.xml'
65+
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
66+
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
67+
res.srcDirs = [qt5AndroidDir + '/res', 'res']
68+
resources.srcDirs = ['src']
69+
renderscript.srcDirs = ['src']
70+
assets.srcDirs = ['assets']
71+
jniLibs.srcDirs = ['libs']
72+
}
73+
}
74+
75+
lintOptions {
76+
abortOnError false
77+
}
78+
aaptOptions { // Do not compress Qt binary resources file
79+
noCompress 'rcc'
80+
}
81+
tasks.withType(JavaCompile) {
82+
options.incremental = true
83+
}
84+
}
85+
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">FelgoCV</string>
4+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<paths>
3+
<!-- the FileProvider allows other apps to access files of this app
4+
5+
this maps a file URI to a content URI:
6+
file://<path>/<file>
7+
mapped to:
8+
content://<package-name>.fileprovider/<path-name>/<file>
9+
only the content: URI can be used by external apps like the camera (when targetSdkVersion >= 24)
10+
11+
there are different types of paths that can be mapped:
12+
13+
- NativeUtils.displayCameraPicker() stores the taken picture to the external Pictures directory
14+
- for this, the first entry is necessary.
15+
16+
- add the paths you want to use with NativeUtils.openUrl() below:
17+
- <files-path ...> for FileUtils.DesktopLocation and others
18+
- <cache-path ...> for FileUtils.CacheLocation and others
19+
- <external-path ...> for most other FileUtils locations
20+
- the others are only necessary when using a custom URL
21+
-->
22+
23+
<!-- the path for NativeUtils.displayCameraPicker() -->
24+
<external-files-path name="images" path="Pictures"/>
25+
26+
<!-- app internal cache used with NativeUtils.storeContacts() and FileUtils.CacheLocation: /data/data/<package-name>/cache/<file> -->
27+
<cache-path name="cache" path="."/>
28+
29+
<!-- app internal files, used with FileUtils.DesktopLocation and others: /data/data/<package-name>/files/<file> -->
30+
<files-path name="files" path="."/>
31+
32+
<!-- external files belonging to the app, used with most FileUtils locations: /sdcard/android/arm64-v8adata/<package-name>/files/<file> -->
33+
<!--<external-files-path name="external-files" path="."/>-->
34+
35+
<!-- external cache files belonging to the app: sdcard/android/arm64-v8adata/<package-name>/cache/<file> -->
36+
<!--<external-cache-path name="external-cache" path="."/>-->
37+
38+
<!-- global external files: /sdcard/android/arm64-v8a<file> -->
39+
<!--<external-path name="external" path="."/>-->
40+
41+
</paths>
943 KB
Binary file not shown.

0 commit comments

Comments
 (0)