-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·67 lines (57 loc) · 2.11 KB
/
Copy pathMakefile
File metadata and controls
executable file
·67 lines (57 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Thin convenience shim. The build system is CMakeLists.txt; see README.md.
BUILD_DIR ?= build/cmake
TEST_TARGETS := \
test-parser \
test-errors \
test-bisection \
test-quadrature \
test-photons \
test-species-types \
test-scf-potential \
test-cdm-coupled \
test-scf-beta \
test-composite-classification \
test-type3-gauge-guard \
test-composite-layout \
test-type3-coupling \
test-axion-scf-factory \
test-axion-ede-fluid \
test-dcdm-wdm \
test-axion-ncdm \
test-dncdm-switch-copy \
test-ncdm-family \
test-species-budget
.PHONY: all class class_profiled classy classy-pip-dev test clean $(TEST_TARGETS)
# The real parallelism happens inside `cmake --build --parallel`; serialize
# the shim targets so `make -j class class_profiled` cannot run two CMake
# builds in the same build directory at once.
.NOTPARALLEL:
all: class
$(BUILD_DIR)/CMakeCache.txt:
cmake -S . -B $(BUILD_DIR)
class class_profiled $(TEST_TARGETS): $(BUILD_DIR)/CMakeCache.txt
cmake --build $(BUILD_DIR) --target $@ --parallel
# Single cmake invocation so `make -j test` cannot race parallel builds
# of the same build directory.
test: $(BUILD_DIR)/CMakeCache.txt
cmake --build $(BUILD_DIR) --target $(TEST_TARGETS) --parallel
ctest --test-dir $(BUILD_DIR) --output-on-failure
# Builds + installs classy via pip (scikit-build-core -> CMake), then recreates
# the python/build/lib.* layout MontePython expects.
classy:
rm -rf python/build && mkdir -p python/build
pip install .
python scripts/montepython_layout.py
# Faster local wrapper rebuild: reuse scikit-build-core's CMake tree and build
# with 12 parallel jobs. This assumes build dependencies are already installed.
# Direct CMake can be faster still:
# cmake -S . -B build/dev -DCLASS_BUILD_PYTHON=ON
# cmake --build build/dev --target classy --parallel
# but that only builds the extension in build/dev; it does not install the
# package or recreate the python/build/lib.* layout.
classy-pip-dev:
rm -rf python/build && mkdir -p python/build
pip install . --no-build-isolation -Cbuild-dir=build/skbuild -Cbuild.tool-args=-j12
python scripts/montepython_layout.py
clean:
rm -rf $(BUILD_DIR)