mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-01 21:17:42 -05:00
Examples: Apple: add Makefile for example_apple_metal, example_apple_opengl2. (#8637)
- Works only for macOS: use XCode for iOS - It will produce a raw exe. It will not a produce an macOS application bundle (i.e a folder that includes exe and resources). To get app bundles, use the XCode project. - An adjustment was required in main.mm (for macOS only), to ensure that the exe can run without any plist or storyboard under macOS
This commit is contained in:
25
examples/example_apple_metal/Makefile
Normal file
25
examples/example_apple_metal/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
# Makefile for example_apple_metal, for macOS only (**not iOS**)
|
||||
TARGET := example_apple_metal
|
||||
CXX := clang++
|
||||
CXXFLAGS := -std=c++17 -ObjC++ -fobjc-arc -Wall -Wextra \
|
||||
-I../../ \
|
||||
-I../../backends
|
||||
FRAMEWORKS := -framework AppKit -framework Metal -framework MetalKit -framework QuartzCore -framework GameController
|
||||
IMGUI_SRC := ../../imgui.cpp ../../imgui_draw.cpp ../../imgui_demo.cpp \
|
||||
../../imgui_tables.cpp ../../imgui_widgets.cpp
|
||||
BACKENDS := ../../backends/imgui_impl_metal.mm ../../backends/imgui_impl_osx.mm
|
||||
SRC := main.mm $(IMGUI_SRC) $(BACKENDS)
|
||||
|
||||
.PHONY: all run clean
|
||||
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(SRC)
|
||||
$(CXX) $(CXXFLAGS) $^ $(FRAMEWORKS) -o $@
|
||||
|
||||
run: all
|
||||
./$(TARGET)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) *.o
|
||||
@@ -319,9 +319,20 @@
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
int main(int, const char**)
|
||||
{
|
||||
return NSApplicationMain(argc, argv);
|
||||
@autoreleasepool
|
||||
{
|
||||
[NSApplication sharedApplication];
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
|
||||
AppDelegate *appDelegate = [[AppDelegate alloc] init]; // creates window
|
||||
[NSApp setDelegate:appDelegate];
|
||||
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[NSApp run];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user