We provide you with an Android demo app to showcase 3 pipelines: fiducial and natural image marker-based pipelines and a SLAM.
SolAR Demo (Fiducial, Natural, SLAM) |
You will find the required markers for you to print on the link above. |
The SolAR framework uses a dedicated pipeline to link and compile code as well as internal tools for third party downloads which should make your job much easier. As you will see later, the SolAR framework is based on QMake originally created by the Qt Company, but compliant with most IDE.
Do not forget to install Qt Android component. SolAR supports arm64-v8a architecture only. |
It is recommended to install IDE for your own OS to test directly your pipeline on your system and then compile it for Android |
Once Qt Creator installed we can install dependencies required by Qt Creator for Android :
We recommend you to install this dependencies using Unity Android build support module (available from Unity HUB, see build support) Otherwise you can also directly download the dependencies in Qt Creator from SDKManager in Android tab of Tools>Options>Devices
|
You can find more information in Qt documentation : Android building
In Qt Creator navigation bar go to Tools > Options > Devices
.
Then fill required path and check if your Android kit is valid :
You need to configure your Remaken profile according to your development environment. To do so, run the following command in a command prompt:
remaken profile init --cpp-std 17 -b clang -o android -a arm64-v8a
You can check if the change have been done in your Remaken profile using :
remaken profile display
As we are using Conan to download dependencies, you need to configure your default conan profile. To do so, open the default file available in your ${HOME}/.conan/profiles
, and replace the configuration by the following one before saving it:
[settings] os=Android os_build=Linux arch=armv8 arch_build=x86_64 compiler=clang compiler.version=8 compiler.libcxx=libc++ build_type=Release os.api_level=21 compiler.cppstd=17 [options] [build_requires] [env]
os_build should match your OS (Windows or Linux) |
Now, you are ready to download your dependencies with Remaken.
Remaken uses a file called packagedependencies.txt to describe which depedencies to install, in which version, where to install them, where to download them, with which package manager and with which configuration.
A global packagedepedencies.txt defining the common dependencies with specific packagedependencies_os.txt files defining dependencies which are specific for each os are available in the parent GIT repository SolAR, and can be downloaded on the following link:
Copy these files where you want on your computer, open a command prompt in the folder where you have copied the packagedependencies.txt and packagedependencies_os.txt files, and run remaken with the following command:
remaken install packagedependencies.txt
This command will install all SolAR dependencies in release mode.
To download the dependencies in debug mode, run the following command:
remaken install -c debug packagedependencies.txt
This is done, all your dependencies are downloaded and ready to use ! Some of the module will download and build third parties using Conan which requires CMake (minimum version 3.10).
SolAR is made up of a multitude of projects (SolAR Framework, SolAR pipeline manager, modules, samples, etc.). To help you, we have created a parent repository with sub-modules regrouping all source codes of SolAR projects. You can clone it from the following url: https://github.com/SolarFramework/SolAR.git
No space in the path of the folder where you are cloning SolAR ! |
git clone https://github.com/SolarFramework/SolAR.git
Do not forget to install and update recursively the submodules:
cd SolAR git submodule update --init --recursive
If you want to move all submodules on Master, launch the following command
git submodule foreach git pull origin master
If you do not want to download all the source codes of SolAR, you can have a look to the different repositories available on Github on the Community/Git page.
Counting the framework, the pipeline manager, modules, module tests, samples, pipelines, pipeline tests, there are more than 60 QT projects on GitHub. In order to ease the building of all this projects, they are grouped in the following parent QT projects available into the root folder of SolAR:
SolARCore
SolARAllModules
SolARAllModulesTests
SolARAllSamples
SolARAllPipelines
SolARAllPipelineTests
You can open one of them or all in QT Creator.
Check by clicking on the Projects
tab, and then on the Manage Kits…
button that your Qt x.x.x Android for arm64-v8a kit is well configured
Now, you have to configure your parent project before building them. In your project build settings of your kit, for each configuration (release and debug), add the following argument to the Builds Steps > Make step:
SolARCore: install
SolARAllModules: install
and install_deps
SolARAllModulesTests: install
and install_deps
SolARAllSamples: install
and install_deps
SolARAllPipelines: install
SolARAllPipelineTests: install
and install_deps
The install
step will copy the built binaries into ${HOME}/.remaken/packages, and the install_deps
step will also copy its dependencies.
Disable step Make install and Build Android APK
|
Since QT Creator 4.14.0, we highly recommand to set the project option qmake system() behavior when parsing to Ignore to highly reduce the project loading time. But do not forget to run qmake on projects before building them.
|
If you open several projects, you will have to set their build order. You can do it in QT Creator by defining the dependencies of each project in the Projects
menu, select your project, click and Dependencies, and check the projects that depend directly on the selected project (checking `Synchronize configuration' will synchronize all projects in Debug or Release configuration).
Project | Project dependencies |
---|---|
SolARAllModules |
SolARCore |
SolARAllModulesTests |
SolARAllModules |
SolARAllPipelines |
SolARAllModules |
SolARAllPipelineTests |
SolARAllPipelines |
SolARAllSamples |
SolARAllModules |
SolARCore |
No dependency |
If you have not yet run a qmake on each project, some error could appear concerning the fact thta conanbuildinfo.pri files do not exist. This is normal, run qmake on each project will create these files, and the error message will no longer appear.
|
Then, in the Build
menu, click on Rebuild All Projects for All Configurations
, and go get a cup of coffee.
Now your shared libraries can be use as a SolAR module in Unity to build an Android application.
To build a SolAR Android application you need to have Android build support module installed.
Set your Unity Android environment. Then you need to set your current target platform of Unity Editor File > Build settings
to Android. In the player settings you must specify a package name (ex : com.company.appname) and set the configuration to support SolAR Framework.
SolAR modules provide support for AArch64 instruction sets through Application Binary Interface arm64-v8a. This is the most common architecture used by Android devices. |
Now you can import your SolAR modules and their dependencies in your Unity project in the dedicated directory ./Assets/Plugins/Android/
.
If you haven’t build or download modules and dependencies for Android, execute ./plugin/unity/SolARUnityPlugin/Install.bat
.
Otherwise you could simply execute ./plugin/unity/SolARUnityPlugin/Bundle.bat
to bundle .so of your Remaken packages and wrap SWIG.
You cannot directly test your pipeline in Unity Editor with modules built for Android. It is recommended to develop for your OS in a first time and then provide your module for Android. |
Congratulation, your configuration is ready to use and you can build your .apk with Unity to play it on your Android device. If necessary you can set Unity build settings options and use ADB to debug your app.
Moreover you can edit your pipeline configuration on your device. XML is stored in your public path of the application in your internal memory (ie : /storage/emulated/0/Android/data/com.company.appname/files/StreamingAssets/SolAR/Pipelines/*.xml
)
You can find more information for SolAR Android Unity pipeline in Unity Android Deployment