2019-04-08 17:16:45 +00:00
|
|
|
#
|
|
|
|
# Cross Platform Makefile
|
|
|
|
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
|
|
|
|
#
|
|
|
|
|
|
|
|
EXE = example_null
|
2019-11-26 09:24:01 +00:00
|
|
|
EXTRA_WARNINGS ?= 0
|
2020-03-18 07:26:51 +00:00
|
|
|
WITH_FREETYPE ?= 0
|
2020-01-10 17:36:26 +00:00
|
|
|
SOURCES = main.cpp
|
|
|
|
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
|
2019-04-08 17:16:45 +00:00
|
|
|
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
|
2019-11-26 10:17:58 +00:00
|
|
|
CXXFLAGS += -I../ -I../../
|
2019-04-08 17:16:45 +00:00
|
|
|
CXXFLAGS += -g -Wall -Wformat
|
|
|
|
LIBS =
|
|
|
|
|
2019-11-25 12:02:47 +00:00
|
|
|
# We use the EXTRA_WARNINGS flag on our CI setup to eagerly catch zealous warnings
|
|
|
|
ifeq ($(EXTRA_WARNINGS), 1)
|
|
|
|
CXXFLAGS += -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros
|
|
|
|
endif
|
|
|
|
|
2020-03-18 07:26:51 +00:00
|
|
|
# We use the WITH_FREETYPE flag on our CI setup to test misc/freetype/imgui_freetype.cpp font rasterizer
|
|
|
|
ifeq ($(WITH_FREETYPE), 1)
|
|
|
|
SOURCES += ../../misc/freetype/imgui_freetype.cpp
|
|
|
|
CXXFLAGS += $(shell pkg-config --cflags freetype2)
|
|
|
|
LIBS += $(shell pkg-config --libs freetype2)
|
|
|
|
endif
|
|
|
|
|
2019-04-08 17:16:45 +00:00
|
|
|
##---------------------------------------------------------------------
|
|
|
|
## BUILD FLAGS PER PLATFORM
|
|
|
|
##---------------------------------------------------------------------
|
|
|
|
|
|
|
|
ifeq ($(UNAME_S), Linux) #LINUX
|
|
|
|
ECHO_MESSAGE = "Linux"
|
2019-11-25 12:02:47 +00:00
|
|
|
ifneq ($(EXTRA_WARNINGS), 0)
|
|
|
|
CXXFLAGS += -Wextra -pedantic
|
|
|
|
endif
|
2019-04-08 17:16:45 +00:00
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(UNAME_S), Darwin) #APPLE
|
|
|
|
ECHO_MESSAGE = "Mac OS X"
|
2019-11-25 12:02:47 +00:00
|
|
|
ifneq ($(EXTRA_WARNINGS), 0)
|
|
|
|
CXXFLAGS += -Weverything -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-padded -Wno-c++11-long-long
|
|
|
|
endif
|
2019-04-08 17:16:45 +00:00
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
|
|
|
ECHO_MESSAGE = "MinGW"
|
2019-11-25 12:02:47 +00:00
|
|
|
ifneq ($(EXTRA_WARNINGS), 0)
|
|
|
|
CXXFLAGS += -Wextra -pedantic
|
|
|
|
endif
|
2019-04-08 17:16:45 +00:00
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
##---------------------------------------------------------------------
|
|
|
|
## BUILD RULES
|
|
|
|
##---------------------------------------------------------------------
|
|
|
|
|
|
|
|
%.o:%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o:../%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o:../../%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-03-18 07:26:51 +00:00
|
|
|
%.o:../../misc/freetype/%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2019-04-08 17:16:45 +00:00
|
|
|
all: $(EXE)
|
|
|
|
@echo Build complete for $(ECHO_MESSAGE)
|
|
|
|
|
|
|
|
$(EXE): $(OBJS)
|
|
|
|
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(EXE) $(OBJS)
|