forked from bjornbytes/lovr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tuprules.tup
117 lines (101 loc) · 3.45 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
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
107
108
109
110
111
112
113
114
115
116
117
ROOT = $(TUP_CWD)
## Base
CFLAGS += -std=c99 -pedantic
CFLAGS += -D_POSIX_C_SOURCE=200809L
CFLAGS += -I$(ROOT)/src
CFLAGS += -I$(ROOT)/src/modules
CFLAGS += -fvisibility=hidden
CFLAGS += -Wall -Wextra
CFLAGS += -Wno-unused-parameter
CFLAGS_@(OPENVR) += -Wno-typedef-redefinition
CFLAGS_@(STRICT) += -Werror
CFLAGS_@(DEBUG) += -g
CFLAGS_@(OPTIMIZE) += -Os
CFLAGS_@(SANITIZE) += -fsanitize=address,undefined
LDFLAGS_@(SANITIZE) += -fsanitize=address,undefined
## Modules
CFLAGS_@(AUDIO) += -DLOVR_ENABLE_AUDIO
CFLAGS_@(DATA) += -DLOVR_ENABLE_DATA
CFLAGS_@(EVENT) += -DLOVR_ENABLE_EVENT
CFLAGS_@(FILESYSTEM) += -DLOVR_ENABLE_FILESYSTEM
CFLAGS_@(GRAPHICS) += -DLOVR_ENABLE_GRAPHICS
CFLAGS_@(GRAPHICS) += -DLOVR_@(GL)
CFLAGS_@(HEADSET) += -DLOVR_ENABLE_HEADSET
CFLAGS_@(MATH) += -DLOVR_ENABLE_MATH
CFLAGS_@(PHYSICS) += -DLOVR_ENABLE_PHYSICS
CFLAGS_@(THREAD) += -DLOVR_ENABLE_THREAD
CFLAGS_@(TIMER) += -DLOVR_ENABLE_TIMER
CFLAGS_@(JSON) += -DLOVR_ENABLE_JSON
CFLAGS_@(ENET) += -DLOVR_ENABLE_ENET
## Headset backends
CFLAGS_@(SIMULATOR) += -DLOVR_USE_DESKTOP_HEADSET
CFLAGS_@(OPENVR) += -DLOVR_USE_OPENVR
CFLAGS_@(OPENXR) += -DLOVR_USE_OPENXR
CFLAGS_@(OCULUS) += -DLOVR_USE_OCULUS
CFLAGS_@(OCULUS) += -I@(OCULUS_PATH)/LibOVR/Include
CFLAGS_@(VRAPI) += -DLOVR_USE_OCULUS_MOBILE
CFLAGS_@(WEBVR) += -DLOVR_USE_WEBVR
CFLAGS_@(LEAP) += -DLOVR_USE_LEAP
## Platforms
# A little gnarly, but basically you can set CONFIG_PLATFORM to pick a specific one, otherwise
# we use the builtin TUP_PLATFORM which is the current OS (so it won't work with android/web).
# Also macosx gets converted to macos
ifeq (@(PLATFORM),)
PLATFORM = @(TUP_PLATFORM)
else
PLATFORM = @(PLATFORM)
endif
ifeq ($(PLATFORM),macosx)
PLATFORM = macos
endif
ifeq ($(PLATFORM),macos)
LDFLAGS += -lobjc
LDFLAGS += -pagezero_size 10000 -image_base 100000000
ORIGIN = @executable_path
SO = dylib
endif
ifeq ($(PLATFORM),linux)
LDFLAGS += -lm -lpthread
ORIGIN = \$ORIGIN
SO = so
endif
## Libraries
ifeq (@(CMAKE_DEPS),y)
# enet
CFLAGS_@(ENET) += -I$(ROOT)/deps/enet/include
LDFLAGS_@(ENET) += -L$(ROOT)/build/enet -lenet
# LuaJIT
CFLAGS += -I$(ROOT)/deps/luajit/src
LDFLAGS += -L$(ROOT)/build/luajit/src -lluajit
LIBS += $(ROOT)/build/luajit/src/libluajit.$(SO)
# msdfgen
CFLAGS_@(DATA) += -I$(ROOT)/deps/msdfgen
LDFLAGS_@(DATA) += -L$(ROOT)/build/lib_msdfgen -lmsdfgen
LIBS_@(DATA) += $(ROOT)/build/lib_msdfgen/libmsdfgen.$(SO)
# ode
CFLAGS_@(PHYSICS) += -I$(ROOT)/deps/ode/include -I$(ROOT)/build/ode/include
LDFLAGS_@(PHYSICS) += -L$(ROOT)/build/ode -lode
LIBS_@(PHYSICS) += $(ROOT)/build/ode/libode.$(SO)
# glfw
CFLAGS += -I$(ROOT)/deps/glfw/include
LDFLAGS += -L$(ROOT)/build/glfw/src -lglfw
LIBS += $(ROOT)/build/glfw/src/libglfw.*$(SO)*
# OpenVR
CFLAGS_@(OPENVR) += -I$(ROOT)/deps/openvr/headers
LDFLAGS_@(OPENVR) += -L$(ROOT)/build/openvr_api -lopenvr_api
LIBS_@(OPENVR) += $(ROOT)/build/openvr_api/libopenvr_api.$(SO)
# OpenAL
CFLAGS_@(AUDIO) += -I$(ROOT)/deps/openal-soft/include
LDFLAGS_@(AUDIO) += -L$(ROOT)/build/openal -lopenal
LIBS_@(AUDIO) += $(ROOT)/build/openal/libopenal.*$(SO)*
# Configure rpath to look for libraries in a `libs` folder next to the executable
LDFLAGS += -Wl,-rpath,$(ORIGIN)/libs
LIBS += $(LIBS_y)
endif
CFLAGS += @(EXTRA_CFLAGS)
LDFLAGS += @(EXTRA_LDFLAGS)
## Macros
!cc = |> ^ CC %b^ @(CC) $(CFLAGS_y) $(CFLAGS) -c %f -o %o |>
!ld = |> ^ LD %o^ @(CC) -o %o %f $(LDFLAGS_y) $(LDFLAGS) |>
!xd = |> ^ XD %f^ xxd -i %f > %o |>
!cp = |> ^ CP %b^ cp %f %o |>