-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
117 lines (89 loc) · 3.13 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
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
#
# Cross Platform Makefile
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
#
# You will need SDL2 (http://www.libsdl.org):
# Linux:
# apt-get install libsdl2-dev
# Mac OS X:
# brew install sdl2
# MSYS2:
# pacman -S mingw-w64-i686-SDL
#
#CXX = g++
#CXX = clang++
EXE = sql-gui
SOURCES = main.cpp
SOURCES += imgui/examples/imgui_impl_sdl.cpp imgui/examples/imgui_impl_opengl3.cpp
SOURCES += imgui/imgui.cpp imgui/imgui_demo.cpp imgui/imgui_draw.cpp imgui/imgui_widgets.cpp imgui/imgui_tables.cpp
SOURCES += ImGuiColorTextEdit/TextEditor.cpp
SOURCES += sqlite/sqlite3.c
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
UNAME_S := $(shell uname -s)
CFLAGS = -I./imgui/examples/ -I./imgui/ -I./imgui/backends -I./sqlite
CFLAGS += -g -Wall -Wformat
LIBS =
CXXFLAGS = -std=c++11 $(CFLAGS)
##---------------------------------------------------------------------
## OPENGL LOADER
##---------------------------------------------------------------------
## Using OpenGL loader: gl3w [default]
SOURCES += imgui/examples/libs/gl3w/GL/gl3w.c
CFLAGS += -Iimgui/examples/libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
## Using OpenGL loader: glew
## (This assumes a system-wide installation)
# CXXFLAGS += -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW
## Using OpenGL loader: glad
# SOURCES += imgui/examples/libs/glad/src/glad.c
# CXXFLAGS += -Iimgui/examples/libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
## Using OpenGL loader: glbinding
## This assumes a system-wide installation
## of either version 3.0.0 (or newer)
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
## or the older version 2.x
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
##---------------------------------------------------------------------
## BUILD FLAGS PER PLATFORM
##---------------------------------------------------------------------
ifeq ($(UNAME_S), Linux) #LINUX
ECHO_MESSAGE = "Linux"
LIBS += -lGL -ldl `sdl2-config --libs` -lpthread
CFLAGS += `sdl2-config --cflags`
endif
ifeq ($(UNAME_S), Darwin) #APPLE
ECHO_MESSAGE = "Mac OS X"
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
LIBS += -L/usr/local/lib
CFLAGS += `sdl2-config --cflags`
CFLAGS += -I/usr/local/include
endif
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
ECHO_MESSAGE = "MinGW"
LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2`
CFLAGS += `pkg-config --cflags sdl2`
endif
##---------------------------------------------------------------------
## BUILD RULES
##---------------------------------------------------------------------
%.o:%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:ImGuiColorTextEdit/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:imgui/examples/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:imgui/backends/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:imgui/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:imgui/examples/libs/gl3w/GL/%.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o:imgui/examples/libs/glad/src/%.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o:sqlite/%.c
$(CC) $(CFLAGS) -c -o $@ $<
all: $(EXE)
@echo Build complete for $(ECHO_MESSAGE)
$(EXE): $(OBJS)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
clean:
rm -f $(EXE) $(OBJS)