You can configure CLion to build on Android by following these steps:
Install the standalone NDK toolkit ( https://developer.android.com/ndk/guides/standalone_toolchain.html )
In the "Settings / Settings CLion" section of the "Assembly, Execution, Deployment> Tool Bundles" section, add a new tool chain for ARM, set the C compiler path to $ NDK_TOOLCHAIN_PATH / arm / bin / arm-linux-androideabi-clang, for the path the C ++ compiler, set the value to $ NDK_TOOLCHAIN_PATH / arm / bin / arm-linux-androideabi-clang ++, and if you're on Windows, set the MinGW path. The toolchain tab is a fairly new feature for Clion, so make sure you have the latest version of Clion installed.
Repeat step 2 for any other architectures you want to support.
Go to Create, Run, Deploy> CMake. Add a new profile for ARM. Install the toolkit for the ARM toolkit and set the CMake parameters to
-DCMAKE_CXX_FLAGS = "-fPIE -fPIC -lstd C ++"
-DCMAKE_AR = "$ NDK_TOOLCHAIN_PATH / shoulder / bin / link Linux-androideabi-ar"
-DCMAKE_RANLIB = "$ NDK_TOOLCHAIN_PATH / shoulder / bin / link Linux-androideabi-ranlib"
If you are using a Mac, you will need them too so that CMake does not use the isysroot option
-DCMAKE_OSX_SYSROOT = "/"
-DCMAKE_OSX_DEPLOYMENT_TARGET = ""
- Repeat step 4 for any other architectures that you want to support.
When building, install the profile on the architecture you need (instead of Debug / Release).
Ideally, you can specify the entire tool chain (ar, ranlib, etc.) Through CLion instead of using CMake options, but I have not yet found a way to do this.
source share