1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Examples: Apple: Amend build scripts and gitignore, fix misc OSX warnings. (#8637)

# Conflicts:
#	backends/imgui_impl_metal.mm
This commit is contained in:
ocornut 2025-05-14 18:05:23 +02:00
parent 2df9e9b103
commit b5a73033ab
5 changed files with 31 additions and 36 deletions

4
.gitignore vendored
View file

@ -32,9 +32,10 @@ JSON/
## Commonly used CMake directories
build*/
## Xcode artifacts
## Xcode & macOS artifacts
project.xcworkspace
xcuserdata
examples/*/*.dSYM
## Emscripten artifacts
examples/*.o.tmp
@ -54,6 +55,7 @@ cmake-build-*
## Unix executables from our example Makefiles
examples/example_apple_metal/example_apple_metal
examples/example_apple_opengl2/example_apple_opengl2
examples/example_glfw_metal/example_glfw_metal
examples/example_glfw_opengl2/example_glfw_opengl2
examples/example_glfw_opengl3/example_glfw_opengl3

View file

@ -477,7 +477,7 @@ bool ImGui_ImplOSX_Init(NSView* view)
[view addSubview:bd->KeyEventResponder];
ImGui_ImplOSX_AddTrackingArea(view);
platform_io.Platform_SetImeDataFn = [](ImGuiContext*, ImGuiViewport* viewport, ImGuiPlatformImeData* data) -> void
platform_io.Platform_SetImeDataFn = [](ImGuiContext*, ImGuiViewport*, ImGuiPlatformImeData* data) -> void
{
ImGui_ImplOSX_Data* bd = ImGui_ImplOSX_GetBackendData();
if (data->WantVisible)

View file

@ -130,6 +130,7 @@ Other changes:
- Backends: Vulkan: fixed validation errors in window create/resize helpers used by examples
and by multi-viewports implementation, which would typically trigger errors while detaching
secondary viewports. (#8600, #8176) [@ChrisTom-94]
- Examples: Apple+Metal, Apple+OpenGL: add Makefile (CLion opens them nicely). (#8637) [@pthom]
- Examples: DirectX12+Win32: also test for IsIconic() for sleeping since we don't seem to
get a DXGI_STATUS_OCCLUDED signal when minimized. (#8603) [@dooann]

View file

@ -1,25 +1,21 @@
# 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)
CXX = clang++
EXE = example_apple_metal
IMGUI_DIR = ../../
SOURCES = main.mm
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
SOURCES += $(IMGUI_DIR)/backends/imgui_impl_osx.mm $(IMGUI_DIR)/backends/imgui_impl_metal.mm
.PHONY: all run clean
CXXFLAGS = -std=c++11 -ObjC++ -fobjc-arc -Wall -Wextra -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
FRAMEWORKS = -framework AppKit -framework Metal -framework MetalKit -framework QuartzCore -framework GameController
all: $(EXE)
all: $(TARGET)
$(TARGET): $(SRC)
$(EXE): $(SOURCES)
$(CXX) $(CXXFLAGS) $^ $(FRAMEWORKS) -o $@
run: all
./$(TARGET)
./$(EXE)
clean:
rm -f $(TARGET) *.o
rm -f $(EXE) *.o

View file

@ -1,25 +1,21 @@
IMGUI_DIR = ../../
# Makefile for example_apple_metal, for macOS only (**not iOS**)
CXX = clang++
CXXFLAGS = -std=c++17 -ObjC++ -Wall -Wextra -g -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
EXE = example_apple_opengl2
IMGUI_DIR = ../../
SOURCES = main.mm
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
SOURCES += $(IMGUI_DIR)/backends/imgui_impl_osx.mm $(IMGUI_DIR)/backends/imgui_impl_opengl2.cpp
CXXFLAGS = -std=c++11 -ObjC++ -fobjc-arc -Wall -Wextra -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
FRAMEWORKS = -framework Cocoa -framework OpenGL -framework GameController
SOURCES = \
main.mm \
$(IMGUI_DIR)/backends/imgui_impl_osx.mm \
$(IMGUI_DIR)/backends/imgui_impl_opengl2.cpp \
$(IMGUI_DIR)/imgui.cpp \
$(IMGUI_DIR)/imgui_draw.cpp \
$(IMGUI_DIR)/imgui_demo.cpp \
$(IMGUI_DIR)/imgui_tables.cpp \
$(IMGUI_DIR)/imgui_widgets.cpp
all: $(EXE)
TARGET = imgui_example_apple_opengl2
$(EXE): $(SOURCES)
$(CXX) $(CXXFLAGS) $(SOURCES) -o $(EXE) $(FRAMEWORKS)
all: $(TARGET)
$(TARGET): $(SOURCES)
$(CXX) $(CXXFLAGS) $(SOURCES) -o imgui_example_apple_opengl2 $(FRAMEWORKS)
run: all
./$(EXE)
clean:
rm -f $(TARGET)
rm -rf $(TARGET).dSYM
rm -f $(EXE) *.o