Skip to content

Commit

Permalink
[Darwin] Treat this code as a framework, which simplifies things a li…
Browse files Browse the repository at this point in the history
…ttle bit. (#20833)

Also move the TimeSpec struct to its own file, this will be necessary
for Xcode 16.
  • Loading branch information
rolfbjarne authored Jul 9, 2024
1 parent 1520e0e commit 83e3951
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 11 deletions.
7 changes: 0 additions & 7 deletions src/Darwin/KernelNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@
#endif

namespace Darwin {

[StructLayout (LayoutKind.Sequential)]
public struct TimeSpec {
public nint Seconds;
public nint NanoSeconds;
}

[StructLayout (LayoutKind.Sequential)]
public struct KernelEvent {
public IntPtr /* uintptr_tr */ Ident;
Expand Down
15 changes: 15 additions & 0 deletions src/Darwin/TimeSpec.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Runtime.InteropServices;

using ObjCRuntime;

#nullable enable

namespace Darwin {
[StructLayout (LayoutKind.Sequential)]
[NativeName ("timespec")]
public struct TimeSpec {
public nint Seconds;
public nint NanoSeconds;
}
}
4 changes: 0 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,11 @@ MACOS_CORE_SOURCES += \
MACOS_DOTNET_SOURCES += \
$(MAC_DOTNET_EXTRA_CORE_SOURCES) \
$(MACOS_BUILD_DIR)/AssemblyInfo.cs \
Darwin/KernelNotification.cs \
Darwin/SystemLog.cs \
$(SHARED_DESIGNER_CS) \

MACOS_SOURCES += \
$(MAC_EXTRA_CORE_SOURCES) \
$(MACOS_BUILD_DIR)/AssemblyInfo.cs \
Darwin/KernelNotification.cs \
Darwin/SystemLog.cs \
$(SHARED_DESIGNER_CS) \

# CFNetwork is shipped:
Expand Down
3 changes: 3 additions & 0 deletions src/build/generator-frameworks.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ partial class Frameworks {
"CoreVideo",
"CoreWlan",
"CryptoTokenKit",
"Darwin",
"DeviceCheck",
"EventKit",
"ExecutionPolicy",
Expand Down Expand Up @@ -613,6 +614,7 @@ partial class Frameworks {
bool? _CoreVideo;
bool? _CoreWlan;
bool? _CryptoTokenKit;
bool? _Darwin;
bool? _DeviceCheck;
bool? _DeviceDiscoveryExtension;
bool? _DeviceDiscoveryUI;
Expand Down Expand Up @@ -782,6 +784,7 @@ partial class Frameworks {
public bool HaveCoreVideo { get { if (!_CoreVideo.HasValue) _CoreVideo = GetValue ("CoreVideo"); return _CoreVideo.Value; } }
public bool HaveCoreWlan { get { if (!_CoreWlan.HasValue) _CoreWlan = GetValue ("CoreWlan"); return _CoreWlan.Value; } }
public bool HaveCryptoTokenKit { get { if (!_CryptoTokenKit.HasValue) _CryptoTokenKit = GetValue ("CryptoTokenKit"); return _CryptoTokenKit.Value; } }
public bool HaveDarwin { get { if (!_Darwin.HasValue) _Darwin = GetValue ("Darwin"); return _Darwin.Value; } }
public bool HaveDeviceCheck { get { if (!_DeviceCheck.HasValue) _DeviceCheck = GetValue ("DeviceCheck"); return _DeviceCheck.Value; } }
public bool HaveDeviceDiscoveryExtension { get { if (!_DeviceDiscoveryExtension.HasValue) _DeviceDiscoveryExtension = GetValue ("DeviceDiscoveryExtension"); return _DeviceDiscoveryExtension.Value; } }
public bool HaveDeviceDiscoveryUI { get { if (!_DeviceDiscoveryUI.HasValue) _DeviceDiscoveryUI = GetValue ("DeviceDiscoveryUI"); return _DeviceDiscoveryUI.Value; } }
Expand Down
2 changes: 2 additions & 0 deletions src/darwin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Darwin isn't really a framework, but to simplify our build logic we treat it as such.
// This also means this file is needed, even though it's empty, because our build logic will automatically include it in the build.
10 changes: 10 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,15 @@ COREWLAN_SOURCES = \
CoreWlan/CWInterface.cs \
CoreWlan/CWKeychain.cs \

# DARWIN

DARWIN_CORE_SOURCES = \
Darwin/TimeSpec.cs \

DARWIN_SOURCES = \
Darwin/KernelNotification.cs \
Darwin/SystemLog.cs \

# DeviceDiscoveryExtension

DEVICEDISCOVERYEXTENSION_API_SOURCES = \
Expand Down Expand Up @@ -2101,6 +2110,7 @@ MACOS_FRAMEWORKS = \
CoreSpotlight \
CoreText \
CoreWlan \
Darwin \
EventKit \
ExecutionPolicy \
ExtensionKit \
Expand Down
1 change: 1 addition & 0 deletions src/rsp/dotnet/macos-defines-dotnet.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
-d:HAS_COREVIDEO
-d:HAS_COREWLAN
-d:HAS_CRYPTOTOKENKIT
-d:HAS_DARWIN
-d:HAS_DEVICECHECK
-d:HAS_EVENTKIT
-d:HAS_EXECUTIONPOLICY
Expand Down
1 change: 1 addition & 0 deletions src/rsp/macos-defines.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
-d:HAS_COREVIDEO
-d:HAS_COREWLAN
-d:HAS_CRYPTOTOKENKIT
-d:HAS_DARWIN
-d:HAS_DEVICECHECK
-d:HAS_EVENTKIT
-d:HAS_EXECUTIONPOLICY
Expand Down

7 comments on commit 83e3951

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.