Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Darwin] Treat this code as a framework, which simplifies things a little bit. #20833

Merged
merged 1 commit into from
Jul 9, 2024
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
[Darwin] Treat this code as a framework, which simplifies things a li…
…ttle bit.

Also move the TimeSpec struct to its own file, this will be necessary for Xcode 16.
  • Loading branch information
rolfbjarne committed Jul 8, 2024
commit 9a674240fc8e1142d16b5d42f0c925829a24d92d
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