2019-04-08 17:16:45 +00:00
|
|
|
#
|
|
|
|
# Cross Platform Makefile
|
|
|
|
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
|
|
|
|
#
|
2020-10-12 15:34:22 +00:00
|
|
|
# Important: This is a "null backend" application, with no visible output or interaction!
|
2020-03-19 10:10:58 +00:00
|
|
|
# This is used for testing purpose and continuous integration, and has little use for end-user.
|
|
|
|
#
|
2019-04-08 17:16:45 +00:00
|
|
|
|
2020-03-19 10:10:58 +00:00
|
|
|
# Options
|
|
|
|
WITH_EXTRA_WARNINGS ?= 0
|
2020-03-18 07:26:51 +00:00
|
|
|
WITH_FREETYPE ?= 0
|
2020-03-19 10:10:58 +00:00
|
|
|
|
|
|
|
EXE = example_null
|
2020-10-12 13:41:57 +00:00
|
|
|
IMGUI_DIR = ../..
|
2020-01-10 17:36:26 +00:00
|
|
|
SOURCES = main.cpp
|
2020-10-07 10:04:28 +00:00
|
|
|
SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp
|
2019-04-08 17:16:45 +00:00
|
|
|
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
|
2022-02-15 16:06:50 +00:00
|
|
|
CXXFLAGS += -std=c++11 -I$(IMGUI_DIR)
|
2019-04-08 17:16:45 +00:00
|
|
|
CXXFLAGS += -g -Wall -Wformat
|
|
|
|
LIBS =
|
|
|
|
|
2020-03-19 10:10:58 +00:00
|
|
|
# We use the WITH_EXTRA_WARNINGS flag on our CI setup to eagerly catch zealous warnings
|
|
|
|
ifeq ($(WITH_EXTRA_WARNINGS), 1)
|
2019-11-25 12:02:47 +00:00
|
|
|
CXXFLAGS += -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros
|
|
|
|
endif
|
|
|
|
|
2020-03-19 10:10:58 +00:00
|
|
|
# We use the WITH_FREETYPE flag on our CI setup to test compiling misc/freetype/imgui_freetype.cpp
|
|
|
|
# (only supported on Linux, and note that the imgui_freetype code currently won't be executed)
|
2020-03-18 07:26:51 +00:00
|
|
|
ifeq ($(WITH_FREETYPE), 1)
|
2020-10-12 13:41:57 +00:00
|
|
|
SOURCES += $(IMGUI_DIR)/misc/freetype/imgui_freetype.cpp
|
2020-03-18 07:26:51 +00:00
|
|
|
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"
|
2021-08-18 10:00:15 +00:00
|
|
|
ifeq ($(WITH_EXTRA_WARNINGS), 1)
|
2020-06-05 10:04:55 +00:00
|
|
|
CXXFLAGS += -Wextra -Wpedantic
|
|
|
|
ifeq ($(shell $(CXX) -v 2>&1 | grep -c "clang version"), 1)
|
|
|
|
CXXFLAGS += -Wshadow -Wsign-conversion
|
|
|
|
endif
|
2019-11-25 12:02:47 +00:00
|
|
|
endif
|
2019-04-08 17:16:45 +00:00
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(UNAME_S), Darwin) #APPLE
|
|
|
|
ECHO_MESSAGE = "Mac OS X"
|
2021-08-18 10:00:15 +00:00
|
|
|
ifeq ($(WITH_EXTRA_WARNINGS), 1)
|
2022-02-15 16:06:50 +00:00
|
|
|
CXXFLAGS += -Weverything -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-padded -Wno-poison-system-directories
|
2019-11-25 12:02:47 +00:00
|
|
|
endif
|
2019-04-08 17:16:45 +00:00
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
endif
|
|
|
|
|
2021-02-24 08:26:13 +00:00
|
|
|
ifeq ($(OS), Windows_NT)
|
2019-04-08 17:16:45 +00:00
|
|
|
ECHO_MESSAGE = "MinGW"
|
2021-08-18 10:00:15 +00:00
|
|
|
ifeq ($(WITH_EXTRA_WARNINGS), 1)
|
2020-06-05 10:04:55 +00:00
|
|
|
CXXFLAGS += -Wextra -Wpedantic
|
2019-11-25 12:02:47 +00:00
|
|
|
endif
|
2021-02-24 08:26:13 +00:00
|
|
|
LIBS += -limm32
|
2019-04-08 17:16:45 +00:00
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
##---------------------------------------------------------------------
|
|
|
|
## BUILD RULES
|
|
|
|
##---------------------------------------------------------------------
|
|
|
|
|
|
|
|
%.o:%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
%.o:$(IMGUI_DIR)/%.cpp
|
2019-04-08 17:16:45 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
%.o:$(IMGUI_DIR)/backends/%.cpp
|
2019-04-08 17:16:45 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
%.o:$(IMGUI_DIR)/misc/freetype/%.cpp
|
2020-03-18 07:26:51 +00:00
|
|
|
$(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)
|