CPP Package Manager
Project description
cpppm
CPP Project Manager
(master)
(devel)
cpppm
is a C/C++ build-system/package manager (through conan
) that focus on flexibility.
While (most of) other build systems are jailing you into a re-invented scripting
language, cpppm
is nothing else but a python module that provides you some
facilities to build your software.
Thus, you can do everything you are able to do with python.
The cpppm
API semantics is close to CMake
(eg.: link_libraries, compile_options, etc...).
A basic example
Consider following code:
- main.cpp:
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>
#include <fmt/format.h>
TEST_CASE("cpppm loves conan") {
CHECK(fmt::format("{1} loves {0} !!!", "conan", "cpppm") == "cpppm loves conan !!!");
}
- project.py:
#!/usr/bin/env python3
from cpppm import Project, main
project = Project('conan_requires')
project.requires = 'fmt/6.1.2', 'doctest/2.3.6'
exe = project.main_executable()
exe.sources = 'src/main.cpp'
exe.link_libraries = 'fmt', 'doctest'
if __name__ == '__main__':
main()
At this point you'll be able to run:
$ ./project.py run conan_requires
# Build output ommitted...
[doctest] doctest version is "2.3.6"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 1 | 1 passed | 0 failed | 0 skipped
[doctest] assertions: 1 | 1 passed | 0 failed |
[doctest] Status: SUCCESS!
Check out the examples folder for more use cases.
Installation
- By cloning this repository:
git clone https://github.com/Garcia6l20/cpppm.git
cd cpppm
python setup.py install --user
- Available on PyPi:
pip install --user cpppm
Commands
Default commands can be listed with a regular help request:
$ ./project.py -h
Usage: project.py [OPTIONS] COMMAND [ARGS]...
Options:
-v, --verbose Let me talk about me.
-o, --out-directory TEXT Build directory, generated files should go there.
-d, --debug Print extra debug information.
-c, --clean Remove all stuff before processing the following
command.
-C, --config TEXT Config name to use.
-h, --help Show this message and exit.
Commands:
build Builds the project.
config Project configuration command group.
install Installs targets to destination.
interactive Interactive python console with loaded project.
run Runs the given TARGET with given ARGS.
shell Interactive shell (cli commands in shell mode).
sync Synchronize conan package recipe (conanfile.py).
test Runs the unit tests.
toolchain Toolchain command group.
Conan biding
cpppm
is tidally coupled to conan
and can be used as is to create
packages.
When you add requirements to your project a conanfile.py
appears side by side
with you project.py
.
It is used to install your dependencies or to allow conan to interact with your project.
The generated conanfile.py
might not be edited or it should be automatically re-generated.
So, regular conan
process applies directly to your project.
cd examples
conan create .
conan upload cpppm-examples -r my_repo
User of your generated package should be able to use it with all build-systems
handled by conan and obviously with cpppm
(see test_package).
Shell
An interactive shell mode is provided with click-shell
.
To enable interactive shell, install cpppm
interactive mode:
$ python -m pip install cpppm[interactive]
Then enter interactive shell:
$ ./project.py shell
Entering cpppm-examples shell...
cpppm-examples $ help
Documented commands (type help <topic>):
========================================
build install interactive shell test
config install-requirements run sync toolchain
Undocumented commands:
======================
exit help quit
cpppm-examples $ build
[... some output omitted ...]
INFO:cpppm.UnixCompiler(gcc-11-x86_64):building Executable[events]
INFO:cpppm.UnixCompiler(gcc-11-x86_64):compiling main.o (Executable[events])
INFO:cpppm.UnixCompiler(gcc-11-x86_64):linking events
cpppm-examples $ run hello-cpppm
Source directory: /home/sylvain/projects/cpppm/examples
Build directory: /home/sylvain/projects/cpppm/examples/build/gcc-11-x86_64-Release
Project: cpppm-examples
INFO:cpppm.UnixCompiler(gcc-11-x86_64):using ccache
INFO:cpppm.UnixCompiler(gcc-11-x86_64):building Executable[hello-cpppm]
INFO:cpppm.UnixCompiler(gcc-11-x86_64):object /home/sylvain/projects/cpppm/examples/build/gcc-11-x86_64-Release/hello_cpppm/main.o is up-to-date
INFO:cpppm.UnixCompiler(gcc-11-x86_64):using ccache
INFO:cpppm.UnixCompiler(gcc-11-x86_64):building Executable[hello-cpppm]
INFO:cpppm.UnixCompiler(gcc-11-x86_64):object /home/sylvain/projects/cpppm/examples/build/gcc-11-x86_64-Release/hello_cpppm/main.o is up-to-date
Hello cpppm
cpppm-examples $ quit
Interactive console
An interactive console mode is provided with IPython
, but not installed automatically.
To enable interactive console, install cpppm
interactive mode:
$ python -m pip install cpppm[interactive]
Then enter interactive console:
$ ./project.py interactive
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: await project.get_target('hello-cpppm').run('world')
INFO:cpppm.UnixCompiler(gcc-11-x86_64):using ccache
INFO:cpppm.UnixCompiler(gcc-11-x86_64):building Executable[hello-cpppm]
INFO:cpppm.UnixCompiler(gcc-11-x86_64):object /home/sylvain/projects/cpppm/examples/build/gcc-11-x86_64-Release/hello_cpppm/main.o is up-to-date
Hello world
Out[1]: (0, None, b'')
In [2]:
Features
-
CMakeLists.txt generation(no more using CMake) - Project compilation
-
Build events(useless), generators (will probably be moved into generic Targets) - Conan package dependencies management
- Executables invocation (automatically added to cli interface)
- Customizable (you can do anything you can do with python)
- Cli customization (cou can add any
@cpppm.cli.command
that you want to add, see click) - Unit testing (basic support)
- Conan package generation
Contributing
Would be appreciated, no contribution guide, just PEP-8 codding style and smart codding, fork/PR.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cpppm-1.0.0.tar.gz
.
File metadata
- Download URL: cpppm-1.0.0.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fba1c1974e2aa294f1c08c4852b286b9a90ad90a752136f541dfab41d331a63 |
|
MD5 | 34dae010a8196d853da2d8392ef89500 |
|
BLAKE2b-256 | be854dc1493558b668faeb8c168b167ae0e99ba10540a8428936fee585421a2f |
File details
Details for the file cpppm-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: cpppm-1.0.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059fa08d9e1dfe28747323b2e458481aff60cdf8f95da960210b6f3d8b978712 |
|
MD5 | 175bae017a94f5a66d820c0c6edd9ccb |
|
BLAKE2b-256 | 54292e6b1ca784dfdde14ad1bfe6ff17b1d6d78d73a080df7593117d99738114 |