diff options
author | Sergey Minakov <naithar@icloud.com> | 2020-07-16 20:04:09 +0300 |
---|---|---|
committer | Sergey Minakov <naithar@icloud.com> | 2020-07-25 21:55:25 +0200 |
commit | fe60815d665ab49662ad570609389276b2ec6038 (patch) | |
tree | 63433e9fa8b08e3286e64d6b4fe5dde23c2227d1 | |
parent | 8e82ab4bf5c518a322cf3a86ae88ffc7bb05b1f9 (diff) |
iOS SCons: static Vulkan binary usage
Add VMA to iphone platform Use linkflag for iphone building to enforce static linking. Works fine with dynamic '.framework' library
Updated xcode project to use '.a' static library
-rw-r--r-- | drivers/vulkan/SCsub | 21 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj | 11 | ||||
-rw-r--r-- | platform/iphone/detect.py | 9 |
3 files changed, 19 insertions, 22 deletions
diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub index 91d0e42f80..436f513d72 100644 --- a/drivers/vulkan/SCsub +++ b/drivers/vulkan/SCsub @@ -22,6 +22,17 @@ if env["platform"] == "android": thirdparty_dir = "#thirdparty/vulkan" vma_sources = [thirdparty_dir + "/android/vk_mem_alloc.cpp"] env_thirdparty.add_source_files(env.drivers_sources, vma_sources) +elif env["platform"] == "iphone": + # Use bundled Vulkan headers + thirdparty_dir = "#thirdparty/vulkan" + env.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include", thirdparty_dir + "/loader"]) + + # Build Vulkan memory allocator + env_thirdparty = env.Clone() + env_thirdparty.disable_warnings() + + vma_sources = [thirdparty_dir + "/vk_mem_alloc.cpp"] + env_thirdparty.add_source_files(env.drivers_sources, vma_sources) elif env["builtin_vulkan"]: # Use bundled Vulkan headers thirdparty_dir = "#thirdparty/vulkan" @@ -70,16 +81,6 @@ elif env["builtin_vulkan"]: 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg", ] ) - elif env["platform"] == "iphone": - env_thirdparty.AppendUnique( - CPPDEFINES=[ - "VK_USE_PLATFORM_IOS_MVK", - "VULKAN_NON_CMAKE_BUILD", - 'SYSCONFDIR=\\"%s\\"' % "/etc", - 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share", - 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg", - ] - ) elif env["platform"] == "linuxbsd": env_thirdparty.AppendUnique( CPPDEFINES=[ diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj index 53f4640851..9a1143a21a 100644 --- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj @@ -12,8 +12,7 @@ $modules_buildfile 1FF8DBB11FBA9DE1009DE660 /* dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */; }; D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D07CD44D1C5D589C00B7FB28 /* Images.xcassets */; }; - 905036DA24BF7D9B00301046 /* MoltenVK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 905036D824BF7D9600301046 /* MoltenVK.framework */; }; - 905036DB24BF7D9B00301046 /* MoltenVK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 905036D824BF7D9600301046 /* MoltenVK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9039D3BE24C093AC0020482C /* MoltenVK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9039D3BD24C093AC0020482C /* MoltenVK.a */; }; 9073252C24BF980B0063BCD4 /* vulkan in Resources */ = {isa = PBXBuildFile; fileRef = 905036DC24BF932E00301046 /* vulkan */; }; D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */; }; D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7718AEBFEB004A7AAE /* $binary.pck */; }; @@ -27,8 +26,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 905036DB24BF7D9B00301046 /* MoltenVK.framework in Embed Frameworks */, - $pbx_embeded_frameworks ); name = "Embed Frameworks"; @@ -42,7 +39,7 @@ $modules_fileref 1FF4C1881F584E6300A41E41 /* $binary.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "$binary.entitlements"; sourceTree = "<group>"; }; 1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dummy.cpp; sourceTree = "<group>"; }; - 905036D824BF7D9600301046 /* MoltenVK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MoltenVK.framework; sourceTree = "<group>"; }; + 9039D3BD24C093AC0020482C /* MoltenVK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = MoltenVK; path = MoltenVK.a; sourceTree = "<group>"; }; 905036DC24BF932E00301046 /* vulkan */ = {isa = PBXFileReference; lastKnownFileType = folder; name = vulkan; path = "$binary/vulkan"; sourceTree = "<group>"; }; D07CD44D1C5D589C00B7FB28 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; }; D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "$binary.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -59,7 +56,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 905036DA24BF7D9B00301046 /* MoltenVK.framework in Frameworks */, + 9039D3BE24C093AC0020482C /* MoltenVK.a in Frameworks */, DEADBEEF2F582BE20003B888 /* $binary.a */, $modules_buildphase $additional_pbx_frameworks_build @@ -93,7 +90,7 @@ D0BCFE3618AEBDA2004A7AAE /* Frameworks */ = { isa = PBXGroup; children = ( - 905036D824BF7D9600301046 /* MoltenVK.framework */, + 9039D3BD24C093AC0020482C /* MoltenVK.a */, DEADBEEF1F582BE20003B888 /* $binary.a */, $modules_buildgrp $additional_pbx_frameworks_refs diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 09304d40f6..6f67fc53c2 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -231,8 +231,7 @@ def configure(env): env.Append(CPPDEFINES=["VULKAN_ENABLED"]) env.Append(LINKFLAGS=["-framework", "IOSurface"]) - if env["use_static_mvk"]: - env.Append(LINKFLAGS=["-framework", "MoltenVK"]) - env["builtin_vulkan"] = False - elif not env["builtin_vulkan"]: - env.Append(LIBS=["vulkan"]) + + # Use Static Vulkan for iOS. Dynamic Framework works fine too. + env.Append(LINKFLAGS=["-framework", "MoltenVK"]) + env["builtin_vulkan"] = False |