cppmake 127.0.14__tar.gz → 127.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cppmake-127.0.16/PKG-INFO +191 -0
- {cppmake-127.0.14 → cppmake-127.0.16}/pyproject.toml +10 -4
- cppmake-127.0.16/readme.md +182 -0
- cppmake-127.0.16/src/cppmake.egg-info/PKG-INFO +191 -0
- cppmake-127.0.16/src/cppmake.egg-info/SOURCES.txt +57 -0
- cppmake-127.0.16/src/cppmake.egg-info/entry_points.txt +3 -0
- cppmake-127.0.16/src/cppmake.egg-info/top_level.txt +3 -0
- cppmake-127.0.16/src/cppmaked.py +2 -0
- cppmake-127.0.16/src/cppmakelib/__init__.py +32 -0
- cppmake-127.0.16/src/cppmakelib/basic/config.py +50 -0
- cppmake-127.0.16/src/cppmakelib/basic/context.py +39 -0
- cppmake-127.0.16/src/cppmakelib/builder/cmake.py +71 -0
- cppmake-127.0.16/src/cppmakelib/builder/include.py +15 -0
- cppmake-127.0.16/src/cppmakelib/builder/makefile.py +68 -0
- cppmake-127.0.16/src/cppmakelib/compiler/all.py +26 -0
- cppmake-127.0.16/src/cppmakelib/compiler/clang.py +196 -0
- cppmake-127.0.16/src/cppmakelib/compiler/emcc.py +79 -0
- cppmake-127.0.16/src/cppmakelib/compiler/gcc.py +237 -0
- cppmake-127.0.16/src/cppmakelib/compiler/msvc.py +24 -0
- cppmake-127.0.16/src/cppmakelib/error/config.py +5 -0
- cppmake-127.0.16/src/cppmakelib/error/logic.py +6 -0
- cppmake-127.0.16/src/cppmakelib/error/subprocess.py +9 -0
- cppmake-127.0.16/src/cppmakelib/executor/operation.py +15 -0
- cppmake-127.0.16/src/cppmakelib/executor/run.py +84 -0
- cppmake-127.0.16/src/cppmakelib/executor/scheduler.py +91 -0
- cppmake-127.0.16/src/cppmakelib/logger/compile_commands.py +30 -0
- cppmake-127.0.16/src/cppmakelib/logger/make_progress.py +0 -0
- cppmake-127.0.16/src/cppmakelib/logger/module_mapper.py +6 -0
- cppmake-127.0.16/src/cppmakelib/logger/unit_status.py +224 -0
- cppmake-127.0.16/src/cppmakelib/system/all.py +25 -0
- cppmake-127.0.16/src/cppmakelib/system/linux.py +26 -0
- cppmake-127.0.16/src/cppmakelib/system/macos.py +26 -0
- cppmake-127.0.16/src/cppmakelib/system/windows.py +26 -0
- cppmake-127.0.16/src/cppmakelib/unit/binary.py +26 -0
- cppmake-127.0.16/src/cppmakelib/unit/code.py +62 -0
- cppmake-127.0.16/src/cppmakelib/unit/dynamic.py +12 -0
- cppmake-127.0.16/src/cppmakelib/unit/executable.py +35 -0
- cppmake-127.0.16/src/cppmakelib/unit/header.py +63 -0
- cppmake-127.0.16/src/cppmakelib/unit/module.py +69 -0
- cppmake-127.0.16/src/cppmakelib/unit/object.py +71 -0
- cppmake-127.0.16/src/cppmakelib/unit/package.py +87 -0
- cppmake-127.0.16/src/cppmakelib/unit/precompiled.py +6 -0
- cppmake-127.0.16/src/cppmakelib/unit/preparsed.py +6 -0
- cppmake-127.0.16/src/cppmakelib/unit/preprocessed.py +3 -0
- cppmake-127.0.16/src/cppmakelib/unit/source.py +64 -0
- cppmake-127.0.16/src/cppmakelib/utility/algorithm.py +44 -0
- cppmake-127.0.16/src/cppmakelib/utility/color.py +14 -0
- cppmake-127.0.16/src/cppmakelib/utility/decorator.py +120 -0
- cppmake-127.0.16/src/cppmakelib/utility/filesystem.py +71 -0
- cppmake-127.0.16/src/cppmakelib/utility/import_.py +21 -0
- cppmake-127.0.16/src/cppmakelib/utility/remote/client.py +2 -0
- cppmake-127.0.16/src/cppmakelib/utility/remote/protocol.py +32 -0
- cppmake-127.0.16/src/cppmakelib/utility/remote/remote.py +43 -0
- cppmake-127.0.16/src/cppmakelib/utility/remote/server.py +0 -0
- cppmake-127.0.16/src/cppmakelib/utility/time.py +1 -0
- cppmake-127.0.16/src/cppmakelib/utility/version.py +65 -0
- cppmake-127.0.14/PKG-INFO +0 -9
- cppmake-127.0.14/cppmake.egg-info/PKG-INFO +0 -9
- cppmake-127.0.14/cppmake.egg-info/SOURCES.txt +0 -8
- cppmake-127.0.14/cppmake.egg-info/entry_points.txt +0 -2
- cppmake-127.0.14/cppmake.egg-info/requires.txt +0 -1
- cppmake-127.0.14/cppmake.egg-info/top_level.txt +0 -1
- {cppmake-127.0.14 → cppmake-127.0.16}/setup.cfg +0 -0
- {cppmake-127.0.14 → cppmake-127.0.16/src}/cppmake.egg-info/dependency_links.txt +0 -0
- /cppmake-127.0.14/cppmake/__main__.py → /cppmake-127.0.16/src/cppmake.py +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cppmake
|
|
3
|
+
Version: 127.0.16
|
|
4
|
+
Summary: A modern C++ builder based on C++20 Modules.
|
|
5
|
+
Author-email: shyeyian <shyeyian@icloud.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# Cppmake: A C++20 Modules Build System
|
|
11
|
+
|
|
12
|
+
Cppmake is a modern, fast, and accurate C++ build system focusing on C++20 Modules.
|
|
13
|
+
|
|
14
|
+
Cppmake aims to
|
|
15
|
+
- Make everything modular.
|
|
16
|
+
- Easily modularize third-party libraries.
|
|
17
|
+
- Be fast, parallel, and fully cached.
|
|
18
|
+
|
|
19
|
+
Cppmake is written in pure Python with no additional pip dependencies.
|
|
20
|
+
|
|
21
|
+
# Show
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
# Install
|
|
26
|
+
|
|
27
|
+
Use pip to install cppmake:
|
|
28
|
+
```sh
|
|
29
|
+
pip install cppmake
|
|
30
|
+
```
|
|
31
|
+
Or install from source:
|
|
32
|
+
```sh
|
|
33
|
+
git clone https://github.com/anonymouspc/cppmake
|
|
34
|
+
cd cppmake
|
|
35
|
+
python install.py
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
# Getting Started
|
|
39
|
+
|
|
40
|
+
In a cppmake project:
|
|
41
|
+
- module `aaa.bbb` should be placed at `module/aaa/bbb.cpp`
|
|
42
|
+
- module `aaa:ccc` should be placed at `module/aaa/ccc.cpp`
|
|
43
|
+
- source `main` should be placed at `source/main.cpp`
|
|
44
|
+
- `std` module will be auto-installed.
|
|
45
|
+
|
|
46
|
+
For example:
|
|
47
|
+
```
|
|
48
|
+
├── module
|
|
49
|
+
│ ├── aaa.cpp
|
|
50
|
+
│ ├── aaa
|
|
51
|
+
│ │ ├── bbb.cpp // aaa.bbb
|
|
52
|
+
│ │ └── ccc.cpp // aaa:ccc
|
|
53
|
+
│ └── ddd.cpp
|
|
54
|
+
├── source
|
|
55
|
+
│ └── main.cpp
|
|
56
|
+
└── cppmake.py
|
|
57
|
+
```
|
|
58
|
+
Then, run
|
|
59
|
+
```sh
|
|
60
|
+
cppmake
|
|
61
|
+
```
|
|
62
|
+
The output will be generated in the `binary/` directory.
|
|
63
|
+
|
|
64
|
+
# Advanced
|
|
65
|
+
|
|
66
|
+
Cppmake provides various configurable options, such as:
|
|
67
|
+
```sh
|
|
68
|
+
cppmake --compiler=clang++ --std=c++23
|
|
69
|
+
```
|
|
70
|
+
```sh
|
|
71
|
+
cppmake --compiler=/opt/gcc/bin/g++ --linker=lld --std=c++26 --type=release --target=make --parallel=$(nproc)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
System/compiler support:
|
|
75
|
+
| | clang | emcc | gcc | msvc |
|
|
76
|
+
|:-------:|:-----:|:----:|:---:|:----:|
|
|
77
|
+
| Linux | ✓ | ✓ | ✓ | N/A |
|
|
78
|
+
| Macos | ✓ | ✓ | ✓ | N/A |
|
|
79
|
+
| Windows | ✗ | ✗ | ✗ | ✗ |
|
|
80
|
+
- ✓: Supported and tested.
|
|
81
|
+
- ✗: Not implemented yet; planned for future releases.
|
|
82
|
+
- *(The author does not own a Windows PC. Contributions for Windows support are welcome!)*
|
|
83
|
+
|
|
84
|
+
# Configure
|
|
85
|
+
|
|
86
|
+
Cppmake uses a `cppmake.py` file (pure Python) to describe the C++ project. The configuration is entirely standard Python syntax.
|
|
87
|
+
|
|
88
|
+
For example:
|
|
89
|
+
```py
|
|
90
|
+
from cppmakelib import *
|
|
91
|
+
def make():
|
|
92
|
+
Source("main").compile()
|
|
93
|
+
```
|
|
94
|
+
This `cppmake.py` defines a single source `source/main.cpp`, which will be
|
|
95
|
+
built into a binary.
|
|
96
|
+
- *(Imported modules and packages will be built automatically before compiling the source. For example, if `source/main.cpp` imports module my_module and module `boost.asio`, then Cppmake will precompile module `my_module`, cmake build `boost`, and precompile module `boost.asio` before finally compiling `source/main.cpp`.)*
|
|
97
|
+
- *(By default, the imported modules and packages form a [directed acyclic graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) and will be executed with maximum possible parallelism, depending on your cpu thread count. You can control the level of parallelism using `cppmake --parallel=N`, or force serial compilation through `cppmake --parallel=1`.)*
|
|
98
|
+
|
|
99
|
+
Another example:
|
|
100
|
+
```py
|
|
101
|
+
from cppmakelib import *
|
|
102
|
+
|
|
103
|
+
if type(compiler) == Gcc:
|
|
104
|
+
compiler.compile_flags += ["-fno-inline"] # global
|
|
105
|
+
compiler.define_macros |= {"NDEBUG": '1'} # global
|
|
106
|
+
|
|
107
|
+
package.define_macros = {"MY_MACRO": "42"} # package-local
|
|
108
|
+
|
|
109
|
+
def build(): # select a source file to compile
|
|
110
|
+
if type(system) == Linux:
|
|
111
|
+
Source("linux").compile()
|
|
112
|
+
|
|
113
|
+
def test(): # compile and test all units
|
|
114
|
+
for file in iterate_dir("source/test", recursive=True):
|
|
115
|
+
Source(file=file).compile()
|
|
116
|
+
Executable(file=file).run()
|
|
117
|
+
```
|
|
118
|
+
This `cppmake.py` defines 2 targets (switchable via
|
|
119
|
+
`cppmake --target=build|test`) and several configuration rules. You can
|
|
120
|
+
easily extend it with any other Python code.
|
|
121
|
+
|
|
122
|
+
# Integrating third-party packages
|
|
123
|
+
|
|
124
|
+
Third-party packages should be located in `package/`, for example
|
|
125
|
+
```
|
|
126
|
+
├── module
|
|
127
|
+
│ ├── aaa.cpp
|
|
128
|
+
│ ├── aaa
|
|
129
|
+
│ │ ├── bbb.cpp // aaa.bbb
|
|
130
|
+
│ │ └── ccc.cpp // aaa:ccc
|
|
131
|
+
│ └── ddd.cpp
|
|
132
|
+
├── source
|
|
133
|
+
│ └── main.cpp
|
|
134
|
+
├── package
|
|
135
|
+
│ ├── boost
|
|
136
|
+
│ │ ├── git
|
|
137
|
+
│ │ │ └── [git clone]
|
|
138
|
+
│ │ ├── module
|
|
139
|
+
│ │ │ ├── boost.cpp // boost
|
|
140
|
+
│ │ │ └── boost
|
|
141
|
+
│ │ │ ├── asio.cpp // boost.asio
|
|
142
|
+
│ │ │ ├── beast.cpp // boost.beast
|
|
143
|
+
│ │ │ └── numeric.cpp // boost.numeric
|
|
144
|
+
│ │ │ ├── interval.cpp // boost.numeric.interval
|
|
145
|
+
│ │ │ └── ublas.cpp // boost.numeric.ublas
|
|
146
|
+
│ │ └── cppmake.py
|
|
147
|
+
│ └── eigen
|
|
148
|
+
│ ├── git
|
|
149
|
+
│ │ └── [git clone]
|
|
150
|
+
│ ├── module
|
|
151
|
+
│ │ └── eigen.cpp // eigen
|
|
152
|
+
│ └── cppmake.py
|
|
153
|
+
└── cppmake.py
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
In `package/boost/cppmake.py` we can define a `build()` function to describe how this package should be built. For example:
|
|
157
|
+
```py
|
|
158
|
+
# package/boost/cppmake.py
|
|
159
|
+
from cppmakelib import *
|
|
160
|
+
|
|
161
|
+
def build():
|
|
162
|
+
cmake.build(
|
|
163
|
+
package=package,
|
|
164
|
+
args=[
|
|
165
|
+
"-DBUILD_SHARED_LIBS=OFF"
|
|
166
|
+
]
|
|
167
|
+
)
|
|
168
|
+
```
|
|
169
|
+
Then:
|
|
170
|
+
```cpp
|
|
171
|
+
// package/boost/module/boost/asio.cpp
|
|
172
|
+
module;
|
|
173
|
+
#include <boost/asio.hpp>
|
|
174
|
+
export module boost.asio;
|
|
175
|
+
export namespace boost::asio
|
|
176
|
+
{
|
|
177
|
+
using boost::asio::io_context;
|
|
178
|
+
//...
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
will modularize boost.asio into a module.
|
|
182
|
+
|
|
183
|
+
Builder support:
|
|
184
|
+
| cmake | include* | makefile | meson | msbuild |
|
|
185
|
+
|:-----:|:--------:|:--------:|:-----:|:-------:|
|
|
186
|
+
| ✓ | ✓ | ✓ |(soon) | ✗ |
|
|
187
|
+
- ✓: Supported and tested.
|
|
188
|
+
- ✗: Not implemented yet; planned for future releases.
|
|
189
|
+
- *(include: means header-only libraries.)*
|
|
190
|
+
|
|
191
|
+
# Thank you!
|
|
@@ -4,14 +4,20 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cppmake"
|
|
7
|
-
version = "127.0.
|
|
7
|
+
version = "127.0.16"
|
|
8
8
|
description = "A modern C++ builder based on C++20 Modules."
|
|
9
9
|
authors = [{name = "shyeyian", email = "shyeyian@icloud.com"}]
|
|
10
10
|
readme = "readme.md"
|
|
11
11
|
requires-python = ">=3.13"
|
|
12
12
|
license = "MIT"
|
|
13
|
-
scripts = {cppmake = "cppmake
|
|
14
|
-
|
|
13
|
+
scripts = {cppmake = "cppmake:main", cppmaked = "cppmaked:main"}
|
|
14
|
+
|
|
15
|
+
[tool.setuptools]
|
|
16
|
+
py-modules = ["cppmake", "cppmaked"]
|
|
17
|
+
|
|
18
|
+
[tool.setuptools.package-dir]
|
|
19
|
+
"" = "src"
|
|
15
20
|
|
|
16
21
|
[tool.setuptools.packages.find]
|
|
17
|
-
|
|
22
|
+
where = ["src"]
|
|
23
|
+
include = ["cppmakelib*"]
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Cppmake: A C++20 Modules Build System
|
|
2
|
+
|
|
3
|
+
Cppmake is a modern, fast, and accurate C++ build system focusing on C++20 Modules.
|
|
4
|
+
|
|
5
|
+
Cppmake aims to
|
|
6
|
+
- Make everything modular.
|
|
7
|
+
- Easily modularize third-party libraries.
|
|
8
|
+
- Be fast, parallel, and fully cached.
|
|
9
|
+
|
|
10
|
+
Cppmake is written in pure Python with no additional pip dependencies.
|
|
11
|
+
|
|
12
|
+
# Show
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
# Install
|
|
17
|
+
|
|
18
|
+
Use pip to install cppmake:
|
|
19
|
+
```sh
|
|
20
|
+
pip install cppmake
|
|
21
|
+
```
|
|
22
|
+
Or install from source:
|
|
23
|
+
```sh
|
|
24
|
+
git clone https://github.com/anonymouspc/cppmake
|
|
25
|
+
cd cppmake
|
|
26
|
+
python install.py
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
# Getting Started
|
|
30
|
+
|
|
31
|
+
In a cppmake project:
|
|
32
|
+
- module `aaa.bbb` should be placed at `module/aaa/bbb.cpp`
|
|
33
|
+
- module `aaa:ccc` should be placed at `module/aaa/ccc.cpp`
|
|
34
|
+
- source `main` should be placed at `source/main.cpp`
|
|
35
|
+
- `std` module will be auto-installed.
|
|
36
|
+
|
|
37
|
+
For example:
|
|
38
|
+
```
|
|
39
|
+
├── module
|
|
40
|
+
│ ├── aaa.cpp
|
|
41
|
+
│ ├── aaa
|
|
42
|
+
│ │ ├── bbb.cpp // aaa.bbb
|
|
43
|
+
│ │ └── ccc.cpp // aaa:ccc
|
|
44
|
+
│ └── ddd.cpp
|
|
45
|
+
├── source
|
|
46
|
+
│ └── main.cpp
|
|
47
|
+
└── cppmake.py
|
|
48
|
+
```
|
|
49
|
+
Then, run
|
|
50
|
+
```sh
|
|
51
|
+
cppmake
|
|
52
|
+
```
|
|
53
|
+
The output will be generated in the `binary/` directory.
|
|
54
|
+
|
|
55
|
+
# Advanced
|
|
56
|
+
|
|
57
|
+
Cppmake provides various configurable options, such as:
|
|
58
|
+
```sh
|
|
59
|
+
cppmake --compiler=clang++ --std=c++23
|
|
60
|
+
```
|
|
61
|
+
```sh
|
|
62
|
+
cppmake --compiler=/opt/gcc/bin/g++ --linker=lld --std=c++26 --type=release --target=make --parallel=$(nproc)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
System/compiler support:
|
|
66
|
+
| | clang | emcc | gcc | msvc |
|
|
67
|
+
|:-------:|:-----:|:----:|:---:|:----:|
|
|
68
|
+
| Linux | ✓ | ✓ | ✓ | N/A |
|
|
69
|
+
| Macos | ✓ | ✓ | ✓ | N/A |
|
|
70
|
+
| Windows | ✗ | ✗ | ✗ | ✗ |
|
|
71
|
+
- ✓: Supported and tested.
|
|
72
|
+
- ✗: Not implemented yet; planned for future releases.
|
|
73
|
+
- *(The author does not own a Windows PC. Contributions for Windows support are welcome!)*
|
|
74
|
+
|
|
75
|
+
# Configure
|
|
76
|
+
|
|
77
|
+
Cppmake uses a `cppmake.py` file (pure Python) to describe the C++ project. The configuration is entirely standard Python syntax.
|
|
78
|
+
|
|
79
|
+
For example:
|
|
80
|
+
```py
|
|
81
|
+
from cppmakelib import *
|
|
82
|
+
def make():
|
|
83
|
+
Source("main").compile()
|
|
84
|
+
```
|
|
85
|
+
This `cppmake.py` defines a single source `source/main.cpp`, which will be
|
|
86
|
+
built into a binary.
|
|
87
|
+
- *(Imported modules and packages will be built automatically before compiling the source. For example, if `source/main.cpp` imports module my_module and module `boost.asio`, then Cppmake will precompile module `my_module`, cmake build `boost`, and precompile module `boost.asio` before finally compiling `source/main.cpp`.)*
|
|
88
|
+
- *(By default, the imported modules and packages form a [directed acyclic graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) and will be executed with maximum possible parallelism, depending on your cpu thread count. You can control the level of parallelism using `cppmake --parallel=N`, or force serial compilation through `cppmake --parallel=1`.)*
|
|
89
|
+
|
|
90
|
+
Another example:
|
|
91
|
+
```py
|
|
92
|
+
from cppmakelib import *
|
|
93
|
+
|
|
94
|
+
if type(compiler) == Gcc:
|
|
95
|
+
compiler.compile_flags += ["-fno-inline"] # global
|
|
96
|
+
compiler.define_macros |= {"NDEBUG": '1'} # global
|
|
97
|
+
|
|
98
|
+
package.define_macros = {"MY_MACRO": "42"} # package-local
|
|
99
|
+
|
|
100
|
+
def build(): # select a source file to compile
|
|
101
|
+
if type(system) == Linux:
|
|
102
|
+
Source("linux").compile()
|
|
103
|
+
|
|
104
|
+
def test(): # compile and test all units
|
|
105
|
+
for file in iterate_dir("source/test", recursive=True):
|
|
106
|
+
Source(file=file).compile()
|
|
107
|
+
Executable(file=file).run()
|
|
108
|
+
```
|
|
109
|
+
This `cppmake.py` defines 2 targets (switchable via
|
|
110
|
+
`cppmake --target=build|test`) and several configuration rules. You can
|
|
111
|
+
easily extend it with any other Python code.
|
|
112
|
+
|
|
113
|
+
# Integrating third-party packages
|
|
114
|
+
|
|
115
|
+
Third-party packages should be located in `package/`, for example
|
|
116
|
+
```
|
|
117
|
+
├── module
|
|
118
|
+
│ ├── aaa.cpp
|
|
119
|
+
│ ├── aaa
|
|
120
|
+
│ │ ├── bbb.cpp // aaa.bbb
|
|
121
|
+
│ │ └── ccc.cpp // aaa:ccc
|
|
122
|
+
│ └── ddd.cpp
|
|
123
|
+
├── source
|
|
124
|
+
│ └── main.cpp
|
|
125
|
+
├── package
|
|
126
|
+
│ ├── boost
|
|
127
|
+
│ │ ├── git
|
|
128
|
+
│ │ │ └── [git clone]
|
|
129
|
+
│ │ ├── module
|
|
130
|
+
│ │ │ ├── boost.cpp // boost
|
|
131
|
+
│ │ │ └── boost
|
|
132
|
+
│ │ │ ├── asio.cpp // boost.asio
|
|
133
|
+
│ │ │ ├── beast.cpp // boost.beast
|
|
134
|
+
│ │ │ └── numeric.cpp // boost.numeric
|
|
135
|
+
│ │ │ ├── interval.cpp // boost.numeric.interval
|
|
136
|
+
│ │ │ └── ublas.cpp // boost.numeric.ublas
|
|
137
|
+
│ │ └── cppmake.py
|
|
138
|
+
│ └── eigen
|
|
139
|
+
│ ├── git
|
|
140
|
+
│ │ └── [git clone]
|
|
141
|
+
│ ├── module
|
|
142
|
+
│ │ └── eigen.cpp // eigen
|
|
143
|
+
│ └── cppmake.py
|
|
144
|
+
└── cppmake.py
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
In `package/boost/cppmake.py` we can define a `build()` function to describe how this package should be built. For example:
|
|
148
|
+
```py
|
|
149
|
+
# package/boost/cppmake.py
|
|
150
|
+
from cppmakelib import *
|
|
151
|
+
|
|
152
|
+
def build():
|
|
153
|
+
cmake.build(
|
|
154
|
+
package=package,
|
|
155
|
+
args=[
|
|
156
|
+
"-DBUILD_SHARED_LIBS=OFF"
|
|
157
|
+
]
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
Then:
|
|
161
|
+
```cpp
|
|
162
|
+
// package/boost/module/boost/asio.cpp
|
|
163
|
+
module;
|
|
164
|
+
#include <boost/asio.hpp>
|
|
165
|
+
export module boost.asio;
|
|
166
|
+
export namespace boost::asio
|
|
167
|
+
{
|
|
168
|
+
using boost::asio::io_context;
|
|
169
|
+
//...
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
will modularize boost.asio into a module.
|
|
173
|
+
|
|
174
|
+
Builder support:
|
|
175
|
+
| cmake | include* | makefile | meson | msbuild |
|
|
176
|
+
|:-----:|:--------:|:--------:|:-----:|:-------:|
|
|
177
|
+
| ✓ | ✓ | ✓ |(soon) | ✗ |
|
|
178
|
+
- ✓: Supported and tested.
|
|
179
|
+
- ✗: Not implemented yet; planned for future releases.
|
|
180
|
+
- *(include: means header-only libraries.)*
|
|
181
|
+
|
|
182
|
+
# Thank you!
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cppmake
|
|
3
|
+
Version: 127.0.16
|
|
4
|
+
Summary: A modern C++ builder based on C++20 Modules.
|
|
5
|
+
Author-email: shyeyian <shyeyian@icloud.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# Cppmake: A C++20 Modules Build System
|
|
11
|
+
|
|
12
|
+
Cppmake is a modern, fast, and accurate C++ build system focusing on C++20 Modules.
|
|
13
|
+
|
|
14
|
+
Cppmake aims to
|
|
15
|
+
- Make everything modular.
|
|
16
|
+
- Easily modularize third-party libraries.
|
|
17
|
+
- Be fast, parallel, and fully cached.
|
|
18
|
+
|
|
19
|
+
Cppmake is written in pure Python with no additional pip dependencies.
|
|
20
|
+
|
|
21
|
+
# Show
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
# Install
|
|
26
|
+
|
|
27
|
+
Use pip to install cppmake:
|
|
28
|
+
```sh
|
|
29
|
+
pip install cppmake
|
|
30
|
+
```
|
|
31
|
+
Or install from source:
|
|
32
|
+
```sh
|
|
33
|
+
git clone https://github.com/anonymouspc/cppmake
|
|
34
|
+
cd cppmake
|
|
35
|
+
python install.py
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
# Getting Started
|
|
39
|
+
|
|
40
|
+
In a cppmake project:
|
|
41
|
+
- module `aaa.bbb` should be placed at `module/aaa/bbb.cpp`
|
|
42
|
+
- module `aaa:ccc` should be placed at `module/aaa/ccc.cpp`
|
|
43
|
+
- source `main` should be placed at `source/main.cpp`
|
|
44
|
+
- `std` module will be auto-installed.
|
|
45
|
+
|
|
46
|
+
For example:
|
|
47
|
+
```
|
|
48
|
+
├── module
|
|
49
|
+
│ ├── aaa.cpp
|
|
50
|
+
│ ├── aaa
|
|
51
|
+
│ │ ├── bbb.cpp // aaa.bbb
|
|
52
|
+
│ │ └── ccc.cpp // aaa:ccc
|
|
53
|
+
│ └── ddd.cpp
|
|
54
|
+
├── source
|
|
55
|
+
│ └── main.cpp
|
|
56
|
+
└── cppmake.py
|
|
57
|
+
```
|
|
58
|
+
Then, run
|
|
59
|
+
```sh
|
|
60
|
+
cppmake
|
|
61
|
+
```
|
|
62
|
+
The output will be generated in the `binary/` directory.
|
|
63
|
+
|
|
64
|
+
# Advanced
|
|
65
|
+
|
|
66
|
+
Cppmake provides various configurable options, such as:
|
|
67
|
+
```sh
|
|
68
|
+
cppmake --compiler=clang++ --std=c++23
|
|
69
|
+
```
|
|
70
|
+
```sh
|
|
71
|
+
cppmake --compiler=/opt/gcc/bin/g++ --linker=lld --std=c++26 --type=release --target=make --parallel=$(nproc)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
System/compiler support:
|
|
75
|
+
| | clang | emcc | gcc | msvc |
|
|
76
|
+
|:-------:|:-----:|:----:|:---:|:----:|
|
|
77
|
+
| Linux | ✓ | ✓ | ✓ | N/A |
|
|
78
|
+
| Macos | ✓ | ✓ | ✓ | N/A |
|
|
79
|
+
| Windows | ✗ | ✗ | ✗ | ✗ |
|
|
80
|
+
- ✓: Supported and tested.
|
|
81
|
+
- ✗: Not implemented yet; planned for future releases.
|
|
82
|
+
- *(The author does not own a Windows PC. Contributions for Windows support are welcome!)*
|
|
83
|
+
|
|
84
|
+
# Configure
|
|
85
|
+
|
|
86
|
+
Cppmake uses a `cppmake.py` file (pure Python) to describe the C++ project. The configuration is entirely standard Python syntax.
|
|
87
|
+
|
|
88
|
+
For example:
|
|
89
|
+
```py
|
|
90
|
+
from cppmakelib import *
|
|
91
|
+
def make():
|
|
92
|
+
Source("main").compile()
|
|
93
|
+
```
|
|
94
|
+
This `cppmake.py` defines a single source `source/main.cpp`, which will be
|
|
95
|
+
built into a binary.
|
|
96
|
+
- *(Imported modules and packages will be built automatically before compiling the source. For example, if `source/main.cpp` imports module my_module and module `boost.asio`, then Cppmake will precompile module `my_module`, cmake build `boost`, and precompile module `boost.asio` before finally compiling `source/main.cpp`.)*
|
|
97
|
+
- *(By default, the imported modules and packages form a [directed acyclic graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) and will be executed with maximum possible parallelism, depending on your cpu thread count. You can control the level of parallelism using `cppmake --parallel=N`, or force serial compilation through `cppmake --parallel=1`.)*
|
|
98
|
+
|
|
99
|
+
Another example:
|
|
100
|
+
```py
|
|
101
|
+
from cppmakelib import *
|
|
102
|
+
|
|
103
|
+
if type(compiler) == Gcc:
|
|
104
|
+
compiler.compile_flags += ["-fno-inline"] # global
|
|
105
|
+
compiler.define_macros |= {"NDEBUG": '1'} # global
|
|
106
|
+
|
|
107
|
+
package.define_macros = {"MY_MACRO": "42"} # package-local
|
|
108
|
+
|
|
109
|
+
def build(): # select a source file to compile
|
|
110
|
+
if type(system) == Linux:
|
|
111
|
+
Source("linux").compile()
|
|
112
|
+
|
|
113
|
+
def test(): # compile and test all units
|
|
114
|
+
for file in iterate_dir("source/test", recursive=True):
|
|
115
|
+
Source(file=file).compile()
|
|
116
|
+
Executable(file=file).run()
|
|
117
|
+
```
|
|
118
|
+
This `cppmake.py` defines 2 targets (switchable via
|
|
119
|
+
`cppmake --target=build|test`) and several configuration rules. You can
|
|
120
|
+
easily extend it with any other Python code.
|
|
121
|
+
|
|
122
|
+
# Integrating third-party packages
|
|
123
|
+
|
|
124
|
+
Third-party packages should be located in `package/`, for example
|
|
125
|
+
```
|
|
126
|
+
├── module
|
|
127
|
+
│ ├── aaa.cpp
|
|
128
|
+
│ ├── aaa
|
|
129
|
+
│ │ ├── bbb.cpp // aaa.bbb
|
|
130
|
+
│ │ └── ccc.cpp // aaa:ccc
|
|
131
|
+
│ └── ddd.cpp
|
|
132
|
+
├── source
|
|
133
|
+
│ └── main.cpp
|
|
134
|
+
├── package
|
|
135
|
+
│ ├── boost
|
|
136
|
+
│ │ ├── git
|
|
137
|
+
│ │ │ └── [git clone]
|
|
138
|
+
│ │ ├── module
|
|
139
|
+
│ │ │ ├── boost.cpp // boost
|
|
140
|
+
│ │ │ └── boost
|
|
141
|
+
│ │ │ ├── asio.cpp // boost.asio
|
|
142
|
+
│ │ │ ├── beast.cpp // boost.beast
|
|
143
|
+
│ │ │ └── numeric.cpp // boost.numeric
|
|
144
|
+
│ │ │ ├── interval.cpp // boost.numeric.interval
|
|
145
|
+
│ │ │ └── ublas.cpp // boost.numeric.ublas
|
|
146
|
+
│ │ └── cppmake.py
|
|
147
|
+
│ └── eigen
|
|
148
|
+
│ ├── git
|
|
149
|
+
│ │ └── [git clone]
|
|
150
|
+
│ ├── module
|
|
151
|
+
│ │ └── eigen.cpp // eigen
|
|
152
|
+
│ └── cppmake.py
|
|
153
|
+
└── cppmake.py
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
In `package/boost/cppmake.py` we can define a `build()` function to describe how this package should be built. For example:
|
|
157
|
+
```py
|
|
158
|
+
# package/boost/cppmake.py
|
|
159
|
+
from cppmakelib import *
|
|
160
|
+
|
|
161
|
+
def build():
|
|
162
|
+
cmake.build(
|
|
163
|
+
package=package,
|
|
164
|
+
args=[
|
|
165
|
+
"-DBUILD_SHARED_LIBS=OFF"
|
|
166
|
+
]
|
|
167
|
+
)
|
|
168
|
+
```
|
|
169
|
+
Then:
|
|
170
|
+
```cpp
|
|
171
|
+
// package/boost/module/boost/asio.cpp
|
|
172
|
+
module;
|
|
173
|
+
#include <boost/asio.hpp>
|
|
174
|
+
export module boost.asio;
|
|
175
|
+
export namespace boost::asio
|
|
176
|
+
{
|
|
177
|
+
using boost::asio::io_context;
|
|
178
|
+
//...
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
will modularize boost.asio into a module.
|
|
182
|
+
|
|
183
|
+
Builder support:
|
|
184
|
+
| cmake | include* | makefile | meson | msbuild |
|
|
185
|
+
|:-----:|:--------:|:--------:|:-----:|:-------:|
|
|
186
|
+
| ✓ | ✓ | ✓ |(soon) | ✗ |
|
|
187
|
+
- ✓: Supported and tested.
|
|
188
|
+
- ✗: Not implemented yet; planned for future releases.
|
|
189
|
+
- *(include: means header-only libraries.)*
|
|
190
|
+
|
|
191
|
+
# Thank you!
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
readme.md
|
|
3
|
+
src/cppmake.py
|
|
4
|
+
src/cppmaked.py
|
|
5
|
+
src/cppmake.egg-info/PKG-INFO
|
|
6
|
+
src/cppmake.egg-info/SOURCES.txt
|
|
7
|
+
src/cppmake.egg-info/dependency_links.txt
|
|
8
|
+
src/cppmake.egg-info/entry_points.txt
|
|
9
|
+
src/cppmake.egg-info/top_level.txt
|
|
10
|
+
src/cppmakelib/__init__.py
|
|
11
|
+
src/cppmakelib/basic/config.py
|
|
12
|
+
src/cppmakelib/basic/context.py
|
|
13
|
+
src/cppmakelib/builder/cmake.py
|
|
14
|
+
src/cppmakelib/builder/include.py
|
|
15
|
+
src/cppmakelib/builder/makefile.py
|
|
16
|
+
src/cppmakelib/compiler/all.py
|
|
17
|
+
src/cppmakelib/compiler/clang.py
|
|
18
|
+
src/cppmakelib/compiler/emcc.py
|
|
19
|
+
src/cppmakelib/compiler/gcc.py
|
|
20
|
+
src/cppmakelib/compiler/msvc.py
|
|
21
|
+
src/cppmakelib/error/config.py
|
|
22
|
+
src/cppmakelib/error/logic.py
|
|
23
|
+
src/cppmakelib/error/subprocess.py
|
|
24
|
+
src/cppmakelib/executor/operation.py
|
|
25
|
+
src/cppmakelib/executor/run.py
|
|
26
|
+
src/cppmakelib/executor/scheduler.py
|
|
27
|
+
src/cppmakelib/logger/compile_commands.py
|
|
28
|
+
src/cppmakelib/logger/make_progress.py
|
|
29
|
+
src/cppmakelib/logger/module_mapper.py
|
|
30
|
+
src/cppmakelib/logger/unit_status.py
|
|
31
|
+
src/cppmakelib/system/all.py
|
|
32
|
+
src/cppmakelib/system/linux.py
|
|
33
|
+
src/cppmakelib/system/macos.py
|
|
34
|
+
src/cppmakelib/system/windows.py
|
|
35
|
+
src/cppmakelib/unit/binary.py
|
|
36
|
+
src/cppmakelib/unit/code.py
|
|
37
|
+
src/cppmakelib/unit/dynamic.py
|
|
38
|
+
src/cppmakelib/unit/executable.py
|
|
39
|
+
src/cppmakelib/unit/header.py
|
|
40
|
+
src/cppmakelib/unit/module.py
|
|
41
|
+
src/cppmakelib/unit/object.py
|
|
42
|
+
src/cppmakelib/unit/package.py
|
|
43
|
+
src/cppmakelib/unit/precompiled.py
|
|
44
|
+
src/cppmakelib/unit/preparsed.py
|
|
45
|
+
src/cppmakelib/unit/preprocessed.py
|
|
46
|
+
src/cppmakelib/unit/source.py
|
|
47
|
+
src/cppmakelib/utility/algorithm.py
|
|
48
|
+
src/cppmakelib/utility/color.py
|
|
49
|
+
src/cppmakelib/utility/decorator.py
|
|
50
|
+
src/cppmakelib/utility/filesystem.py
|
|
51
|
+
src/cppmakelib/utility/import_.py
|
|
52
|
+
src/cppmakelib/utility/time.py
|
|
53
|
+
src/cppmakelib/utility/version.py
|
|
54
|
+
src/cppmakelib/utility/remote/client.py
|
|
55
|
+
src/cppmakelib/utility/remote/protocol.py
|
|
56
|
+
src/cppmakelib/utility/remote/remote.py
|
|
57
|
+
src/cppmakelib/utility/remote/server.py
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from .basic.config import config
|
|
2
|
+
|
|
3
|
+
from .builder.cmake import cmake
|
|
4
|
+
from .builder.include import include
|
|
5
|
+
from .builder.makefile import makefile
|
|
6
|
+
|
|
7
|
+
from .compiler.all import compiler
|
|
8
|
+
from .compiler.clang import Clang
|
|
9
|
+
from .compiler.emcc import Emcc
|
|
10
|
+
from .compiler.gcc import Gcc
|
|
11
|
+
from .compiler.msvc import Msvc
|
|
12
|
+
|
|
13
|
+
from .error.config import ConfigError
|
|
14
|
+
from .error.logic import LogicError
|
|
15
|
+
from .error.subprocess import SubprocessError
|
|
16
|
+
|
|
17
|
+
from .utility.filesystem import path, exist_file, exist_dir, create_file, create_dir, copy_file, copy_dir, remove_file, remove_dir, modified_time_file, iterate_dir
|
|
18
|
+
|
|
19
|
+
from .execution.operation import sync_wait, start_detached, when_all, when_any
|
|
20
|
+
from .execution.run import run
|
|
21
|
+
|
|
22
|
+
from .system.all import system
|
|
23
|
+
from .system.linux import Linux
|
|
24
|
+
from .system.macos import Macos
|
|
25
|
+
from .system.windows import Windows
|
|
26
|
+
|
|
27
|
+
from .unit.executable import Executable
|
|
28
|
+
from .unit.module import Module
|
|
29
|
+
from .unit.package import Package
|
|
30
|
+
from .unit.source import Source
|
|
31
|
+
|
|
32
|
+
self: Package
|