Custom build system for C/C++ for use with python for configuration.
- G++
- Gcc
- Clang
Any compiler or archiver used must be accessible in the PATH with its standard name.
- Ar
- Windows
- Unix like
- Build to binary
- with static or dynamic linking
- Static library
- with static linking
- Dynamic Library
- with static linking
pip install pysemble
from pysemble.builders import Project, Library
from pysemble.compilers import Gpp
from pysemble.archivers import Ar
compiler = Gpp() # g++
myapp = Project("myapp", compiler)
myapp.add_executable("hello_world.cpp")
myapp.build()
myapp.run()
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
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()
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)
liblogger
|_ include
|_ logger.h
|_ lib
|_ liblogger.so
- If you are building c++ try to link with stdc++ if you are having problems