Build with OpenGL until MetalANGLE works properly

This commit is contained in:
Struma 2020-11-19 20:26:16 -05:00 committed by zzoro
parent 44edd5caa7
commit bbdf83fafc
9 changed files with 237 additions and 742 deletions

View file

@ -23,7 +23,7 @@ INFOPLIST_FILE = $(PROJECT_DIR)/Info.plist
CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/entitlements.plist
OTHER_CFLAGS = -fconstant-string-class=OFConstantString -fno-constant-cfstrings $(inherited)
CLANG_ENABLE_MODULES = NO
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) MKXPZ_BUILD_XCODE GLES2_HEADER ALCDEVICE_STRUCT=ALCdevice_struct SHARED_FLUID
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) MKXPZ_BUILD_XCODE ALCDEVICE_STRUCT=ALCdevice_struct SHARED_FLUID USE_MINIFFI
GCC_C_LANGUAGE_STANDARD = gnu11
GCC_CXX_LANGUAGE_STANDARD = c++11
@ -47,7 +47,6 @@ HEADER_SEARCH_PATHS = $(inherited) "$(DEPENDENCY_SEARCH_PATH)/prefix/include/pix
HEADER_SEARCH_PATHS = $(inherited) "$(DEPENDENCY_SEARCH_PATH)/frameworks/SDL2.framework/Headers/**"
HEADER_SEARCH_PATHS = $(inherited) "$(DEPENDENCY_SEARCH_PATH)/frameworks/SDL2_ttf.framework/Headers/**"
HEADER_SEARCH_PATHS = $(inherited) "$(DEPENDENCY_SEARCH_PATH)/frameworks/SDL2_image.framework/Headers/**"
HEADER_SEARCH_PATHS = $(inherited) "$(DEPENDENCY_SEARCH_PATH)/frameworks/MetalANGLE.framework/Headers/**"
FRAMEWORK_SEARCH_PATHS = "$(DEPENDENCY_SEARCH_PATH)/frameworks" $(inherited)

View file

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.0</string>
<string>$(MARKETING_VERSION)</string>
<key>IFMajorVersion</key>
<integer>0</integer>
<key>IFMinorVersion</key>

File diff suppressed because it is too large Load diff

View file

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3BDB25AF2565175000C4A63D"
BuildableName = "mkxp-z.app"
BlueprintName = "PlayerLegacy"
ReferencedContainer = "container:mkxp-z.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3BDB25AF2565175000C4A63D"
BuildableName = "mkxp-z.app"
BlueprintName = "PlayerLegacy"
ReferencedContainer = "container:mkxp-z.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3BDB25AF2565175000C4A63D"
BuildableName = "mkxp-z.app"
BlueprintName = "PlayerLegacy"
ReferencedContainer = "container:mkxp-z.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -12,22 +12,17 @@
<key>Obtain Dependencies.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>4</integer>
</dict>
<key>Player.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>PlayerLegacy.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>Remove Dependencies.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
<integer>3</integer>
</dict>
<key>gen.xcscheme_^#shared#^_</key>
<dict>

View file

@ -183,7 +183,7 @@ elif host_system == 'darwin'
add_project_link_arguments('-mmacosx-version-min='+minimum_macos_version, language: ['cpp', 'objc', 'objcpp'])
endif
if minimum_macos_version.version_compare('>=10.13') == true
warning('\nIt seems like you are trying to build for macOS versions that include Metal support.\nPlease consider using the Xcode project located in the `macos` directory instead.')
warning('Please consider using the Xcode project located in the `macos` directory instead.')
endif
else
subdir('linux')

View file

@ -21,7 +21,7 @@ option('appimage', type: 'boolean', value: false, description: 'Whether to insta
option('steamworks_path', type: 'string', value: '', description: 'Path to Steamshim')
option('steam_appid', type: 'string', value: '', description: 'Steam AppID. Set this to use SteamAPI_RestartAppIfNecessary')
option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles', 'metal'], description: 'Graphics rendering API to use. Metal is achieved through MetalANGLE.')
option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles'], description: 'Graphics rendering API to use.')
option('codesign', type: 'boolean', value: false, description: 'Whether to codesign the Mac app bundle upon creation. If codesign_identity is not set, signs for local use.')
option('codesign_identity', type: 'string', value: '', description: 'A valid Apple Developer ID for signing Mac apps.')

View file

@ -172,6 +172,10 @@ int main(int argc, char *argv[]) {
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
#ifdef GLES2_HEADER
SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "1");
#endif
/* initialize SDL first */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0) {
showInitError(std::string("Error initializing SDL: ") + SDL_GetError());
@ -454,6 +458,12 @@ static SDL_GLContext initGL(SDL_Window *win, Config &conf,
/* Setup GL context. Must be done in main thread since macOS 10.15 */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#ifdef GLES2_HEADER
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
#endif
if (conf.debugMode)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);