From 0762f57d806df3f5ad9e268d18eddbe4f3cb2594 Mon Sep 17 00:00:00 2001 From: Lucy Satheesan Date: Thu, 10 Aug 2023 16:03:21 -0700 Subject: [PATCH] migrate CSystem to systemLibrary for some reason, the linker on my linux machine fails to link the tests otherwise. investigate / fix before merging. --- Package.swift | 5 ++--- Sources/CSystem/{include => }/CSystemLinux.h | 0 Sources/CSystem/{include => }/CSystemWindows.h | 0 Sources/CSystem/{include => }/io_uring.h | 5 +++++ Sources/CSystem/{include => }/module.modulemap | 0 Sources/CSystem/shims.c | 18 ------------------ 6 files changed, 7 insertions(+), 21 deletions(-) rename Sources/CSystem/{include => }/CSystemLinux.h (100%) rename Sources/CSystem/{include => }/CSystemWindows.h (100%) rename Sources/CSystem/{include => }/io_uring.h (94%) rename Sources/CSystem/{include => }/module.modulemap (100%) delete mode 100644 Sources/CSystem/shims.c diff --git a/Package.swift b/Package.swift index 60f1a56..1c058ac 100644 --- a/Package.swift +++ b/Package.swift @@ -21,9 +21,8 @@ let package = Package( .package(url: "https://github.com/apple/swift-atomics", from: "1.1.0") ], targets: [ - .target( - name: "CSystem", - dependencies: []), + .systemLibrary( + name: "CSystem"), .target( name: "SystemPackage", dependencies: [ diff --git a/Sources/CSystem/include/CSystemLinux.h b/Sources/CSystem/CSystemLinux.h similarity index 100% rename from Sources/CSystem/include/CSystemLinux.h rename to Sources/CSystem/CSystemLinux.h diff --git a/Sources/CSystem/include/CSystemWindows.h b/Sources/CSystem/CSystemWindows.h similarity index 100% rename from Sources/CSystem/include/CSystemWindows.h rename to Sources/CSystem/CSystemWindows.h diff --git a/Sources/CSystem/include/io_uring.h b/Sources/CSystem/io_uring.h similarity index 94% rename from Sources/CSystem/include/io_uring.h rename to Sources/CSystem/io_uring.h index 9e3d9fb..5c05ed8 100644 --- a/Sources/CSystem/include/io_uring.h +++ b/Sources/CSystem/io_uring.h @@ -5,6 +5,9 @@ #include #include +#ifndef SWIFT_IORING_C_WRAPPER +#define SWIFT_IORING_C_WRAPPER + #ifdef __alpha__ /* * alpha is the only exception, all other architectures @@ -48,3 +51,5 @@ int io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete, return syscall(__NR_io_uring_enter, fd, to_submit, min_complete, flags, sig, _NSIG / 8); } + +#endif diff --git a/Sources/CSystem/include/module.modulemap b/Sources/CSystem/module.modulemap similarity index 100% rename from Sources/CSystem/include/module.modulemap rename to Sources/CSystem/module.modulemap diff --git a/Sources/CSystem/shims.c b/Sources/CSystem/shims.c deleted file mode 100644 index f492a2a..0000000 --- a/Sources/CSystem/shims.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - This source file is part of the Swift System open source project - - Copyright (c) 2020 Apple Inc. and the Swift System project authors - Licensed under Apache License v2.0 with Runtime Library Exception - - See https://swift.org/LICENSE.txt for license information -*/ - -#ifdef __linux__ - -#include - -#endif - -#if defined(_WIN32) -#include -#endif