-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tuprules.tup
50 lines (40 loc) · 1.84 KB
/
Tuprules.tup
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
ROOT = $(TUP_CWD)
SRC_PATH = $(ROOT)/src
THIRD_PARTY_PATH = $(ROOT)/third_party
BIN_TARGET = $(TUP_VARIANTDIR)/ts-viz
# VERSION = `cd .. && git add --all && git write-tree`
VERSION = 0.1
CFLAGS += -std=c++20
CFLAGS += -Wall -Werror -Wno-missing-braces -Wno-unused -Wno-expansion-to-defined
CFLAGS += -I$(TUP_CWD)/src -I$(TUP_VARIANTDIR)/src -I$(THIRD_PARTY_PATH) -I$(THIRD_PARTY_PATH)/spdlog/include/ -I$(THIRD_PARTY_PATH)/rapidjson/include/
CFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
ifeq (@(BUILD_TYPE),debug)
# CFLAGS += -fsanitize=undefined,address
# LDFLAGS += -fsanitize=undefined,address
CFLAGS += -O0 -g -fdebug-prefix-map=`pwd`=`pwd | sed 's/\/\.tup\/.*//'`
endif
ifeq (@(BUILD_TYPE),release)
CFLAGS += -O3 -ffast-math -fno-finite-math-only -fvisibility=hidden -DNDEBUG
endif
ifeq (@(TUP_PLATFORM),macosx)
CC = clang
CXX = clang++
CFLAGS += -stdlib=libc++ -mcpu=apple-m1 `pkg-config --cflags-only-I glfw3 glew fftw3 fftw3f fmt glm`
LDFLAGS += -framework OpenGL `pkg-config --static --libs glfw3 glew fftw3 fftw3f fmt glm`
ifeq (@(BUILD_TYPE),release)
CFLAGS += -O3 -mcpu=apple-m1 -ffast-math -fno-finite-math-only -fvisibility=hidden -DNDEBUG
endif
else
CC = gcc
CXX = g++
CFLAGS += -Wno-psabi `pkg-config --cflags-only-I gl glfw3 glew fmt glm`
LDFLAGS += `pkg-config --static --libs gl glfw3 glew fmt glm`
LDFLAGS += -pthread -latomic -lfftw3 -lfftw3f
ifeq (@(BUILD_TYPE),release)
CFLAGS += -O3 -march=native -ffast-math -fno-finite-math-only -fvisibility=hidden -DNDEBUG
endif
endif
!cpp = |> $(CXX) $(CFLAGS) $(CFLAGS_%f) -c %f -o %o |> %f.o $(ROOT)/<src_objects>
# !archive = |> ar rs %o |>
!link = |> $(CXX) $(CFLAGS) -o %o %<src_objects> $(LDFLAGS) |> $(BIN_TARGET)
!write_linker_cmd = |> echo "$(CXX) $(CFLAGS) -o $(BIN_TARGET) %<src_objects> $(LDFLAGS)" > %o |> link.sh