Skip to main content

A Python package for the creation of a CPM project.

Project description

CPM / C++ Project Manager.

CPM is a high-level Python Command Line Program.

Still in a buggy alpha state.

CPM using required

Python interpreter and Mingw g++/gcc complier

  python version 3.8 < 3.10

CPM Installation

Install cpm with pip

  pip install cpp-projects-manager-cli

create c++ project with CPM

  python -m cpm init <project-name> <directory> !directory is Optional
     _____   _____    __  __ 
    / ____| |  __ \  |  \/  |
   | |      | |__) | | \  / |
   | |      |  ___/  | |\/| |
   | |____  | |      | |  | |
    \_____| |_|      |_|  |_|
   
          welcome to cpm
   
project author: example  
project description: demo              
project entry point(main.cpp): 
successfully create your example project

cpm.json

{
    "name": "example",
    "version": "1.0.0",
    "author": "example",
    "description": "demo",
    "entry_point": "main.cpp"
}

run project

  python -m cpm run <c++-file-name> !Optional

How to add C++ App in project

First create c++ app

create app

  python -m cpm makeapp <app-name> <directory> !directory is Optional
  $~ python -m cpm makeapp test
  $~ successfully create your test app

app add in cpm.json

open cpm.json file in any text editor. and add c++ app

 {
  ....
  "apps": [
        {
            "name": "test"
        }
    ]
 }

again run your project with app

  $~ > python -m cpm run
  [ build ] --- test --- [ D:\......\test.a ] 0.174ms
  combine compile main.cpp
  compile successfully. 0.617ms
  Hello World!

Run new terminal

  $~ > python -m cpm run --new-terminal
  [ build ] --- test --- [ D:\......\test.a ] 0.174ms
  combine compile main.cpp
  compile successfully. 0.617ms
  Hello World!

Custom Command

make folder and file on current work dir:

|- extra_commands
|        |
|----- __init__.py
|----- commands
|           |
|--------- __init__.py
|--------- example.py
|- test
|- cpm.json
|- main.cpp

example.py

from cpm.core.base import BaseCommand

class Command(BaseCommand):
    """
    Example command
    """
    help = 'Example command'
    description = 'Example command'
    
    def add_arguments(self, parser):
        parser.add_argument('--example', action='store_true', help='Example argument')

    def handle(self, *args, **options):
        print('Example command', options)

check custom command

    $~ python -m cpm --help

    Type 'python -m cpm help <subcommand>' for help on a specific subcommand.

    Available subcommands:

    Commands:
       example                 Example command
       init                    Creates a c++ project.
       makeapp                 Creates a c++ app.
       run                     Runs c++ project.

run custom command

    $~ python -m cpm example
    Example command {'traceback': False, 'example': False}

Command help

$~ python -m cpm example --help
usage: __main__.py example [--example] [-h] [-v] [--traceback]

Example command

optional arguments:
  --example      Example argument
  -h, --help     show this help message and exit
  -v, --version  Show program's version number and exit.
  --traceback    Raise on CommandError exceptions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpp-projects-manager-cli-1.0.2.tar.gz (16.4 kB view hashes)

Uploaded Source

Built Distribution

cpp_projects_manager_cli-1.0.2-py3-none-any.whl (22.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page