Crosscompiling (Android and iOS)#
AUI provides the unified way to cross-compile your application with AUI_BUILD_FOR CMake configure variable. When
specified, CMake does the whole configure routine as if the project is compiled for the host system but it generates
extra project directory for the target platform's development environment once the apps
target is invoked.
To build target platform's final application package, run build the apps
target.
Workflow#
Android:
mkdir build # or whatever name
cd build
cmake -DAUI_BUILD_FOR=android ..
cmake --build . -t apps
iOS:
mkdir build # or whatever name
cd build
cmake -DAUI_BUILD_FOR=ios ..
cmake --build . -t apps
These commands produce an Android Studio/Xcode project in build/app_project
directory and build it. You can now
open it in Android Studio/Xcode to upload the application to your device and debug. Both support C++, so you can
continue development of your app there.
Supported platforms#
AUI_BUILD_FOR value |
Host platform | Target platform | Project environment | Project dir |
---|---|---|---|---|
android |
Windows Linux macOS | Android | Gradle (can be opened with Android Studio) | ${CMAKE_BINARY_DIR}/app_project |
ios |
macOS | iOS | Xcode | ${CMAKE_BINARY_DIR}/app_project |
Limitations#
- Variables defined in the configure step (including the ones specified with command line by
-DVAR=VALUE
syntax) are not forwarded to the child CMake configure process. To bypass the limitation, useauib_mark_var_forwardable(VAR)
function, whereVAR
is your variable name. - As like CMake's generated projects, the projects generated by AUI are not portable too.