forked from blender/cycles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
51 lines (38 loc) · 1001 Bytes
/
GNUmakefile
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
# Convenience wrapper for CMake commands
ifeq ($(OS),Windows_NT)
$(error On Windows, use "cmd //c make.bat" instead of "make")
endif
OS:=$(shell uname -s)
ifndef BUILD_CMAKE_ARGS
BUILD_CMAKE_ARGS:=
endif
ifndef BUILD_DIR
BUILD_DIR:=./build
endif
ifndef PYTHON
PYTHON:=python3
endif
ifndef PARALLEL_JOBS
PARALLEL_JOBS:=1
ifeq ($(OS), Linux)
PARALLEL_JOBS:=$(shell nproc)
endif
ifneq (,$(filter $(OS),Darwin FreeBSD))
PARALLEL_JOBS:=$(shell sysctl -n hw.ncpu)
endif
endif
all: release
release:
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && cmake $(BUILD_CMAKE_ARGS) -DCMAKE_BUILD_TYPE=Release .. && cmake --build . -j $(PARALLEL_JOBS) --target install
debug:
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && cmake $(BUILD_CMAKE_ARGS) -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . -j $(PARALLEL_JOBS) --target install
clean:
rm -rf $(BUILD_DIR)
test:
cd $(BUILD_DIR) && ctest --output-on-failure
update:
$(PYTHON) src/cmake/make_update.py
format:
$(PYTHON) src/cmake/make_format.py