All Projects → Neutree → C_cpp_project_framework

Neutree / C_cpp_project_framework

Licence: mit
CMake build system( framework) with kconfig support for C/CPP projects

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
cpp
1120 projects

Projects that are alternatives of or similar to C cpp project framework

Rebar3
Erlang build tool that makes it easy to compile and test Erlang applications and releases.
Stars: ✭ 1,295 (+4880.77%)
Mutual labels:  build, compile, template
Asynctasks.vim
🚀 Modern Task System for Project Building, Testing and Deploying !!
Stars: ✭ 495 (+1803.85%)
Mutual labels:  cmake, build, make
Zeus
An Electrifying Build System
Stars: ✭ 176 (+576.92%)
Mutual labels:  build, make, project
Arduino Cmake Ng
CMake-Based framework for Arduino platforms
Stars: ✭ 123 (+373.08%)
Mutual labels:  cmake, build, make
python-makefun
Dynamically create python functions with a proper signature.
Stars: ✭ 62 (+138.46%)
Mutual labels:  compile, make
rebuild
Zero-dependency, reproducible build environments
Stars: ✭ 48 (+84.62%)
Mutual labels:  build, make
Cleancppproject
Clean C++ project for you to use. Features: Modern CMake, CPack, Doxygen, PlantUML, Catch Unit testing, static analysis
Stars: ✭ 276 (+961.54%)
Mutual labels:  cmake, framework
Ark
ARK is a lightweight, agility, elastic, distributed plugin framework written in C++,make it easier and faster to create your own application service.
Stars: ✭ 370 (+1323.08%)
Mutual labels:  cmake, framework
Opencv Mingw Build
👀 MinGW 32bit and 64bit version of OpenCV compiled on Windows. Including OpenCV 3.3.1, 3.4.1, 3.4.1-x64, 3.4.5, 3.4.6, 3.4.7, 3.4.8-x64, 3.4.9, 4.0.0-alpha-x64, 4.0.0-rc-x64, 4.0.1-x64, 4.1.0, 4.1.0-x64, 4.1.1-x64, 4.5.0-with-contrib
Stars: ✭ 401 (+1442.31%)
Mutual labels:  cmake, build
Cpp Reflection
C++ Reflection Parser / Runtime Skeleton
Stars: ✭ 440 (+1592.31%)
Mutual labels:  cmake, build
Noahv
An efficient front-end application framework based on vue.js
Stars: ✭ 593 (+2180.77%)
Mutual labels:  framework, template
xcode-configure
This command can generate makefile to build xcode project in command line just like <configure & make & make install> in C/C++ language world.
Stars: ✭ 34 (+30.77%)
Mutual labels:  build, make
buildroot
Configure and build dahliaOS Linux-based builds
Stars: ✭ 56 (+115.38%)
Mutual labels:  build, compile
UniBot
An universal HTTP bot creator
Stars: ✭ 21 (-19.23%)
Mutual labels:  build, make
opencv3-setup
Raspberry Pi whiptail Menu driven Easy Install and Compile of opencv3 python from source files.
Stars: ✭ 47 (+80.77%)
Mutual labels:  compile, make
tools.build
Clojure builds as Clojure programs
Stars: ✭ 153 (+488.46%)
Mutual labels:  build, compile
Gf
GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
Stars: ✭ 6,501 (+24903.85%)
Mutual labels:  framework, template
Cmake Init
Template for reliable, cross-platform C++ project setup using cmake.
Stars: ✭ 642 (+2369.23%)
Mutual labels:  cmake, template
Primitive
⛏️ ‎ A front-end design toolkit for developing web apps.
Stars: ✭ 783 (+2911.54%)
Mutual labels:  framework, template
Primitiv
A Neural Network Toolkit.
Stars: ✭ 164 (+530.77%)
Mutual labels:  cmake, framework

C CPP Project Framework (Template)

中文

Simple and configurable C/C++ project/SDK template

CMake build system and support Kconfig with GUI configuration

Based on this project, you can quickly build your project construction system and reduce many unnecessary troubles~

