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