From 787ec5e9bfac2d356c5b375b5389e311e6b0fd5f Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Sat, 6 Feb 2021 13:52:45 +0100 Subject: [PATCH] Add Xcode project for OSX native exports --- .gitignore | 95 +++++- .../project.pbxproj | 273 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../Export.mm | 25 ++ DesktopNotifications.Apple/Native.mm | 7 - 5 files changed, 397 insertions(+), 10 deletions(-) create mode 100644 DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.pbxproj create mode 100644 DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 DesktopNotifications.Apple/DesktopNotifications.Apple.Native/Export.mm delete mode 100644 DesktopNotifications.Apple/Native.mm diff --git a/.gitignore b/.gitignore index 6949a6e..2202969 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,dotnetcore,csharp -# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,dotnetcore,csharp +# Created by https://www.toptal.com/developers/gitignore/api/csharp,dotnetcore,visualstudio,osx,xcode,windows +# Edit at https://www.toptal.com/developers/gitignore?templates=csharp,dotnetcore,visualstudio,osx,xcode,windows ### Csharp ### ## Ignore Visual Studio temporary files, build results, and @@ -366,6 +366,95 @@ obj/ /node_modules /wwwroot/node_modules +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Xcode ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Gcc Patch +/*.gcno + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +**/xcshareddata/WorkspaceSettings.xcsettings + ### VisualStudio ### # User-specific files @@ -524,4 +613,4 @@ obj/ # Ionide (cross platform F# VS Code tools) working folder -# End of https://www.toptal.com/developers/gitignore/api/visualstudio,dotnetcore,csharp +# End of https://www.toptal.com/developers/gitignore/api/csharp,dotnetcore,visualstudio,osx,xcode,windows diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.pbxproj b/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.pbxproj new file mode 100644 index 0000000..59deccd --- /dev/null +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.pbxproj @@ -0,0 +1,273 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + FA947BA925CD711D00126B36 /* Export.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA947BA825CD711D00126B36 /* Export.mm */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + FA947B9C25CD70BE00126B36 /* libDesktopNotifications.Apple.Native.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libDesktopNotifications.Apple.Native.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + FA947BA825CD711D00126B36 /* Export.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Export.mm; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FA947B9925CD70BE00126B36 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FA947B9325CD70BE00126B36 = { + isa = PBXGroup; + children = ( + FA947BA825CD711D00126B36 /* Export.mm */, + FA947B9D25CD70BE00126B36 /* Products */, + ); + sourceTree = ""; + }; + FA947B9D25CD70BE00126B36 /* Products */ = { + isa = PBXGroup; + children = ( + FA947B9C25CD70BE00126B36 /* libDesktopNotifications.Apple.Native.dylib */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + FA947B9A25CD70BE00126B36 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + FA947B9B25CD70BE00126B36 /* DesktopNotifications.Apple.Native */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA947BA525CD70BE00126B36 /* Build configuration list for PBXNativeTarget "DesktopNotifications.Apple.Native" */; + buildPhases = ( + FA947B9825CD70BE00126B36 /* Sources */, + FA947B9925CD70BE00126B36 /* Frameworks */, + FA947B9A25CD70BE00126B36 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DesktopNotifications.Apple.Native; + productName = DesktopNotifications.Apple.Native; + productReference = FA947B9C25CD70BE00126B36 /* libDesktopNotifications.Apple.Native.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FA947B9425CD70BE00126B36 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Luis von der Eltz"; + TargetAttributes = { + FA947B9B25CD70BE00126B36 = { + CreatedOnToolsVersion = 9.0; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = FA947B9725CD70BE00126B36 /* Build configuration list for PBXProject "DesktopNotifications.Apple.Native" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FA947B9325CD70BE00126B36; + productRefGroup = FA947B9D25CD70BE00126B36 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FA947B9B25CD70BE00126B36 /* DesktopNotifications.Apple.Native */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + FA947B9825CD70BE00126B36 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA947BA925CD711D00126B36 /* Export.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + FA947BA325CD70BE00126B36 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + FA947BA425CD70BE00126B36 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + FA947BA625CD70BE00126B36 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = 7UL3QLWN6Q; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + EXECUTABLE_PREFIX = lib; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + }; + name = Debug; + }; + FA947BA725CD70BE00126B36 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = 7UL3QLWN6Q; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + EXECUTABLE_PREFIX = lib; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FA947B9725CD70BE00126B36 /* Build configuration list for PBXProject "DesktopNotifications.Apple.Native" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA947BA325CD70BE00126B36 /* Debug */, + FA947BA425CD70BE00126B36 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FA947BA525CD70BE00126B36 /* Build configuration list for PBXNativeTarget "DesktopNotifications.Apple.Native" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA947BA625CD70BE00126B36 /* Debug */, + FA947BA725CD70BE00126B36 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FA947B9425CD70BE00126B36 /* Project object */; +} diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..9fd7ed6 --- /dev/null +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/DesktopNotifications.Apple.Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/Export.mm b/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/Export.mm new file mode 100644 index 0000000..1183a50 --- /dev/null +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.Native/Export.mm @@ -0,0 +1,25 @@ +// +// Export.m +// DesktopNotifications.Apple.Native +// +// Created by Luis von der Eltz on 05.02.21. +// Copyright © 2021 Luis von der Eltz. All rights reserved. +// + +#import + +__attribute__ ((visibility("default"))) void ShowNotification() { + + [NSBundle mainBundle]; + + NSUserNotificationCenter* notificationCenter = [NSUserNotificationCenter defaultUserNotificationCenter]; + //notificationCenter.delegate = _notificationCenterDelegate; + + NSUserNotification* cocoaNotification = [NSUserNotification new]; + + cocoaNotification.identifier = @"efef"; + cocoaNotification.title = @"Hello World"; + cocoaNotification.informativeText = @"informative"; + + [notificationCenter deliverNotification:cocoaNotification]; +} diff --git a/DesktopNotifications.Apple/Native.mm b/DesktopNotifications.Apple/Native.mm deleted file mode 100644 index 3c40fb9..0000000 --- a/DesktopNotifications.Apple/Native.mm +++ /dev/null @@ -1,7 +0,0 @@ - - -void __declspec(dllexport) ShowNotification(char* title, char* body) { - - - -} \ No newline at end of file