This repo has another copy in gitee url = https://gitee.com/wangben85/CMake_IAR_Template.git
This is the project template to use CMake, IAR and Ninja build. Based on NXP TWR-KW24D512
##What is ninja build?## Ninja is a small build system with a focus on speed. It is designed to have its input files generated by a higher-level build system, and it is designed to run builds as fast as possible.
##Environment setup requirement## -Ninja build (There is a minimal version requirement, I am using the version v1.9.0) Where to download ninja https://ninja-build.org, currently use the version v1.9.0
-CMake (There is a minimal version requirement, I am using the version of 3.7.2 instead of the latest version) Where to download Cmake https://cmake.org/files/v3.7/
-C++11
-python3.6.5
-IAR Embedded Workbench 8.30
##Setup## 1.Run python script "create_build_dirs.py" with python 3.6 or python 3.7. Python.exe create_build_dirs_py
2.Run ninja build with below command ninja -C release # it is for release build or ninja -C debug # it is for debug build
3.hello_world.bin will be generated under C:\Other_Code_Repo\CMake_IAR_Template\TWR-KW24D512\boards\twrkw24d512\demo_apps\hello_world\iar\debug\Exe and C:\Other_Code_Repo\CMake_IAR_Template\TWR-KW24D512\boards\twrkw24d512\demo_apps\hello_world\iar\release\Exe
##Update&Modify## a. Build configuration change In python script "create_build_dirs.py", there is a cmds dictionary which contents configuration Vs. cmake commands. In our case, we use ninja build to get better speed.
b. Adding files to project There are two places we need to maintain, one is "project_sources.cmake". Whenever we add a new source file to project, we need to add reference to APP_SOURCE_FILES set in project_sources.cmake. If we add new folder to project, we need to update APP_INCLUDE_DIRS set in project_sources.cmake.
c. Other related files -toolchain_iar.cmake: Configure the build toolchain for project, if we want to adapt this framework to other projects, this file needs update accordingly.