KBT is a build tool for Karma project based on cmake.
KBT supply a method to generate project based on cmake. It also can help us manage dependencies and make build process easily.
- cmake
- git
Clone KBT:
git clone http://github.com/tiannian/KBT
Execute CMake script
cd KBT
sudo cmake .
Then you can delete KBT folder.
- Create project folder and create CMakeLists.txt.
mkdir sample
touch CMakeLists.txt
- Configure this project through CMakeLists.txt. You must include KBT module first in CMakeList.txt.
include(KBT)
KBT_PROJECT(sample)
# .... some other configuration ...
- Create build folder and do first running.
mkdir build
cd build
cmake ..
- The project structure will be founded automatically. KBT will download all dependencies from github.
-- src/
-- include/
-- test/
-- dependencies/
-- build/
-- CMakeLists.txt
-- sample.config
-- .gitigrone
According cmake suggestion, please build project in build folder.
cd build
cmake ..
make
INCLUDE (KBT)
cmake_minimum_required(VERSION 3.5)
KBT_PROJECT(sample)
KBT_SET_ARCH(xtensel)
KBT_SET_PLATFORM(esp8266)
KBT_SET_PROJECT_TYPE(lib)
KBT_CONFIG()
This function will set KBT_ARCH
variable. KBT is according to this variable to decide compiler. It will be download related toolchain automatically.
You can choose the following KBT_ARCH
value.
- x86
- arm
- avr
- mips
- xtensel
If this value is *
, KBT will fill this variable by current architecture.
This function will set KBT_PLATFORM
variable. KBT is according to this variable to set some dependencies.
You can choose the following KBT_PLATFORM
value.
- General
- Mingw
- Linux
- Macos
- Android
- Arduino
- ESP8266
- ESP32
If this value is *
, KBT will fill this variable by current system.
This function will set KBT_${PROJECT_NAME}_TYPE
variable. You can choose the following KBT_PROJECT_TYPE
value.
- bin
- lib
If KBT_PROJECT_TYPE
is bin
, KBT will be link all dependencies in binary.
If KBT_PROJECT_TYPE
is lib
, KBT will not be link all dependencies in library.
This function will add dependencies peoject and clone it from github.
The first arguments is <auther>/<project-name>
The second arguments is version. (Not available at this time).
Execute this function in the end of CMakeLists.txt script.