forked from Orphis/boost-cmake
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathGNUmakefile
More file actions
72 lines (53 loc) · 1.93 KB
/
Copy pathGNUmakefile
File metadata and controls
72 lines (53 loc) · 1.93 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
# Standard stuff
.SUFFIXES:
MAKEFLAGS+= --no-builtin-rules
MAKEFLAGS+= --warn-undefined-variables
export hostSystemName=$(shell uname)
ifeq (${hostSystemName},Darwin)
export LLVM_PREFIX:=$(shell brew --prefix llvm)
export LLVM_DIR:=$(shell realpath ${LLVM_PREFIX})
export PATH:=${LLVM_DIR}/bin:${PATH}
export CMAKE_CXX_STDLIB_MODULES_JSON:=${LLVM_DIR}/lib/c++/libc++.modules.json
export CXX:=clang++
export LDFLAGS:=-L$(LLVM_DIR)/lib/c++ -lc++abi # NO! -lc++ -lc++experimental
export GCOV:="llvm-cov gcov"
### TODO: to test g++-15:
export GCC_PREFIX:=$(shell brew --prefix gcc)
export GCC_DIR:=$(shell realpath ${GCC_PREFIX})
# export CMAKE_CXX_STDLIB_MODULES_JSON:=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json
# export CXX::=g++-15
# export CXXFLAGS:=-stdlib=libstdc++
# export GCOV:="gcov"
else ifeq (${hostSystemName},Linux)
export LLVM_DIR:=/usr/lib/llvm-20
export PATH:=${LLVM_DIR}/bin:${PATH}
export CXX:=clang++-20
endif
#####################################################################
.PHONY: all fresh build test install examples format clean distclean
all: test
examples: # XXX install
cmake -S examples -B build -G Ninja --log-level=VERBOSE --fresh \
--debug-find-pkg=Boost
ninja -C build test -v
fresh:
cmake --workflow --preset Release --log-level=VERBOSE --fresh
compile_commands.json: build/Release/compile_commands.json
ln -sf $< .
build/Release/compile_commands.json: GNUmakefile CMakeLists.txt
cmake --preset Release --log-level=VERBOSE
build: compile_commands.json
cmake --build --preset Release
test: install
ctest --preset Release
install: build
cmake --build --preset Release --target install
clean:
-cmake --build --preset Release --target clean
-find . -name '*~' -delete
distclean: # XXX clean
rm -rf build stagedir
format:
git ls-files ::*.cmake ::*CMakeLists.txt | xargs gersemi -i
git ls-files ::*.json ::*.cpp ::*.hpp | xargs clang-format -i
# git clang-format master