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