2020-02-07 20:48:59 +00:00
|
|
|
#
|
|
|
|
# You will need SDL2 (http://www.libsdl.org):
|
|
|
|
# brew install sdl2
|
|
|
|
#
|
|
|
|
|
|
|
|
#CXX = g++
|
|
|
|
#CXX = clang++
|
|
|
|
|
|
|
|
EXE = example_sdl_metal
|
2020-10-12 13:41:57 +00:00
|
|
|
IMGUI_DIR = ../..
|
2020-02-07 20:48:59 +00:00
|
|
|
SOURCES = main.mm
|
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
|
2020-10-12 13:41:57 +00:00
|
|
|
SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_metal.mm
|
2020-02-07 20:48:59 +00:00
|
|
|
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
|
|
|
|
|
|
|
LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore
|
|
|
|
LIBS += `sdl2-config --libs`
|
|
|
|
LIBS += -L/usr/local/lib
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
CXXFLAGS = -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I/usr/local/include
|
2020-02-07 20:48:59 +00:00
|
|
|
CXXFLAGS += `sdl2-config --cflags`
|
|
|
|
CXXFLAGS += -Wall -Wformat
|
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
|
|
|
|
%.o:%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
%.o:$(IMGUI_DIR)/%.cpp
|
2020-02-07 20:48:59 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
%.o:$(IMGUI_DIR)/backends/%.cpp
|
2020-02-07 20:48:59 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
%.o:%.mm
|
2020-02-07 20:48:59 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $<
|
|
|
|
|
2020-10-12 13:41:57 +00:00
|
|
|
%.o:$(IMGUI_DIR)/backends/%.mm
|
2020-02-07 20:48:59 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $<
|
|
|
|
|
|
|
|
all: $(EXE)
|
|
|
|
@echo Build complete
|
|
|
|
|
|
|
|
$(EXE): $(OBJS)
|
|
|
|
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(EXE) $(OBJS)
|