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 6CMakeLists.txt project file generation is enabled via environment variable: 7 8```bash 9$ export SOONG_GEN_CMAKEFILES=1 10$ export SOONG_GEN_CMAKEFILES_DEBUG=1 11``` 12 13You can then trigger a full build: 14 15```bash 16$ make -j64 17``` 18or build only the project you are interested in: 19 20```bash 21$ make frameworks/native/service/libs/ui 22``` 23 24Projects are generated in the ``out`` directory. In the case of libui, the path would 25be: 26 27```bash 28out/development/ide/clion/frameworks/native/libs/ui/libui-arm64-android/CMakeLists.txt 29``` 30Note: The generator creates one folder per targetname-architecture-os combination. 31In the case of libui you endup with two projects: 32 33```bash 34$ ls out/development/ide/clion/frameworks/native/libs/ui 35libui-arm64-android libui-arm-android 36``` 37 38### Edit multiple projects at once 39To combine several projects into one, you can create super projects 40and place them in: 41 42```bash 43development/ide/clion/[PATH_YOU_WANT]/.. 44``` 45 46These file will be symbolicaly linked in ``out/development/ide/clion``. All folders 47will also be created there. 48 49An example of a super project for surfaceflinger (using libui and libgui) 50located in development/ide/clion/frameworks/native: 51 52``` 53cmake_minimum_required(VERSION 3.6) 54project(native) 55add_subdirectory(services/surfaceflinger) 56add_subdirectory(libs/ui/libui-arm64-android) 57add_subdirectory(libs/gui/libgui-arm64-android) 58``` 59 60 61### Flattened filesystem 62 63Upon opening a project it looks like all the folder structure has been 64flattened: 65 66![Flattened View](before.png "") 67 68This is because you need to change the project root. Via Tools > CMake > 69Change Project Root: 70 71![Unflattened View](after.png "") 72 73