If it helps you, please give a little star in the upper right corner~~ If needs improvement, just create an issue. (´ε` ʃƪ)♡

The target developer of this project:

  • Developers who are preparing to write SDK and need to write their own build system
  • Preparing to start writing a project who needs to write a build system
  • Who don't know much about CMake, but want to learn CMake
  • Who want to refactor the code engineering build system, maybe because of th bad old messy build system
  • Who want to add a very useful configuration system to the build system, you can quickly add and delete code modules as needed, and it is best to have an GUI configuration.
  • Who want the project to generate a variety of IDE supported projects.

Get Started

cd examples/demo1
# python project.py --toolchain /opt/toolchain/bin --toolchain-prefix mips-elf- config
mkdir build && cd build
cmake ..
make menuconfig
make -j10
./build/demo1
make clean
rm -rf ./*

or

cd examples/demo1
# python project.py --toolchain /opt/toolchain/bin --toolchain-prefix mips-elf- config
python project.py menuconfig
python project.py build
./build/demo1
python project.py clean
python project.py distclean
# python project.py clean_conf
  • Change dir to project directory
  • Set toolchain path(don't need set if use gcc)
  • Make a temporary directory and switch the current path to this directory(build)
  • Generate makefile by command cmake .., .. means the project directory
  • Config project by command make menuconfig, it will generate global_config files at build/config directory, so we can use it in component's CMakelists.txt directly, or in C/CPP source files by #include "global_config.h"
  • Build project by command make, or parallel build with make -jN, and output verbose build info with command make VERBOSE=1

You can create your github repository with this tempalte by click use this template button

Structure

directory/file function
root directory root directory of this project, also SDK projects' SDK directory
assets store assets like image etc. you can delete it if not use it
components as a component/lib
examples project dir or demo dir; SDK projects' example/project dir, this directory can be separated from the SDK directory, just set environmentMY_SDK_PATH to SDK directory's path.
tools tools like cmakekconfigburn tool etc.
Kconfig root Kconfig configuration

1) Component

All libraries are placed as components in the components directory or under the project directory. Each component uses a directory. This directory is the name of the component. In order to make the project look more concise, the components are not nested. All components are a hierarchy, and the relationships between components depend on dependencies to maintain

All source files must be in a component. Each project must contain a component called main (ie examples/demo1/main directory). Each component contains the following files:

  • CMakeLists.txt: Must exist, declare the component source file and the dependent component, and call the registration function to register itself. For details, please refer to CMakeLists.txt of components/component1 and components/component2.

  • Kconfig: Optional, contains configuration options for this component. In this component or other CMakeLists.txt that depends on the component of this component, you can use these configuration items after adding a CONFIG_ prefix. e.g. In components/component2, there is a COMPONENT2_ENABLED option in Kconfig. We use this variable if(CONFIG_COMPONENT2_ENABLED) in its CMakeLists.txt to determine if the user configuration want to register this component or not.

2) Project Directory

The project directory is in the examples directory. Of course, the name of this directory can be modified according to actual needs. The following can contain multiple actual project directories. You can compile when you need to compile the project and switch to the corresponding directory. As mentioned above, there must be a main component in each project directory. Of course, you can also put a lot of custom components. More refer to the examples/demo1 project directory.

Files under the project directory:

  • CMakeLists.txt: must exist, project properties file, you must first include include(${SDK_PATH}/tools/cmake/compile.cmake), then use the project function to declare project name, such as project(demo1), Of course, you can also write other conditions or variables, etc., using the CMake syntax, refer to the examples/demo1/CMakeLists.txt

  • config_defaults.mk: Optional, project default configuration file, the default configuration will be loaded when cmake execute. The format of the configuration is Makefile. You can use the terminal GUI configuration (make menuconfig) to generate the configuration file, the generated configuration file is in build/config/global_config.mk, then copy to config_defaults.mk.

Note: After modifying config_defaults.mk, you need to delete the files in the build directory (or just delete the mk file in the build/config directory) to regenerate, because the current build system will use the existing configuration file (build/config/global_config.mk)

Store SDK and project directory separately

Normally, you only need to modify the name of the example directory according to your needs, such as changing it to projects, or creating a new directory in the project root directory, such as projects/hello_world, and copy files in the examples/demo1's content to start a project

In addition, the project directory and the SDK directory can also be stored separately. This is especially used for open source projects, a copy of SDK, users develop based on this SDK, which is more conducive to the spread of routines, users do not need to copy a copy of the SDK, just specify the use SDK version (git commit number) To do this, only need:

  • Download SDK and put it in a directory, such as /home/neucrack/my_SDK
git clone https://github.com/Neutree/c_cpp_project_framework --recursive

Note that the --recursive parameter is used here, because sub-modules are used in the project. The advantage of sub-modules is that each project is managed separately. For example, Kconfiglib is used as a sub-module to provide menuconfig with interface function configuration

If you did't update submodule, the compile will error!!!!

If you forget to add this parameter when cloning, you can also use the following command to update the submodule:

git submodule update --init --recursive

In addition, when the remote repository is updated, the user also needs to use the following command to update the code (ie update the submodule code at the same time):

git pull --recursive

or:

git pull
git submodule update --init --recursive

Of course, you can also just delete the .git directory, and start a git repository with no submodule~~~

  • Then export the variable export MY_SDK_PATH=/home/neucrack/my_SDK in the terminal, which can be placed in the ~/.bashrc or ~/.zshrc file, so that this variable will be automatically added every time the terminal is started
  • Then create a project anywhere, such as copy the entire content of the folder of example/demo1 to /home/neucrack/temp/my_projects/demo1
  • Then clear the previous build cache (if there is one, ignore it if there is none)
python3 project.py distclean
  • Then configure and build
python3 project.py menuconfig
python3 project.py build

License

MIT, see LICENSE

Repos used this framwork

  • MaixPy: Micropython port for AIOT chip K210
  • libmaix: A lib for embeded AI model running with hardware accelaration
  • MF1_SDK: SDK for MF1 AI module(board)

Other Reference

  • ESP_IDFSDK of ESP32, Written very well
  • KconfiglibKconfig's Python implementation
  • RT-Thread:not CMake, but also use component
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].