-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
143 lines (109 loc) · 3.6 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#
# Cross Platform Makefile
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
#
# You will need GLFW (http://www.glfw.org):
# Linux:
# apt-get install libglfw-dev
# Mac OS X:
# brew install glfw
# MSYS2:
# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw
#
#CXX = g++
#CC = g++
#CXX = clang++
EXE = bin/main
SOURCES = main.cpp
SOURCES +=reactor.cpp
SOURCES += C:/libs/imgui/examples/imgui_impl_glfw.cpp C:/libs/imgui/examples/imgui_impl_opengl3.cpp
SOURCES += C:/libs/imgui/imgui.cpp C:/libs/imgui/imgui_draw.cpp C:/libs/imgui/imgui_widgets.cpp
#SOURCES += C:/libs/imgui/imgui.cpp C:/libs/imgui/imgui_draw.cpp C:/libs/imgui/imgui_widgets.cpp C:/libs/imgui/imgui_demo.cpp
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
UNAME_S := $(shell uname -s)
CXXFLAGS = -IC:/libs/imgui/examples -IC:/libs/imgui
CXXFLAGS += -g -Wall -Wformat
LIBS =
## Other Libs
CXXFLAGS+= -IC:/libs/Eigen -IC:/libs/stb
CXXFLAGS+= -IC:/libs/cpp-httplib
##-------
## GLFW OpenGL Library
CXXFLAGS+=-IC:/libs/glfw/include
LIBS+=-LC:/libs/glfw/lib
##
##---------------------------------------------------------------------
## OPENGL LOADER
##---------------------------------------------------------------------
## Using OpenGL loader: gl3w [default]
SOURCES += C:/libs/gl3w/src/gl3w.c
CXXFLAGS += -IC:/libs/gl3w/include -DIMGUI_IMPL_OPENGL_LOADER_GL3W
## Using OpenGL loader: glew
## (This assumes a system-wide installation)
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
# LIBS += -lGLEW
## Using OpenGL loader: glad
# SOURCES += ../libs/glad/src/glad.c
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
## Using OpenGL loader: glad2
# SOURCES += ../libs/glad/src/gl.c
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD2
## Using OpenGL loader: glbinding
## This assumes a system-wide installation
## of either version 3.0.0 (or newer)
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
# LIBS += -lglbinding
## or the older version 2.x
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
# LIBS += -lglbinding
##---------------------------------------------------------------------
## BUILD FLAGS PER PLATFORM
##---------------------------------------------------------------------
ifeq ($(UNAME_S), Linux) #LINUX
ECHO_MESSAGE = "Linux"
LIBS += -lGL `pkg-config --static --libs glfw3`
CXXFLAGS += `pkg-config --cflags glfw3`
CFLAGS = $(CXXFLAGS)
endif
ifeq ($(UNAME_S), Darwin) #APPLE
ECHO_MESSAGE = "Mac OS X"
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
LIBS += -L/usr/local/lib -L/opt/local/lib
#LIBS += -lglfw3
LIBS += -lglfw
CXXFLAGS += -I/usr/local/include -I/opt/local/include
CFLAGS = $(CXXFLAGS)
endif
ifeq ($(OS),Windows_NT)
ECHO_MESSAGE = "MinGW"
LIBS += -lglfw3dll -lws2_32
#Habilite para não mostrar o console
CXXFLAGS+=-mwindows
#CXXFLAGS+=-m32
#-lglfw3 -lgdi32 -lopengl32 -limm32
#CXXFLAGS += `pkg-config --cflags glfw3`
CXX = g++
CC = gcc
CFLAGS = $(CXXFLAGS)
endif
##---------------------------------------------------------------------
## BUILD RULES
##---------------------------------------------------------------------
#LIBS += -lglfw3dll -lglfw3 -lgdi32 -lopengl32 -limm32
CFLAGS = $(CXXFLAGS)
%.o:%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:C:/libs/imgui/examples/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:C:/libs/imgui/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o:C:/libs/gl3w/src/%.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o:../libs/glad/src/%.c
$(CC) $(CFLAGS) -c -o $@ $<
all: $(EXE)
@echo Build complete for $(ECHO_MESSAGE)
$(EXE): $(OBJS)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
clean:
rm -f $(EXE) $(OBJS)