1b1994897Sopenharmony_ci## Basic build using CMake 2b1994897Sopenharmony_ci 3b1994897Sopenharmony_ciPanda libraries can be built using CMake: 4b1994897Sopenharmony_ci``` 5b1994897Sopenharmony_ci$ mkdir build 6b1994897Sopenharmony_ci$ cd build 7b1994897Sopenharmony_ci$ cmake ${panda_dir} 8b1994897Sopenharmony_ci$ make 9b1994897Sopenharmony_ci``` 10b1994897Sopenharmony_ci 11b1994897Sopenharmony_ciWhere ${panda_dir} is a path to panda dirrectory. 12b1994897Sopenharmony_ciThese steps will create libraries and some debug targets (if you have installed additional libraries, like google-test, clang-format, clang-tidy, etc.). 13b1994897Sopenharmony_ci 14b1994897Sopenharmony_ci## Build directory structure 15b1994897Sopenharmony_ci 16b1994897Sopenharmony_ciIn the current build directory structure, each project has its own subdirectory. For example, the vixl library is located inside the `third_party/vixl` folder. The root CMakeLists.txt has an entry for this directory: 17b1994897Sopenharmony_ci``` 18b1994897Sopenharmony_ciadd_subdirectory(third_party/vixl) 19b1994897Sopenharmony_ci``` 20b1994897Sopenharmony_ciYou may use built libraries in your component (e.g., `target_link_libraries(tests compiler base vixl)`), but for getting variables please use the INTERFACE includes (e.g. `target_include_directories(INTERFACE .)`). 21b1994897Sopenharmony_ci 22b1994897Sopenharmony_ci 23b1994897Sopenharmony_ci## Check style 24b1994897Sopenharmony_ci 25b1994897Sopenharmony_ciTo check style, build the project and then also build style-checker targets (you must install clang-format and clang-tidy with libraries - look at scripts/bootstrap*.sh): 26b1994897Sopenharmony_ci``` 27b1994897Sopenharmony_ci$ make clang_format 28b1994897Sopenharmony_ci Built target clang_format_opt_tests_graph_creation_test.cpp 29b1994897Sopenharmony_ci Built target clang_format_opt_opt.h 30b1994897Sopenharmony_ci ... 31b1994897Sopenharmony_ci 32b1994897Sopenharmony_ci$ make clang_tidy 33b1994897Sopenharmony_ci Scanning dependencies of target copy_json 34b1994897Sopenharmony_ci Move compile commands to root directory 35b1994897Sopenharmony_ci ... 36b1994897Sopenharmony_ci Built target copy_json 37b1994897Sopenharmony_ci Scanning dependencies of target clang_tidy_opt_codegen_codegen.cpp 38b1994897Sopenharmony_ci ... 39b1994897Sopenharmony_ci``` 40b1994897Sopenharmony_ci 41b1994897Sopenharmony_ciYou may force fixes for clang-format issues, with the `make clang_force_format` command. 42b1994897Sopenharmony_ciRun `make help | grep clang` to see all possible clang-[format|style] targets. 43b1994897Sopenharmony_ciFor example, to check style issues in the opt.cpp file, you can use corresponding clang-format target (`make clang_format_opt_opt.cpp`) or the clang-tidy one (`make clang_tidy_opt_opt.cpp`). To force clang-format code style - `make clang_force_format_opt_opt.cpp`. 44b1994897Sopenharmony_ciTo check code-style through just one check-system - use `make clang_tidy` or `make clang_format`. 45b1994897Sopenharmony_ci 46b1994897Sopenharmony_ciGenerated files: 47b1994897Sopenharmony_ci* `compile_commands.json` - json nija-commands file to correct execution clang-tidy. 48b1994897Sopenharmony_ci* Standard cmake-files: `CMakeCache.txt`, `Makefile`, `cmake_install.cmake` and `CMakeFiles` folder. 49b1994897Sopenharmony_ci 50b1994897Sopenharmony_ci[Coding style](../docs/coding-style.md) 51b1994897Sopenharmony_ci 52b1994897Sopenharmony_ci* Clang-tidy style file - `.clang-tidy` 53b1994897Sopenharmony_ci* Clang-format style file - `.clang-format` 54b1994897Sopenharmony_ci* Script to show diff through clang-format execution - `scripts/run-clang-format.py` 55b1994897Sopenharmony_ci 56