-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
106 lines (81 loc) · 3.13 KB
/
Copy pathMakefile
File metadata and controls
106 lines (81 loc) · 3.13 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
CORE_DIR := cpp
BUILD_DIR := $(CORE_DIR)/build
CMAKE := cmake
CMAKE_BUILD_TYPE ?= Release
FES := $(BUILD_DIR)/fes
MODEL_DIR := data
# Export build dir so 'fes' works directly from shell
export PATH := $(BUILD_DIR):$(PATH)
# All .poly projects (basenames in data/, excluding _py variants)
POLY_FILES := $(filter-out %_py.poly, $(wildcard $(MODEL_DIR)/*.poly))
FES_PROJECTS := $(patsubst $(MODEL_DIR)/%.poly,%,$(POLY_FILES))
# Default frequency for mesh-check runs
FREQ ?= 1e10
# ─── Top-level targets ──────────────────────────────────────────────────
.PHONY: all help config build clean help-cpp help-py help-m \
py-setup py-test m-build m-test m-projects \
$(FES_PROJECTS)
all: build
help: help-cpp help-py help-m
# ─── C++ backend (cpp/) ─────────────────────────────────────────────
help-cpp:
@echo "=== C++ backend (cpp/) ==="
@echo " make build Build fes (cmake configure + compile)"
@echo " make test Run all .poly models (mesh check)"
@echo " make <model> Run a single model (e.g. WR90)"
@echo " make config Reconfigure cmake"
@echo " make clean Remove build directory"
@echo " The fes binary is at $(FES)"
@echo ""
config:
$(CMAKE) -S $(CORE_DIR) -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
build: config
$(CMAKE) --build $(BUILD_DIR) --config $(CMAKE_BUILD_TYPE)
clean:
rm -rf $(BUILD_DIR)
# Each .poly model: mesh and exit
define fes_target
$(1): build
@echo "--- $(1) ---"
cd $(MODEL_DIR) && $(abspath $(FES)) $(1) $(FREQ) +p 1
endef
$(foreach p,$(FES_PROJECTS),$(eval $(call fes_target,$(p))))
test: build
@echo "Running all $(words $(FES_PROJECTS)) models..."
@failed=""; FES_BIN="$(abspath $(FES))"; \
for p in $(FES_PROJECTS); do \
echo "--- $$p ---"; \
cd $(MODEL_DIR) && $$FES_BIN $$p $(FREQ) +p 1 || failed="$$failed $$p"; \
cd ..; \
done; \
if [ -n "$$failed" ]; then \
echo "FAILED:$$failed"; \
else \
echo "All models passed"; \
fi
# ─── Python backend (py/) ───────────────────────────────────────────────
PY_VENV := py/.venv
help-py:
@echo "=== Python backend (py/) ==="
@echo " make py-setup Create .venv and install fes package"
@echo " make py-test Run pytest on fes"
@echo ""
py-setup:
cd py && ./configure
py-test: $(PY_VENV)
cd py && $(abspath $(PY_VENV))/bin/python -m pytest tests/ -v
$(PY_VENV):
cd py && ./configure
# ─── MATLAB backend (m/) ────────────────────────────────────────────────
help-m:
@echo "=== MATLAB backend (m/) ==="
@echo " make m-build Build IOrMesh and Triangle (mesh tools)"
@echo " make m-test Run all FEM test cases (Project*.m in tests/)"
@echo " make m-tests Run standalone/DD test scripts (tests/)"
@echo ""
m-build:
$(MAKE) -C m all
m-test:
$(MAKE) -C m test
m-tests:
$(MAKE) -C m tests