2020-02-07 21:48:59 +01:00
|
|
|
#
|
|
|
|
# You will need SDL2 (http://www.libsdl.org):
|
|
|
|
# brew install sdl2
|
|
|
|
#
|
|
|
|
|
|
|
|
#CXX = g++
|
|
|
|
#CXX = clang++
|
|
|
|
|
2023-02-07 11:54:50 +01:00
|
|
|
EXE = example_sdl2_metal
|
2020-10-12 15:41:57 +02:00
|
|
|
IMGUI_DIR = ../..
|
2020-02-07 21:48:59 +01:00
|
|
|
SOURCES = main.mm
|
2020-10-07 12:04:28 +02: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
|
2023-02-07 11:54:50 +01:00
|
|
|
SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl2.cpp $(IMGUI_DIR)/backends/imgui_impl_metal.mm
|
2020-02-07 21:48:59 +01: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
|
|
|
|
|
2022-02-15 17:06:50 +01:00
|
|
|
CXXFLAGS = -std=c++11 -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I/usr/local/include
|
2020-02-07 21:48:59 +01:00
|
|
|
CXXFLAGS += `sdl2-config --cflags`
|
|
|
|
CXXFLAGS += -Wall -Wformat
|
|
|
|
CFLAGS = $(CXXFLAGS)
|
|
|
|
|
|
|
|
%.o:%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 15:41:57 +02:00
|
|
|
%.o:$(IMGUI_DIR)/%.cpp
|
2020-02-07 21:48:59 +01:00
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 15:41:57 +02:00
|
|
|
%.o:$(IMGUI_DIR)/backends/%.cpp
|
2020-02-07 21:48:59 +01:00
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2020-10-12 15:41:57 +02:00
|
|
|
%.o:%.mm
|
2020-02-07 21:48:59 +01:00
|
|
|
$(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $<
|
|
|
|
|
2020-10-12 15:41:57 +02:00
|
|
|
%.o:$(IMGUI_DIR)/backends/%.mm
|
2020-02-07 21:48:59 +01: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)
|