Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions Configuration/UTMQemuConfiguration+Arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,13 @@ import Virtualization // for getting network interfaces
"edid=on"
}
if isDisplayGLSupported(display) && isVulkanSupported {
#if os(macOS)
"hostmem=8G"
#else
"hostmem=256M"
#endif
"blob=true"
"venus=true"
}
if isDisplayGLSupported(display) && isNeptuneSupported {
if !isVulkanSupported {
#if os(macOS)
"hostmem=8G"
#else
"hostmem=256M"
#endif
"blob=true"
}
"neptune=true"
Expand Down Expand Up @@ -357,13 +349,13 @@ import Virtualization // for getting network interfaces
}

private var isNeptuneSupported: Bool {
#if os(macOS)
isGLSupported &&
(rendererBackend == .qemuRendererBackendAngleMetal || rendererBackend == .qemuRendererBackendDefault) &&
directXDriver != .qemuDirectXDriverDisabled
#else
false
#endif
if #available(macOS 13, iOS 16, *) {
return isGLSupported &&
(rendererBackend == .qemuRendererBackendAngleMetal || rendererBackend == .qemuRendererBackendDefault) &&
directXDriver != .qemuDirectXDriverDisabled
} else {
return false
}
}

private var isSparc: Bool {
Expand Down
2 changes: 1 addition & 1 deletion Platform/Shared/VMConfigSystemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct VMConfigSystemView: View {
#if os(iOS) || os(visionOS)
let availableMemory = UInt64(os_proc_available_memory())
if availableMemory > 0 {
totalDeviceMemory = availableMemory
totalDeviceMemory = min(availableMemory, totalDeviceMemory)
}
#endif
let actualJitSizeMib = jitSizeMib == 0 ? memorySizeMib / 4 : jitSizeMib
Expand Down
26 changes: 26 additions & 0 deletions Platform/iOS/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,32 @@
<string>iOS-Remote</string>
</array>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>DirectX Driver</string>
<key>Key</key>
<string>QEMUDirectXDriver</string>
<key>DefaultValue</key>
<integer>0</integer>
<key>Titles</key>
<array>
<string>Default</string>
<string>Disabled</string>
<string>DXMT</string>
</array>
<key>Values</key>
<array>
<integer>0</integer>
<integer>1</integer>
<integer>2</integer>
</array>
<key>ExcludeTargets</key>
<array>
<string>iOS-Remote</string>
</array>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
Expand Down
6 changes: 5 additions & 1 deletion Platform/macOS/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ struct DisplaySettingsView: View {
if qemuDirectXDriver == .qemuDirectXDriverD3DMetal {
return true // always show option if already selected
} else {
return Self.hasD3DMetal
if #available(macOS 14, *) {
return Self.hasD3DMetal
} else {
return false
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions Services/UTMQemuSystem.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ - (void)setDirectXDriver:(UTMQEMUDirectXDriver)directXDriver {
NSString *backend;
NSString *frameworkName;
NSURL *library;
if (@available(macOS 13, iOS 16, *)) {
} else {
return;
}
switch (directXDriver) {
case kQEMUDirectXDriverDefault:
case kQEMUDirectXDriverDXMT:
Expand Down
16 changes: 8 additions & 8 deletions UTM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@
CE2D958E24AD4F990059923A /* UTMApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE2D955524AD4F980059923A /* UTMApp.swift */; };
CE2D958F24AD4FF00059923A /* VMCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE2D954324AD4F980059923A /* VMCardView.swift */; };
CE2D959024AD50D50059923A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 521F3EFB2414F73800130500 /* Localizable.strings */; };
CE30F93630200C2000024DB2 /* dxmt-native.framework in Embed Libraries */ = {isa = PBXBuildFile; fileRef = CEA3EDE93016810500AAA8E4 /* dxmt-native.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CE30F93730200C3300024DB2 /* dxmt-native.framework in Embed Libraries */ = {isa = PBXBuildFile; fileRef = CEA3EDE93016810500AAA8E4 /* dxmt-native.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CE38EC692B5DB3AE008B324B /* UTMRemoteClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE38EC682B5DB3AE008B324B /* UTMRemoteClient.swift */; };
CE4698F924C8FBD9008C1BD6 /* Icons in Resources */ = {isa = PBXBuildFile; fileRef = CE4698F824C8FBD9008C1BD6 /* Icons */; };
CE4698FA24C8FBD9008C1BD6 /* Icons in Resources */ = {isa = PBXBuildFile; fileRef = CE4698F824C8FBD9008C1BD6 /* Icons */; };
Expand Down Expand Up @@ -735,9 +737,7 @@
CE9B15482B12A87E003A32DD /* GenerateKey.c in Sources */ = {isa = PBXBuildFile; fileRef = CE9B15462B12A87E003A32DD /* GenerateKey.c */; };
CE9B15492B12A87E003A32DD /* GenerateKey.c in Sources */ = {isa = PBXBuildFile; fileRef = CE9B15462B12A87E003A32DD /* GenerateKey.c */; };
CE9B154A2B12A87E003A32DD /* GenerateKey.c in Sources */ = {isa = PBXBuildFile; fileRef = CE9B15462B12A87E003A32DD /* GenerateKey.c */; };
CEA3EDEB3016810500AAA8E4 /* dxmt-native.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEA3EDE93016810500AAA8E4 /* dxmt-native.framework */; };
CEA3EDEC3016810500AAA8E4 /* dxmt-native.framework in Embed Libraries */ = {isa = PBXBuildFile; fileRef = CEA3EDE93016810500AAA8E4 /* dxmt-native.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CEA3EDED3016810500AAA8E4 /* d3dmetal-native.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEA3EDEA3016810500AAA8E4 /* d3dmetal-native.framework */; };
CEA3EDEE3016810500AAA8E4 /* d3dmetal-native.framework in Embed Libraries */ = {isa = PBXBuildFile; fileRef = CEA3EDEA3016810500AAA8E4 /* d3dmetal-native.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CEA3EE05301691C500AAA8E4 /* QEMURenderServer.app in Embed Executables */ = {isa = PBXBuildFile; fileRef = CEA3EDFA30168B9000AAA8E4 /* QEMURenderServer.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
CEA45E25263519B5002FA97D /* VMDisplayMetalViewController+Pointer.h in Sources */ = {isa = PBXBuildFile; fileRef = 83FBDD53242FA71900D2C5D7 /* VMDisplayMetalViewController+Pointer.h */; };
Expand Down Expand Up @@ -1452,6 +1452,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
CE30F93730200C3300024DB2 /* dxmt-native.framework in Embed Libraries */,
CE2D937624AD46670059923A /* gpg-error.0.framework in Embed Libraries */,
CE2D937724AD46670059923A /* qemu-mips64el-softmmu.framework in Embed Libraries */,
CE2D937824AD46670059923A /* gstcontroller-1.0.0.framework in Embed Libraries */,
Expand Down Expand Up @@ -1553,6 +1554,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
CE30F93630200C2000024DB2 /* dxmt-native.framework in Embed Libraries */,
CEA45F72263519B5002FA97D /* gpg-error.0.framework in Embed Libraries */,
CE63B0FD2F0EFB0700C59D13 /* vulkan_kosmickrisp.framework in Embed Libraries */,
CEA45F74263519B5002FA97D /* gstcontroller-1.0.0.framework in Embed Libraries */,
Expand Down Expand Up @@ -2369,7 +2371,6 @@
CEF83F882500949D00557D15 /* gthread-2.0.0.framework in Frameworks */,
CE03D08724D90F0700F76B84 /* gobject-2.0.0.framework in Frameworks */,
CE9B15362B11A491003A32DD /* SwiftConnect in Frameworks */,
CEA3EDED3016810500AAA8E4 /* d3dmetal-native.framework in Frameworks */,
CE0B6F0A24AD677200FE012D /* spice-client-glib-2.0.8.framework in Frameworks */,
CE0B6ECF24AD677200FE012D /* gstrtp-1.0.0.framework in Frameworks */,
CE0B6ECC24AD677200FE012D /* gstriff-1.0.0.framework in Frameworks */,
Expand All @@ -2385,7 +2386,6 @@
CE0B6EBB24AD677200FE012D /* libgstgio.a in Frameworks */,
84937EFF28960789003148F4 /* zstd.1.framework in Frameworks */,
CE0B6EE224AD677200FE012D /* gstnet-1.0.0.framework in Frameworks */,
CEA3EDEB3016810500AAA8E4 /* dxmt-native.framework in Frameworks */,
CE03D08624D90F0700F76B84 /* gmodule-2.0.0.framework in Frameworks */,
CED297142CE425CB00F1E3EB /* soup-3.0.0.framework in Frameworks */,
CE03D0CA24D9142000F76B84 /* ssl.1.1.framework in Frameworks */,
Expand Down Expand Up @@ -5023,13 +5023,13 @@
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/include/spice-1",
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/include/libusb-1.0",
);
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/lib",
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/lib/gstreamer-1.0",
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/lib",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MACOSX_DEPLOYMENT_TARGET = 11.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -5106,13 +5106,13 @@
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/include/spice-1",
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/include/libusb-1.0",
);
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/lib",
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/lib/gstreamer-1.0",
"$(PROJECT_DIR)/$(QUOTED_SYSROOT_DIR)/lib",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MACOSX_DEPLOYMENT_TARGET = 11.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
QUOTED_SYSROOT_DIR = "\"$(SYSROOT_DIR)\"";
Expand Down
49 changes: 49 additions & 0 deletions patches/llvm-project-15.0.7.src.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
LLVM 15 gates its Mach-O linker behaviour on `CMAKE_SYSTEM_NAME MATCHES "Darwin"`,
which is false when cross-compiling for iOS/visionOS (CMAKE_SYSTEM_NAME is "iOS" /
"visionOS"). The build then falls through to the ELF/COFF paths and passes flags
Apple's ld rejects. Use `APPLE`, which is true for every Apple platform.

Fixed upstream after 15.x; drop this patch when moving to a newer LLVM.

1. add_llvm_symbol_exports() fell through to the Windows branch and handed a
.def file to ld:
ld: unknown file type in '.../LLVMHello.def'

2. -Wl,-z,defs is ELF-only and was not excluded for iOS:
ld: unknown options: -z

3. add_link_opts() skipped -Wl,-dead_strip, so non-Debug builds silently lost
dead stripping that the macOS build of the same sources already gets.
Not a build failure, just larger output.

--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -82,7 +82,7 @@
endfunction()

function(add_llvm_symbol_exports target_name export_file)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(APPLE)
set(native_export_file "${target_name}.exports")
add_custom_command(OUTPUT ${native_export_file}
COMMAND sed -e "s/^/_/" < ${export_file} > ${native_export_file}
@@ -263,7 +263,7 @@
# linker in a context where the optimizations are not important.
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
if(NOT LLVM_NO_DEAD_STRIP)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(APPLE)
# ld64's implementation of -dead_strip breaks tools that use plugins.
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-dead_strip")
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -229,7 +229,7 @@
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
# build might work on ELF but fail on MachO/COFF.
if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|SunOS|OS390" OR
- WIN32 OR CYGWIN) AND
+ APPLE OR WIN32 OR CYGWIN) AND
NOT LLVM_USE_SANITIZER)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
endif()
Loading
Loading