cxxbuild


Namecxxbuild JSON
Version 1.6.4 PyPI version JSON
download
home_pageNone
SummaryCxxBuild is a python script to easily build C++ programs: just invoke 'cxxbuild' and it works!
upload_time2024-05-22 00:48:33
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2023 manydeps Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords build cplusplus dependencies cxxdeps cmake bazel
VCS
bugtrack_url
requirements packaging toml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cxxbuild / cxxdeps

[![Demo on windows, linux and macos](https://github.com/manydeps/cxxbuild/actions/workflows/demo.yml/badge.svg)](https://github.com/manydeps/cxxbuild/actions/workflows/demo.yml)

![C++11](https://img.shields.io/badge/std-c%2B%2B11-blue) ![C++14](https://img.shields.io/badge/std-c%2B%2B14-blue) ![C++17](https://img.shields.io/badge/std-c%2B%2B17-blue) ![C++20](https://img.shields.io/badge/std-c%2B%2B20-blue) ![C++23](https://img.shields.io/badge/std-c%2B%2B23-blue)

[![DOI](https://zenodo.org/badge/715821683.svg)](https://zenodo.org/doi/10.5281/zenodo.10447208)

_**cxxbuild** (or "cplusplusbuild") is a python script to easily generate C/C++ build files for cmake and bazel._

- Version: `cxxbuild version=1.6.4`
- Installation: `pip install cxxbuild` (or `pipx install cxxbuild` for newer distributions)

For basic introduction, read the post: [Using cxxbuild to easily build C++ project with tests and dependencies](https://igormcoelho.medium.com/using-cxxbuild-to-easily-build-c-project-with-tests-and-dependencies-a3726b453f75)

We know it is very hard to start a C++ project and learn basics of build systems such as CMake and Bazel, and package managers like conan and vcpkg... so just type "cxxbuild" and be happy!
But you MUST follow the canonical organization below:

```
project1/
        |
        | include/
        |        | package1/
        |                  | file1.h
        |                  | file2.hpp
        |                  | ...
        | src/
        |    | file1.cpp
        |    | file2.c
        |    | file_main.cpp
        |    | ...
        | cxxdeps.txt
```

The strongest point of this project is the `cxxdeps.txt` format, 
that allow easy specification of dependencies from different package managers (in similar style of python `requirements.txt` format)

To use it locally, just copy [cxxbuild/cxxbuild.py](cxxbuild/cxxbuild.py) file to your project and execute it: `python3 cxxbuild.py help`

Or, just install it from pip: `pip install cxxbuild`  (or `pipx install cxxbuild` for newer distributions)

Then, just run: `cxxbuild help`

From this point, we assume cxxbuild is installed in your system :)

## Basic commands

`cxxbuild` has four main modes (three unimplemented, yet):

- build mode (default): just pass some root directory with files
- clean mode (unimplemented): will clean specific build files
- lint mode (unimplemented): will lint project files
- test mode (unimplemented): will run project tests

## Running demos 


- Demo 1 [README](demo/project1/README.md): `cxxbuild demo/project1`
    * Dependencies: fmt, catch2, pthread:!windows, crypto:linux
- Demo 2 [README](demo/project2/README.md): `cxxbuild demo/project2`
    * Dependencies: NONE
- Demo 3 [README](demo/project3/README.md): `cxxbuild demo/project3`
    * Dependencies: fmt, catch2, pthread:!windows
- Demo 4 [README](demo/project4/README.md): `cxxbuild demo/project4 --c++20`
    * Dependencies: catch2
- Demo 5 [README](demo/project5/README.md): `cxxbuild demo/project5`
    * Dependencies (cmake-only): fmt, catch2
- Demo 6 [README](demo/project6/README.md): `cxxbuild demo/project6`
    * Dependencies (cmake-only): optframe, absl (google abseil)

All of them support both CMake and Bazel build systems,
for common platforms Linux, Windows and Mac.

## Test summary for demos

- demo/project1: runs on linux, osx and windows* (bash only) - default c++17 (works with c++11 to c++23)
- demo/project2: runs on linux, osx and windows (bash and cmd) - default c++17 (works with c++11 to c++23)
- demo/project3: runs on linux, osx and windows* (bash only) - default c++17 (works with c++11 to c++23)
- demo/project4: runs on linux, osx and windows* (bash only) - requires minimum c++20

(*) Some limitations on windows/cmd are related to fmt dependency on cmake, not cxxbuild.

## Running demo 1 (explained)

`python3 cxxbuild/cxxbuild.py demo/project1`

OR, after installation:

`cxxbuild demo/project1`


It will:

- read dependencies from cxxdeps.txt file, if available
- generate a CMakeLists.txt on project (backup your file if you already have one!)
- build with cmake+ninja (default) or any other provided build system

Generated binaries will be on `demo/project1/build/`

- `demo1`: binary with entrypoint (main) for demo (file: `src/demo1.cpp`)
- `my_test`: binary with unit tests (file: `tests/my_test.cpp`)

To clean it (since `clean` command is still unimplemented), just delete `build/` folder.

### Expected project organization

The tool cxxbuild assumes that:

- source code (.cpp, .cc, .c, etc) is located on a `src/` folder
    * this can be changed with `--src SRC_PATH` option
- test code is located on a `tests/` folder
    * this can be changed with `--tests TEST_PATH` option
- header only libraries are located on a `include/` folder
    * this can be changed with `--include INCLUDE_PATH` option

The reason for `src/` folder is:

1. enforces some "basic" project organization (I know many people don't like a `src/` folder...)
2. recursively searching source files on root folder yields some issues,
as `build/` folder in same directory level becomes contaminated with external .cpp dependencies, thus requiring some clever exclusion algorithm

The reason for `tests/` folder is:

1. enforces some "basic" project organization (I know many people don't like a `tests/` folder...)
2. it is hard to distinguish between binary `.cpp` files and unit test files, 
unless  some other "standard" is imposed, such as naming `tests.cpp` (but what about multiple tests then?)

The reason for `include/` folder is:

1. this is classic organization, c'mon!!!
2. this is necessary to isolate header only library and make it easier for others to include them... if you don't want to offer a header only library, ok then, just put everything on `src/` folder and that is fine!

These things can be easily changed, either manually on [cxxbuild.py](cxxbuild.py) script, or by opening an issue and we discuss if some other option is really necessary... 
Note that this project does not aim to have many personalizations and complications, let's use KISS method!

## Advantages and Drawbacks

Greatest advantage of this project is to easily describe dependencies on a `cxxdeps.txt` file.

An example is:

```
fmt == "9.1.0"     [ fmt ]                    git *    https://github.com/fmtlib/fmt.git
Catch2 == "v3.3.1" [ Catch2::Catch2WithMain ] git test https://github.com/catchorg/Catch2.git
m
!std c++17
!build cmake
# this is a comment
```

This is quite simple and powerful, with few lines describing the following:

- take `fmt` project from git repository in specific version
- take `Catch2` project from git repository in specific version and use it for tests only
- take system `-lm` dependency
- C++ standard `c++17` is used
- build system `cmake` is used

The `git` part could be any package manager, such as conan and vcpkg, although not implemented yet!
The `git` can be specified for `cmake` or `bazel`, like `cmake+git` or `bazel+git`.

The `local` can be specified for `cmake` or `bazel`, like `cmake+local` or `bazel+local`.
On `cmake` it represents a `find_package`, while on `bazel` it is a `local_repository` (to implement, yet).

It can also be `bcr`, for the Bazel Central Registry, or more specifically: `bazel+bcr` (not supported for `cmake+bcr`)

### Ongoing extensions for cxxdeps
Some ongoing extensions will allow managing dev dependencies, 
such as build systems (cmake, bazel, etc) and C/C++ package managers (conan, etc), all automatically on `cxxdeps.txt` (or exclusively on `cxxdeps.dev.txt`):
```
cmake == *          [ cmake ]       pip dev [ ninja ]
ninja:windows == *  [ ninja ]       choco dev
ninja:linux == *    [ ninja-build ] apt dev
bazel:windows == *  [ bazelisk ]    choco dev 
bazel:linux == *    [ bazelisk ]    npm dev 
conan == *          [ conan ]       pip dev
```

Note that we can support triplet package notation on project name, 
so as different system package managers (such as apt on ubuntu/debian).
Some package dependency notation can be useful as well to orchestrate installation
flow, when necessary (as an example, ninja could be forcefully installed before cmake).

Other extension is some `build` section... similar to `dev`, but it installs automatically
before build process. The `build` can be seen as a *mandatory* `dev` dependency.
Some *configure* actions and *patches* could also happen in `build` phase 
(which are in fact some *pre-build* actions).

cxxdeps is a cool thing!
- In fact, this was the most motivating part of this project, so feel free to check more painful experiences directly on [manydeps-gmp](https://github.com/manydeps/manydeps-gmp) project!

### Writing cxxdeps in `.toml` format

It is currently possible to write `cxxdeps.toml` file, that automatically generates `cxxdeps.txt` and `cxxdeps.dev.txt` files. Some users may find this easier to understand:

```toml
[all]
fmt={ git="https://github.com/fmtlib/fmt.git", tag="9.1.0", links=["fmt"] }
m={ links=["m"] }
pthread={}

[test]
catch2={ git="https://github.com/catchorg/Catch2.git", tag="v3.3.1", links=[
    "Catch2::Catch2WithMain"
] }

[dev]
bazel=[{ choco=["bazelisk"], platform="windows" }, { npm=["bazelisk"], platform="linux" }]
ninja=[{ choco=["ninja"], platform="windows" }, { apt=["ninja-build"], platform="linux" }]
cmake={ pip=["cmake"], deps=["ninja"] }
conan={ pip=["conan"] }
```

Here one can find sections `all` (equivalent to `*`), `test` and `dev`.
This example install system libraries `-lm` and `-lpthread` for runtime dependencies (`all`),
`catch2` test library linked with cmake `Catch2::Catch2WithMain`, and defines several dev packages.

Check an example in project3 with: `python3 cxxbuild/cxxbuild.py demo/project3`

### Drawbacks

None that I know, yet :)

Some people may dislike the imposed organization, like `src/` and `tests/`, but it can be changed manually on script. The idea here is to really make a simplistic script, that really works with highly complex setups (such as taking dependencies from remote and dealing with build systems like cmake and bazel). These things are hard to do even for some experienced c++ programmers... so, as long as it is simple and it works, that is fine! If it doesn't work, file an issue!

### Build `!options` on cxxdeps

The `cxxdeps.txt` file allows defining some usual command line parameters with `!` prefix.
Examples:

- Parameter `--c++20` appears on file as `!std c++20`
- Parameter `--cmake` appears on file as `!build cmake`
- Parameter `--bazel` appears on file as `!build bazel`
- Parameter `--include dir` appears on file as `!include "dir"`

Command-line parameters have priority over `cxxdeps.txt` and can overwrite or complement them (with exception of `!build` parameter that cannot be overwritten).

In the future, the `!options` could be limited by operating system, e.g., `!option:windows`.

## Related Works

- See [ccbuild from debian](https://packages.debian.org/pt-br/sid/devel/ccbuild)
   * See [bneijt/ccbuild](https://github.com/bneijt/ccbuild)
- See [Mantle project](https://github.com/jpxor/Mantle) (experimental but with similar ideas)

None of them support dependencies, such as `cxxdeps.txt`, or even build systems such as cmake and bazel.

Hopefully, when this project is fully finished, C++ will be a better place for all of us :)

### Case of Study

A very interesting case of study is the use of cxxbuild to build the C/C++ ccbuild tool.
It is currently very easy to build it, using the following cxxdeps file:

```
bobcat
gnutls
fl
png
FLEX == * [ ] local * _ false patch_flex.txt
!std c++20
!tests test
!include "src"
!include "src/sourceScanner"
!define VERSION="v2.0.7-39-gdf7b35c"
!extrasrc ${FLEX_SourceScanner_OUTPUTS}
# apt install flex 
# apt install libboost-all-dev
# apt install gnutls-dev
# apt install libbobcat-dev
# apt install libpng-dev
```

Also create the following `patch_flex.txt` file:

```
FLEX_TARGET(SourceScanner "src/sourceScanner/lexer"  "src/sourceScanner/yylex.cc" )
```

- One may also use the following build script: `cxxbuild . --tests test --include src --include src/sourceScanner --c++20` (or just `cxxbuild`, since build options will come directly from *cxxdeps.txt*)
- This line will be added automatically to CMakeLists: `add_definitions(-DVERSION="v2.0.7-39-gdf7b35c")`
- This line will be added automatically to SOURCES: `${FLEX_SourceScanner_OUTPUTS}`
- These two lines will be put before the SOURCES:

```
find_package(FLEX)
FLEX_TARGET(SourceScanner "src/sourceScanner/lexer"  "src/sourceScanner/yylex.cc" )
```

And that's it! It builds all avaliable targets and tests for ccbuild.

See complete example on folder [usecases/ccbuild](./usecases/ccbuild).

## Acknowledgements

Thanks for those trying to use and improve this software.
Specially, thanks Fellipe Pessanha for early suggesting integrating toml support for cxxdeps.

### Citation

```
Igor Machado Coelho. (2023). cxxbuild project. Zenodo. https://doi.org/10.5281/zenodo.10447208
```

## License

Dual licensed: Creative Commons Attribution 4.0 International OR MIT License

Copyleft 2023 

Igor Machado Coelho


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cxxbuild",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "build, cplusplus, dependencies, cxxdeps, cmake, bazel",
    "author": null,
    "author_email": "Igor Machado Coelho <igormcoelho@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/01/57/4a791669dd55c320159772dd06737feae60617d61a7effdbf2f137c94a6f/cxxbuild-1.6.4.tar.gz",
    "platform": null,
    "description": "# cxxbuild / cxxdeps\n\n[![Demo on windows, linux and macos](https://github.com/manydeps/cxxbuild/actions/workflows/demo.yml/badge.svg)](https://github.com/manydeps/cxxbuild/actions/workflows/demo.yml)\n\n![C++11](https://img.shields.io/badge/std-c%2B%2B11-blue) ![C++14](https://img.shields.io/badge/std-c%2B%2B14-blue) ![C++17](https://img.shields.io/badge/std-c%2B%2B17-blue) ![C++20](https://img.shields.io/badge/std-c%2B%2B20-blue) ![C++23](https://img.shields.io/badge/std-c%2B%2B23-blue)\n\n[![DOI](https://zenodo.org/badge/715821683.svg)](https://zenodo.org/doi/10.5281/zenodo.10447208)\n\n_**cxxbuild** (or \"cplusplusbuild\") is a python script to easily generate C/C++ build files for cmake and bazel._\n\n- Version: `cxxbuild version=1.6.4`\n- Installation: `pip install cxxbuild` (or `pipx install cxxbuild` for newer distributions)\n\nFor basic introduction, read the post: [Using cxxbuild to easily build C++ project with tests and dependencies](https://igormcoelho.medium.com/using-cxxbuild-to-easily-build-c-project-with-tests-and-dependencies-a3726b453f75)\n\nWe know it is very hard to start a C++ project and learn basics of build systems such as CMake and Bazel, and package managers like conan and vcpkg... so just type \"cxxbuild\" and be happy!\nBut you MUST follow the canonical organization below:\n\n```\nproject1/\n        |\n        | include/\n        |        | package1/\n        |                  | file1.h\n        |                  | file2.hpp\n        |                  | ...\n        | src/\n        |    | file1.cpp\n        |    | file2.c\n        |    | file_main.cpp\n        |    | ...\n        | cxxdeps.txt\n```\n\nThe strongest point of this project is the `cxxdeps.txt` format, \nthat allow easy specification of dependencies from different package managers (in similar style of python `requirements.txt` format)\n\nTo use it locally, just copy [cxxbuild/cxxbuild.py](cxxbuild/cxxbuild.py) file to your project and execute it: `python3 cxxbuild.py help`\n\nOr, just install it from pip: `pip install cxxbuild`  (or `pipx install cxxbuild` for newer distributions)\n\nThen, just run: `cxxbuild help`\n\nFrom this point, we assume cxxbuild is installed in your system :)\n\n## Basic commands\n\n`cxxbuild` has four main modes (three unimplemented, yet):\n\n- build mode (default): just pass some root directory with files\n- clean mode (unimplemented): will clean specific build files\n- lint mode (unimplemented): will lint project files\n- test mode (unimplemented): will run project tests\n\n## Running demos \n\n\n- Demo 1 [README](demo/project1/README.md): `cxxbuild demo/project1`\n    * Dependencies: fmt, catch2, pthread:!windows, crypto:linux\n- Demo 2 [README](demo/project2/README.md): `cxxbuild demo/project2`\n    * Dependencies: NONE\n- Demo 3 [README](demo/project3/README.md): `cxxbuild demo/project3`\n    * Dependencies: fmt, catch2, pthread:!windows\n- Demo 4 [README](demo/project4/README.md): `cxxbuild demo/project4 --c++20`\n    * Dependencies: catch2\n- Demo 5 [README](demo/project5/README.md): `cxxbuild demo/project5`\n    * Dependencies (cmake-only): fmt, catch2\n- Demo 6 [README](demo/project6/README.md): `cxxbuild demo/project6`\n    * Dependencies (cmake-only): optframe, absl (google abseil)\n\nAll of them support both CMake and Bazel build systems,\nfor common platforms Linux, Windows and Mac.\n\n## Test summary for demos\n\n- demo/project1: runs on linux, osx and windows* (bash only) - default c++17 (works with c++11 to c++23)\n- demo/project2: runs on linux, osx and windows (bash and cmd) - default c++17 (works with c++11 to c++23)\n- demo/project3: runs on linux, osx and windows* (bash only) - default c++17 (works with c++11 to c++23)\n- demo/project4: runs on linux, osx and windows* (bash only) - requires minimum c++20\n\n(*) Some limitations on windows/cmd are related to fmt dependency on cmake, not cxxbuild.\n\n## Running demo 1 (explained)\n\n`python3 cxxbuild/cxxbuild.py demo/project1`\n\nOR, after installation:\n\n`cxxbuild demo/project1`\n\n\nIt will:\n\n- read dependencies from cxxdeps.txt file, if available\n- generate a CMakeLists.txt on project (backup your file if you already have one!)\n- build with cmake+ninja (default) or any other provided build system\n\nGenerated binaries will be on `demo/project1/build/`\n\n- `demo1`: binary with entrypoint (main) for demo (file: `src/demo1.cpp`)\n- `my_test`: binary with unit tests (file: `tests/my_test.cpp`)\n\nTo clean it (since `clean` command is still unimplemented), just delete `build/` folder.\n\n### Expected project organization\n\nThe tool cxxbuild assumes that:\n\n- source code (.cpp, .cc, .c, etc) is located on a `src/` folder\n    * this can be changed with `--src SRC_PATH` option\n- test code is located on a `tests/` folder\n    * this can be changed with `--tests TEST_PATH` option\n- header only libraries are located on a `include/` folder\n    * this can be changed with `--include INCLUDE_PATH` option\n\nThe reason for `src/` folder is:\n\n1. enforces some \"basic\" project organization (I know many people don't like a `src/` folder...)\n2. recursively searching source files on root folder yields some issues,\nas `build/` folder in same directory level becomes contaminated with external .cpp dependencies, thus requiring some clever exclusion algorithm\n\nThe reason for `tests/` folder is:\n\n1. enforces some \"basic\" project organization (I know many people don't like a `tests/` folder...)\n2. it is hard to distinguish between binary `.cpp` files and unit test files, \nunless  some other \"standard\" is imposed, such as naming `tests.cpp` (but what about multiple tests then?)\n\nThe reason for `include/` folder is:\n\n1. this is classic organization, c'mon!!!\n2. this is necessary to isolate header only library and make it easier for others to include them... if you don't want to offer a header only library, ok then, just put everything on `src/` folder and that is fine!\n\nThese things can be easily changed, either manually on [cxxbuild.py](cxxbuild.py) script, or by opening an issue and we discuss if some other option is really necessary... \nNote that this project does not aim to have many personalizations and complications, let's use KISS method!\n\n## Advantages and Drawbacks\n\nGreatest advantage of this project is to easily describe dependencies on a `cxxdeps.txt` file.\n\nAn example is:\n\n```\nfmt == \"9.1.0\"     [ fmt ]                    git *    https://github.com/fmtlib/fmt.git\nCatch2 == \"v3.3.1\" [ Catch2::Catch2WithMain ] git test https://github.com/catchorg/Catch2.git\nm\n!std c++17\n!build cmake\n# this is a comment\n```\n\nThis is quite simple and powerful, with few lines describing the following:\n\n- take `fmt` project from git repository in specific version\n- take `Catch2` project from git repository in specific version and use it for tests only\n- take system `-lm` dependency\n- C++ standard `c++17` is used\n- build system `cmake` is used\n\nThe `git` part could be any package manager, such as conan and vcpkg, although not implemented yet!\nThe `git` can be specified for `cmake` or `bazel`, like `cmake+git` or `bazel+git`.\n\nThe `local` can be specified for `cmake` or `bazel`, like `cmake+local` or `bazel+local`.\nOn `cmake` it represents a `find_package`, while on `bazel` it is a `local_repository` (to implement, yet).\n\nIt can also be `bcr`, for the Bazel Central Registry, or more specifically: `bazel+bcr` (not supported for `cmake+bcr`)\n\n### Ongoing extensions for cxxdeps\nSome ongoing extensions will allow managing dev dependencies, \nsuch as build systems (cmake, bazel, etc) and C/C++ package managers (conan, etc), all automatically on `cxxdeps.txt` (or exclusively on `cxxdeps.dev.txt`):\n```\ncmake == *          [ cmake ]       pip dev [ ninja ]\nninja:windows == *  [ ninja ]       choco dev\nninja:linux == *    [ ninja-build ] apt dev\nbazel:windows == *  [ bazelisk ]    choco dev \nbazel:linux == *    [ bazelisk ]    npm dev \nconan == *          [ conan ]       pip dev\n```\n\nNote that we can support triplet package notation on project name, \nso as different system package managers (such as apt on ubuntu/debian).\nSome package dependency notation can be useful as well to orchestrate installation\nflow, when necessary (as an example, ninja could be forcefully installed before cmake).\n\nOther extension is some `build` section... similar to `dev`, but it installs automatically\nbefore build process. The `build` can be seen as a *mandatory* `dev` dependency.\nSome *configure* actions and *patches* could also happen in `build` phase \n(which are in fact some *pre-build* actions).\n\ncxxdeps is a cool thing!\n- In fact, this was the most motivating part of this project, so feel free to check more painful experiences directly on [manydeps-gmp](https://github.com/manydeps/manydeps-gmp) project!\n\n### Writing cxxdeps in `.toml` format\n\nIt is currently possible to write `cxxdeps.toml` file, that automatically generates `cxxdeps.txt` and `cxxdeps.dev.txt` files. Some users may find this easier to understand:\n\n```toml\n[all]\nfmt={ git=\"https://github.com/fmtlib/fmt.git\", tag=\"9.1.0\", links=[\"fmt\"] }\nm={ links=[\"m\"] }\npthread={}\n\n[test]\ncatch2={ git=\"https://github.com/catchorg/Catch2.git\", tag=\"v3.3.1\", links=[\n    \"Catch2::Catch2WithMain\"\n] }\n\n[dev]\nbazel=[{ choco=[\"bazelisk\"], platform=\"windows\" }, { npm=[\"bazelisk\"], platform=\"linux\" }]\nninja=[{ choco=[\"ninja\"], platform=\"windows\" }, { apt=[\"ninja-build\"], platform=\"linux\" }]\ncmake={ pip=[\"cmake\"], deps=[\"ninja\"] }\nconan={ pip=[\"conan\"] }\n```\n\nHere one can find sections `all` (equivalent to `*`), `test` and `dev`.\nThis example install system libraries `-lm` and `-lpthread` for runtime dependencies (`all`),\n`catch2` test library linked with cmake `Catch2::Catch2WithMain`, and defines several dev packages.\n\nCheck an example in project3 with: `python3 cxxbuild/cxxbuild.py demo/project3`\n\n### Drawbacks\n\nNone that I know, yet :)\n\nSome people may dislike the imposed organization, like `src/` and `tests/`, but it can be changed manually on script. The idea here is to really make a simplistic script, that really works with highly complex setups (such as taking dependencies from remote and dealing with build systems like cmake and bazel). These things are hard to do even for some experienced c++ programmers... so, as long as it is simple and it works, that is fine! If it doesn't work, file an issue!\n\n### Build `!options` on cxxdeps\n\nThe `cxxdeps.txt` file allows defining some usual command line parameters with `!` prefix.\nExamples:\n\n- Parameter `--c++20` appears on file as `!std c++20`\n- Parameter `--cmake` appears on file as `!build cmake`\n- Parameter `--bazel` appears on file as `!build bazel`\n- Parameter `--include dir` appears on file as `!include \"dir\"`\n\nCommand-line parameters have priority over `cxxdeps.txt` and can overwrite or complement them (with exception of `!build` parameter that cannot be overwritten).\n\nIn the future, the `!options` could be limited by operating system, e.g., `!option:windows`.\n\n## Related Works\n\n- See [ccbuild from debian](https://packages.debian.org/pt-br/sid/devel/ccbuild)\n   * See [bneijt/ccbuild](https://github.com/bneijt/ccbuild)\n- See [Mantle project](https://github.com/jpxor/Mantle) (experimental but with similar ideas)\n\nNone of them support dependencies, such as `cxxdeps.txt`, or even build systems such as cmake and bazel.\n\nHopefully, when this project is fully finished, C++ will be a better place for all of us :)\n\n### Case of Study\n\nA very interesting case of study is the use of cxxbuild to build the C/C++ ccbuild tool.\nIt is currently very easy to build it, using the following cxxdeps file:\n\n```\nbobcat\ngnutls\nfl\npng\nFLEX == * [ ] local * _ false patch_flex.txt\n!std c++20\n!tests test\n!include \"src\"\n!include \"src/sourceScanner\"\n!define VERSION=\"v2.0.7-39-gdf7b35c\"\n!extrasrc ${FLEX_SourceScanner_OUTPUTS}\n# apt install flex \n# apt install libboost-all-dev\n# apt install gnutls-dev\n# apt install libbobcat-dev\n# apt install libpng-dev\n```\n\nAlso create the following `patch_flex.txt` file:\n\n```\nFLEX_TARGET(SourceScanner \"src/sourceScanner/lexer\"  \"src/sourceScanner/yylex.cc\" )\n```\n\n- One may also use the following build script: `cxxbuild . --tests test --include src --include src/sourceScanner --c++20` (or just `cxxbuild`, since build options will come directly from *cxxdeps.txt*)\n- This line will be added automatically to CMakeLists: `add_definitions(-DVERSION=\"v2.0.7-39-gdf7b35c\")`\n- This line will be added automatically to SOURCES: `${FLEX_SourceScanner_OUTPUTS}`\n- These two lines will be put before the SOURCES:\n\n```\nfind_package(FLEX)\nFLEX_TARGET(SourceScanner \"src/sourceScanner/lexer\"  \"src/sourceScanner/yylex.cc\" )\n```\n\nAnd that's it! It builds all avaliable targets and tests for ccbuild.\n\nSee complete example on folder [usecases/ccbuild](./usecases/ccbuild).\n\n## Acknowledgements\n\nThanks for those trying to use and improve this software.\nSpecially, thanks Fellipe Pessanha for early suggesting integrating toml support for cxxdeps.\n\n### Citation\n\n```\nIgor Machado Coelho. (2023). cxxbuild project. Zenodo. https://doi.org/10.5281/zenodo.10447208\n```\n\n## License\n\nDual licensed: Creative Commons Attribution 4.0 International OR MIT License\n\nCopyleft 2023 \n\nIgor Machado Coelho\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 manydeps  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "CxxBuild is a python script to easily build C++ programs: just invoke 'cxxbuild' and it works!",
    "version": "1.6.4",
    "project_urls": {
        "Homepage": "https://github.com/manydeps/cxxbuild"
    },
    "split_keywords": [
        "build",
        " cplusplus",
        " dependencies",
        " cxxdeps",
        " cmake",
        " bazel"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01574a791669dd55c320159772dd06737feae60617d61a7effdbf2f137c94a6f",
                "md5": "68eb1d4363203a6231ecbee135ab309e",
                "sha256": "7090dab53b8bf649f694e93b8d45ef344ac8b5add77632b00ce83f8ae603be27"
            },
            "downloads": -1,
            "filename": "cxxbuild-1.6.4.tar.gz",
            "has_sig": false,
            "md5_digest": "68eb1d4363203a6231ecbee135ab309e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 23582,
            "upload_time": "2024-05-22T00:48:33",
            "upload_time_iso_8601": "2024-05-22T00:48:33.297999Z",
            "url": "https://files.pythonhosted.org/packages/01/57/4a791669dd55c320159772dd06737feae60617d61a7effdbf2f137c94a6f/cxxbuild-1.6.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-22 00:48:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "manydeps",
    "github_project": "cxxbuild",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.0"
                ]
            ]
        },
        {
            "name": "toml",
            "specs": [
                [
                    "==",
                    "0.10.2"
                ]
            ]
        }
    ],
    "lcname": "cxxbuild"
}
        
Elapsed time: 3.07809s