Skip to content

Commit

Permalink
Merge 0b15880 into fd213d1
Browse files Browse the repository at this point in the history
  • Loading branch information
ronsaldo committed Nov 13, 2018
2 parents fd213d1 + 0b15880 commit 1b2412c
Show file tree
Hide file tree
Showing 16 changed files with 3,081 additions and 18 deletions.
4 changes: 2 additions & 2 deletions build.macos32x86/common/Makefile.app
Expand Up @@ -144,13 +144,13 @@ $(VMLOCALIZATION): $(OSXCOMMONDIR)/English.lproj/$(SYSTEM)-Localizable.strings
@mkdir -p $(dir $@)
cp -p $< $@

$(VMMENUNIB): $(PLATDIR)/iOS/vm/English.lproj/MainMenu.xib
$(VMMENUNIB): $(PLATDIR)/iOS/vm/English.lproj/MainMenu-opengl.xib
@mkdir -p $(dir $@)
$(XCUB)/ibtool --errors --warnings --notices --module $(VM) \
--minimum-deployment-target $(TARGET_VERSION_MIN) \
--auto-activate-custom-fonts --output-format human-readable-text \
--compile $(VMMENUNIB) \
$(PLATDIR)/iOS/vm/English.lproj/MainMenu.xib
$(PLATDIR)/iOS/vm/English.lproj/MainMenu-opengl.xib

$(APP)/Contents/Resources/%.icns: $(OSXDIR)/%.icns
@mkdir -p $(APP)/Contents/Resources
Expand Down
2 changes: 1 addition & 1 deletion build.macos32x86/common/Makefile.flags
Expand Up @@ -29,7 +29,7 @@ ifdef CLANG_7_3_OR_ABOVE
else
OBJC_CODE_MODEL := -fno-objc-arc
endif
CFLAGS:=$(CFLAGS) -DBUILD_FOR_OSX=1 \
CFLAGS:=$(CFLAGS) -DBUILD_FOR_OSX=1 -DNO_METAL=1 \
-arch $(TARGET_ARCH) \
-mmacosx-version-min=$(TARGET_VERSION_MIN) -msse4.2 \
-fvisibility=default -fwrapv \
Expand Down
7 changes: 4 additions & 3 deletions build.macos64x64/common/Makefile.flags
Expand Up @@ -6,8 +6,8 @@
XCODE:=$(shell /usr/bin/xcode-select -p)
XCUB:=$(XCODE)/usr/bin
SDKsDIR:=$(XCODE)/Platforms/MacOSX.platform/Developer/SDKs
#Build the oldest SDK installed (must be MacOSX10.10.sdk and later)
SDKs:=MacOSX10.10.sdk MacOSX10.11.sdk MacOSX10.12.sdk MacOSX10.13.sdk MacOSX10.14.sdk
#Build the oldest SDK installed (must be MacOSX10.11.sdk because of Metal and later)
SDKs:=MacOSX10.11.sdk MacOSX10.12.sdk MacOSX10.13.sdk MacOSX10.14.sdk
SDK:=$(firstword $(realpath $(addprefix $(SDKsDIR)/, $(SDKs))))
ifeq ($(strip $(SDK)),)
$(error could not find a valid SDK)
Expand Down Expand Up @@ -58,4 +58,5 @@ FRAMEWORKS:=-fobjc-link-runtime \
-framework AudioToolbox -framework CoreAudio \
-framework SystemConfiguration \
-framework ApplicationServices -framework Security \
-framework QuartzCore
-framework QuartzCore \
-framework Metal -framework MetalKit
3 changes: 2 additions & 1 deletion build.macos64x64/common/Makefile.rules
Expand Up @@ -7,6 +7,7 @@
# /usr/bin/clang, a.k.a. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CC := clang
LD := clang

LDCXX := clang++ # For linking c++ bundles

include ../common/Makefile.flags
Expand All @@ -29,6 +30,6 @@ $(OBJDIR)/%.o: %.cpp deps/%.d $(MAKEFILE)

deps/%.d: ;

.PRECIOUS: deps/%.d
.PRECIOUS: deps/%.d $(OBJDIR)/%.air $(OBJDIR)/%.metallib

-include $(patsubst %,deps/%.d,$(notdir $(basename $(VMSRC) $(LIBSRC))))
1 change: 1 addition & 0 deletions build.macos64x64/common/Makefile.vm
Expand Up @@ -106,6 +106,7 @@ endif
TZ:=$(shell date +%Z)
DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
-DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
-DUSE_METAL=1 \
$(INTERPFLAGS)
XDEFS:= -DSQUEAK_BUILTIN_PLUGIN
CFLAGS:= $(OFLAGS) $(COGDEFS) $(DEBUGVM) $(DEFS) $(XDEFS)
Expand Down
14 changes: 10 additions & 4 deletions platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m
Expand Up @@ -43,11 +43,13 @@ Some of this code was funded via a grant from the European Smalltalk User Group
#import "sqSqueakNullScreenAndWindow.h"
#import "sqaio.h"

#if !defined(USE_METAL)
# import <OpenGL/gl.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
# import <OpenGL/OpenGL.h>
#else
# import <OpenGL/Opengl.h>
# if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
# import <OpenGL/OpenGL.h>
# else
# import <OpenGL/Opengl.h>
# endif
#endif

extern sqSqueakAppDelegate *gDelegateApp;
Expand Down Expand Up @@ -94,16 +96,19 @@ extern void setIoProcessEventsHandler(void * handler) {
sqInt ioProcessEvents(void) {
aioPoll(0);

#if !defined(USE_METAL)
// We need to restore the opengl context to whatever the image was
// already using. This is required by SDL2 in Pharo.
NSOpenGLContext *oldContext = [NSOpenGLContext currentContext];
#endif

// We need to run the vmIOProcessEvents even if we are using SDL2,
// otherwise we end with some double free errors in an autorelease pool.
vmIOProcessEvents();
if(ioProcessEventsHandler && ioProcessEventsHandler != vmIOProcessEvents)
ioProcessEventsHandler();

#if !defined(USE_METAL)
NSOpenGLContext *newContext = [NSOpenGLContext currentContext];
if(oldContext != newContext) {
if (oldContext != nil) {
Expand All @@ -112,6 +117,7 @@ sqInt ioProcessEvents(void) {
[NSOpenGLContext clearCurrentContext];
}
}
#endif

return 0;
}
Expand Down

0 comments on commit 1b2412c

Please sign in to comment.