-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
69 lines (53 loc) · 1.79 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
56
57
58
59
60
61
62
63
64
65
66
67
68
CC = emcc
CXX = em++
INC_DIR = inc
SRC_DIR = src
WEB_DIR = out
EXE=out/new_template.js
#EXE=out/simpletexture.js
EMS_DIR = $(SRC_DIR)/ems
SOURCES = main.cpp $(SRC_DIR)/Camera.cpp $(SRC_DIR)/CameraController.cpp $(EMS_DIR)/glue.cpp $(EMS_DIR)/webgpu.cpp $(EMS_DIR)/window.cpp
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
##---------------------------------------------------------------------
## EMSCRIPTEN OPTIONS
##---------------------------------------------------------------------
EMS += -s USE_WEBGPU=1 -s WASM=1
EMS += -s ALLOW_MEMORY_GROWTH=1
EMS += -s DISABLE_EXCEPTION_CATCHING=1 -s EXIT_RUNTIME=1
EMS += -s ASSERTIONS=0 -s FILESYSTEM=1 -s --use-preload-plugins
EMS += -s USE_SDL=2 -s USE_LIBJPEG=1 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["bmp","png","jpg"]'
LDFLAGS = --no-heap-copy --preload-file out/texture
##---------------------------------------------------------------------
## FINAL BUILD FLAGS
##---------------------------------------------------------------------
CPPFLAGS = -I$(INC_DIR) -Ilib/glm
CPPFLAGS += -Wall -Wformat -Os
CPPFLAGS += $(EMS)
LIBS = $(EMS)
##---------------------------------------------------------------------
## BUILD RULES
##---------------------------------------------------------------------
%.o:$(SRC_DIR)/%.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
%.o:$(EMS_DIR)/%.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
all: $(EXE)
@echo Build complete for $(EXE)
$(WEB_DIR):
mkdir $@
## python -m SimpleHTTPServer
serve: all
pm2 delete server
cd vs_editor && \
npm run build && \
cd .. && \
pm2 start out/server.js
$(EXE): $(OBJS) $(WEB_DIR)
$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
clean:
rm -f $(OBJS)
rm -f out/temp/*
rm -rf out/texture
cp -r texture out/
rm -rf out/node_modules
find . -name ‘.DS_Store’ -type f -delete