1# CLion project generator 2 3Soong can generate CLion projects. This is intended for source code editing 4only. Build should still be done via make/m/mm(a)/mmm(a). 5 6Note: alternatively, you can use 7[aidegen to generate a Clion or VSCode project](https://android.googlesource.com/platform/tools/asuite/+/refs/heads/main/aidegen/README.md) 8with a single command, using the `-i c` flag. 9 10CMakeLists.txt project file generation is enabled via environment variable: 11 12```bash 13$ export SOONG_GEN_CMAKEFILES=1 14$ export SOONG_GEN_CMAKEFILES_DEBUG=1 15``` 16 17You can then trigger a full build: 18 19```bash 20$ make -j64 21``` 22or build only the project you are interested in: 23 24```bash 25$ make frameworks/native/service/libs/ui 26``` 27 28Projects are generated in the ``out`` directory. In the case of libui, the path would 29be: 30 31```bash 32out/development/ide/clion/frameworks/native/libs/ui/libui-arm64-android/CMakeLists.txt 33``` 34Note: The generator creates one folder per targetname-architecture-os combination. 35In the case of libui you endup with two projects: 36 37```bash 38$ ls out/development/ide/clion/frameworks/native/libs/ui 39libui-arm64-android libui-arm-android 40``` 41 42### Edit multiple projects at once 43To combine several projects into one, you can create super projects 44and place them in: 45 46```bash 47development/ide/clion/[PATH_YOU_WANT]/.. 48``` 49 50These file will be symbolicaly linked in ``out/development/ide/clion``. All folders 51will also be created there. 52 53An example of a super project for surfaceflinger (using libui and libgui) 54located in development/ide/clion/frameworks/native: 55 56``` 57cmake_minimum_required(VERSION 3.6) 58project(native) 59add_subdirectory(services/surfaceflinger) 60add_subdirectory(libs/ui/libui-arm64-android) 61add_subdirectory(libs/gui/libgui-arm64-android) 62``` 63 64 65### Flattened filesystem 66 67Upon opening a project it looks like all the folder structure has been 68flattened: 69 70 71 72This is because you need to change the project root. Via Tools > CMake > 73Change Project Root: 74 75 76 77