This project has been moved to github.com/trick-17/clang-build
MIT License
Linux and OSX test: Windows test:
Motivation:
Goals:
Related resources:
In order to run clang-build
one should only need to have Python and Clang installed.
If you have admin rights, pip install
, otherwise just drop-in the clang-build.py
script,
e.g. curl -O https://raw.githubusercontent.com/GPMueller/clang-build-test/master/clang-build.py
clang-build
to build the current directoryclang-build -d"path/to/dir"
to build a different directory (alternatively --directory
)clang-build -V
to print the called clang commands (alternatively --verbose
)The given directory will be searched for a clang-build.toml
file, which you can use to configure
your build targets, if necessary. If the build file cannot be found, clang-build
will try to
create an executable from your project, searching the root and some default folders for sources
and headers.
Note: until this is a package on pypi, you need to call python clang-build.py
instead of just clang-build
...
This would be things that require only the invocation of clang-build
and no build file.
src
, include/MWE
and include/thirdparty
)Sane defaults and default behaviour:
This would be things that only require a minimal TOML project file
#define
s, ...)Steps that would involve more effort from the user, including possibly some python code
# Top-level brackets indicate a target
[hello]
# Note: the following sources settings could be left out.
# .hpp and .cpp files will be searched for in include and src by default
[hello.sources]
file_extensions = [".hpp", ".cpp"]
include_directories = ["include"]
source_directories = ["src"]
# Some properties
[hello.properties]
cpp_version = 17
output_name = "runHello" # name should not contain pre- or suffixes such as lib, .exe, .so
# Build a library
[mylib]
target_type = "sharedlibrary"
[mylib.sources]
include_directories = ["mylib/include"]
source_directories = ["mylib/src"]
# Build an executable and link the library
[myexe]
output_name = "runExe"
target_type = "executable"
[myexe.sources]
include_directories = ["myexe/include"]
source_directories = ["myexe/src"]
[myexe.link]
dependencies = ["mylib"]
[myexe.flags]
link = ["-DMYLIB_SOME_DEFINE"]
mypackage/clang-build.toml
# Build a library
[mylib]
target_type = "library"
[mylib.sources]
include_directories = ["mylib/include"]
source_directories = ["mylib/src"]
myexe/clang-build.toml
# Include an external package/target (i.e. not from this toml file)
[somelib]
external = true
path = "/path/to/sources"
# Build an executable and link the library
[myexe]
[myexe.sources]
include_directories = ["include", "mylib.sources.include_directories"]
source_directories = ["src"]
[myexe.link]
dependencies = ["somelib"]
# Build a library
[mylib]
external = true
url = "https://github.com/trick-17/mylib"
version = 1.1 # will try to git checkout [v]1.1[.*]
# Build an executable and link the library
[myexe]
[myexe.link]
dependencies = ["mylib"]
build/<build_type>
build/<target_name>/<build_type>
private = true
Note: only those paths should be added to the build flags, which the build system finds contain needed files.
The build system should search these paths for folders with names corresponding
to the external targets.
For paths which were manually specified, the build system should search more
deeply to try and find a clang-build.toml
and in turn search that for the
corresponding target names.
Local:
./
./<target_name>
git server:
<url>
<url>/<target_name>