-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·55 lines (44 loc) · 1.45 KB
/
Makefile
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
SOURCES := $(wildcard ./src/*.cpp ./src/numerical/*.cpp ./src/image/*.cpp ./src/image/*.cu ./src/utils/*.cpp ./src/geometry/*.cpp)
INCLUDES := $(wildcard *.h ./src/numerical/*.h ./src/image/*.h ./src/utils/*.h ./src/geometry/*.h)
TESTS := $(wildcard ./test/*.cpp )
DOCKER_DIR:= ./docker
export BUILDTYPE ?= default
buildtype := $(shell echo "$(BUILDTYPE)" | tr "[A-Z]" "[a-z]")
export BUILDDIR ?= build/default/$(buildtype)
CUDA_DEF := OFF
ifeq ($(CUDA),1)
CUDA_DEF = ON
endif
ifeq ($(shell uname -s), Darwin)
export JOBS ?= $(shell sysctl -n hw.ncpu)
else ifeq ($(shell uname -s), Linux)
export JOBS ?= $(shell grep --count processor /proc/cpuinfo)
else
$(error Cannot determine host platform)
endif
.PHONY: all
all: $(BUILDDIR)/Makefile
cmake --build "$(BUILDDIR)" -j $(JOBS)
.PHONY: patch_based_resizing
run: $(BUILDDIR)/Makefile
cmake --build "$(BUILDDIR)" -j $(JOBS) -- patch_based_resizing
.PHONY: test
test: $(BUILDDIR)/Makefile
cmake --build "$(BUILDDIR)" -j $(JOBS) -- resizing_test
.PHONY: run-test
run-test: test
"$(BUILDDIR)/test/resizing_test" yellow
.PHONY: format
format:
@echo "Format: " $(INCLUDES) $(SOURCES) $(TESTS)
clang-format -i $(SOURCES) $(INCLUDES) $(TESTS)
.PHONY: clean
clean:
-@rm -rvf $(BUILDDIR) *.png
.PRECIOUS: $(BUILDDIR)/Makefile
$(BUILDDIR)/Makefile:
mkdir -p $(BUILDDIR)
cmake -H. -B$(BUILDDIR) -DCMAKE_BUILD_TYPE=$(BUILDTYPE) -DUSE_CUDA=$(CUDA_DEF)
.PHONY: docker-run
docker-run:
-@sh $(DOCKER_DIR)/docker_run.sh