Skip to main content

C/C++ build system

Project description

Pysemble

Custom build system for C/C++ for use with python for configuration.

Features

Supported Compilers

  • G++
  • Gcc
  • Clang

Any compiler or archiver used must be accessible in the PATH with its standard name.

Supported Archivers

  • Ar

Supported OS

  • Windows
  • Unix like

Build Types

  • Build to binary
    • with static or dynamic linking
  • Static library
    • with static linking
  • Dynamic Library
    • with static linking

Install

pip install pysemble

Modules

from pysemble.builders import Project, Library
from pysemble.compilers import Gpp
from pysemble.archivers import Ar

Hello world Build

compiler = Gpp() # g++

myapp = Project("myapp", compiler)
myapp.add_executable("hello_world.cpp")
myapp.build()
myapp.run()

Building a Library

compiler = Gpp() # g++
archiver = Ar()  # ar

mylibrary = Library("libmylibrary", compiler, archiver)
mylibrary.add_sources([
    "dependency_1.cpp",
    "dependency_2.cpp",
    "dependency_3.cpp",
    "dependency_4.cpp",
])
mylibrary.buid()         # static library
mylibrary.build_shared() # dynamic library

Add External Libraries to Project

compiler = Gpp()  # g++

working_directory = os.path.dirname(os.path.realpath(__file__))
os.environ["LD_LIBRARY_PATH"] = working_directory + "/SFML/lib"

project = Project("myproject", compiler)
project.add_executables([
  "main.cpp",
])
project.add_link_path("SFML/lib")
project.add_include_directory("SFML/include")
project.add_dynamic_libs([
  "sfml-graphics",
  "sfml-window",
  "sfml-system",
  "sfml-audio",
])
project.build()
project.run()

Package a Library for Distrobution

compiler = Gpp() # g++
archiver = Ar()  # ar

loggerlib = Library("liblogger", compiler, archiver)
loggerlib.add_sources([
    "logger.cpp",
])
loggerlib.add_header("logger.h")
loggerlib.package(dynamic=True)

Final package

liblogger
    |_ include
          |_ logger.h
    |_ lib
        |_ liblogger.so

Troubleshooting

Clang & GCC

  • If you are building c++ try to link with stdc++ if you are having problems

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

pysemble-0.0.8.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

pysemble-0.0.8-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pysemble-0.0.8.tar.gz.

File metadata

  • Download URL: pysemble-0.0.8.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pysemble-0.0.8.tar.gz
Algorithm Hash digest
SHA256 0eaef49e3a30b1608f97bdcf1372bf01380218058d2f88d3a997b62bb18e624a
MD5 d6221bf90654000eaef9cc56d17e1be7
BLAKE2b-256 131a3b2bb536a0c2e517a333f463c5353030ea0371bed39a61328d659892b4e9

See more details on using hashes here.

File details

Details for the file pysemble-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: pysemble-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pysemble-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a331e5f9abcaa7b26f53b940dd016b72817a3b750ba88118e83928e210c7e884
MD5 5a470cfda114c54eb4d2d45cf5b3cde0
BLAKE2b-256 1cb08b7076285724ae37dcf1512a516c76ed68c37eba7e768bad8542803ec002

See more details on using hashes here.

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