An open API service indexing awesome lists of open source software.

https://github.com/lnd3/bs

A tiny yet capable project generation system for c++
https://github.com/lnd3/bs

build-system cmake cpp lightweight tiny

Last synced: 8 months ago
JSON representation

A tiny yet capable project generation system for c++

Awesome Lists containing this project

README

          

# bs
A project generation tool for library package modules and dependencies.

The main purpose of `bs` is to provide a simpler interface (compared to raw cmake) to construct hierarchial project dependencies with as little cmake interaction as possible.

### Main functions
* `bs_init()`
* `bs_configure_packages( [...])`
* `bs_generate_package( [...])`

### Support functions
* `bs_truncate_path( )`
* `bs_set_pedantic_flags()`
* `bs_copy_to_binary_dir()`

### Typical usage:
```
cmake_minimum_required (VERSION 3.0.2)
list(APPEND CMAKE_MODULE_PATH /cmake)
include(bs)
bs_init()
set(PACKAGE_NAMES
logging
testing
)
# packages in folder "packages"
bs_configure_packages("packages" "${PACKAGE_NAMES}")
```

### Packages
Call `bs_generate_package()` in the `CMakeLists.txt` file within the current package folder with the name of the package.
Provide any necessary dependencies (targets) that the package depend upon.
The generator does not care if the target is internally or externally defined, any available targets can be utilized as dependencies.
Package interdependency is not managed and should be designed hierarchially by the user to avoid circular dependencies.

Your packages are expected to have a specific layout. See below.
All folders in a package are scanned recursively.

### Package folder layout of a package 'pkg_name'
``
* include
* source
* tests
* CMakeLists.txt

include
* `` (use a folder named to add structure to the include path)
* `/`

source
* common (required for all portable translation units)
* ``

tests
* common (source folder for tests)
* data (test data folder accessed in tests with "./tests/data)

Platform specific packages are named as the following
``
and depend on the platform agnostic package `` by default

### Example package CMakeLists.txt file
```
cmake_minimum_required (VERSION 3.0.2)
project()
set(deps [...])
bs_generate_package( "${deps}")
```