Skip to content

Commit da723f6

Browse files
committed
Add Xcode project for building framework
1 parent 34eec0d commit da723f6

File tree

10 files changed

+874
-1
lines changed

10 files changed

+874
-1
lines changed

Sources/Algorithms/RandomSample.swift

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,28 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
// For log(_:) and root(_:_:)
13-
#if swift(>=5.11)
13+
#if ALGORITHMS_DARWIN_ONLY
14+
internal import Darwin
15+
16+
extension Double {
17+
@_transparent
18+
internal static func root(_ x: Double, _ n: Int) -> Double {
19+
guard x >= 0 || n % 2 != 0 else { return .nan }
20+
if n == 3 { return cbrt(x) }
21+
return Double(signOf: x, magnitudeOf: pow(x.magnitude, 1/Double(n)))
22+
}
23+
24+
@_transparent
25+
internal static func log(_ x: Double) -> Double {
26+
Darwin.log(x)
27+
}
28+
29+
@_transparent
30+
internal static func log(onePlus x: Double) -> Double {
31+
Darwin.log1p(x)
32+
}
33+
}
34+
#elseif swift(>=5.11)
1435
internal import RealModule
1536
#elseif swift(>=5.10)
1637
import RealModule

Xcode/Algorithms.xcconfig

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift Algorithms open source project
4+
//
5+
// Copyright (c) 2023 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
//
10+
//===----------------------------------------------------------------------===//
11+
12+
PRODUCT_NAME = Algorithms
13+
PRODUCT_BUNDLE_IDENTIFIER = org.swift.Algorithms
14+
15+
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator
16+
ARCHS = $(ARCHS_STANDARD)
17+
18+
MACOSX_DEPLOYMENT_TARGET = 12.0
19+
IPHONEOS_DEPLOYMENT_TARGET = 15.0
20+
WATCHOS_DEPLOYMENT_TARGET = 8.0
21+
TVOS_DEPLOYMENT_TARGET = 15.0
22+
23+
MARKETING_VERSION = 1.2
24+
25+
CURRENT_PROJECT_VERSION = 1
26+
VERSIONING_SYSTEM = apple-generic
27+
VERSION_INFO_PREFIX =
28+
DYLIB_COMPATIBILITY_VERSION = $(CURRENT_PROJECT_VERSION)
29+
DYLIB_CURRENT_VERSION = $(CURRENT_PROJECT_VERSION)
30+
31+
INSTALL_PATH = $(LOCAL_LIBRARY_DIR)/Frameworks
32+
SKIP_INSTALL = YES
33+
DYLIB_INSTALL_NAME_BASE = @rpath
34+
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks
35+
36+
ENABLE_TESTABILITY = NO
37+
ENABLE_TESTABILITY[config=Debug] = YES
38+
39+
GENERATE_INFOPLIST_FILE = YES

Xcode/Algorithms.xcodeproj/project.pbxproj

Lines changed: 566 additions & 0 deletions
Large diffs are not rendered by default.

Xcode/Algorithms.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1500"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "7D489E3E29CE969D00499B21"
18+
BuildableName = "Algorithms.framework"
19+
BlueprintName = "Algorithms"
20+
ReferencedContainer = "container:Algorithms.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<TestPlans>
31+
<TestPlanReference
32+
reference = "container:Algorithms.xctestplan"
33+
default = "YES">
34+
</TestPlanReference>
35+
</TestPlans>
36+
<Testables>
37+
<TestableReference
38+
skipped = "NO"
39+
parallelizable = "YES">
40+
<BuildableReference
41+
BuildableIdentifier = "primary"
42+
BlueprintIdentifier = "7D489E4629CE969D00499B21"
43+
BuildableName = "AlgorithmsTests.xctest"
44+
BlueprintName = "AlgorithmsTests"
45+
ReferencedContainer = "container:Algorithms.xcodeproj">
46+
</BuildableReference>
47+
</TestableReference>
48+
</Testables>
49+
</TestAction>
50+
<LaunchAction
51+
buildConfiguration = "Debug"
52+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
53+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
54+
launchStyle = "0"
55+
useCustomWorkingDirectory = "NO"
56+
ignoresPersistentStateOnLaunch = "NO"
57+
debugDocumentVersioning = "YES"
58+
debugServiceExtension = "internal"
59+
allowLocationSimulation = "YES">
60+
</LaunchAction>
61+
<ProfileAction
62+
buildConfiguration = "Release"
63+
shouldUseLaunchSchemeArgsEnv = "YES"
64+
savedToolIdentifier = ""
65+
useCustomWorkingDirectory = "NO"
66+
debugDocumentVersioning = "YES">
67+
<MacroExpansion>
68+
<BuildableReference
69+
BuildableIdentifier = "primary"
70+
BlueprintIdentifier = "7D489E3E29CE969D00499B21"
71+
BuildableName = "Algorithms.framework"
72+
BlueprintName = "Algorithms"
73+
ReferencedContainer = "container:Algorithms.xcodeproj">
74+
</BuildableReference>
75+
</MacroExpansion>
76+
</ProfileAction>
77+
<AnalyzeAction
78+
buildConfiguration = "Debug">
79+
</AnalyzeAction>
80+
<ArchiveAction
81+
buildConfiguration = "Release"
82+
revealArchiveInOrganizer = "YES">
83+
</ArchiveAction>
84+
</Scheme>

Xcode/Algorithms.xctestplan

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "CF37E70B-D810-4CF2-AB41-571BAFF72572",
5+
"name" : "Default",
6+
"options" : {
7+
8+
}
9+
},
10+
{
11+
"id" : "33436295-E24E-439B-9B8E-4602E0A6C8BB",
12+
"name" : "TSan",
13+
"options" : {
14+
"threadSanitizerEnabled" : true
15+
}
16+
}
17+
],
18+
"defaultOptions" : {
19+
"codeCoverage" : false
20+
},
21+
"testTargets" : [
22+
{
23+
"parallelizable" : true,
24+
"target" : {
25+
"containerPath" : "container:Algorithms.xcodeproj",
26+
"identifier" : "7D489E4629CE969D00499B21",
27+
"name" : "AlgorithmsTests"
28+
}
29+
}
30+
],
31+
"version" : 1
32+
}

Xcode/AlgorithmsTests.xcconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift Algorithms open source project
4+
//
5+
// Copyright (c) 2023 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
//
10+
//===----------------------------------------------------------------------===//
11+
12+
PRODUCT_NAME = AlgorithmsTests
13+
PRODUCT_BUNDLE_IDENTIFIER = org.swift.AlgorithmsTests
14+
15+
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator
16+
ARCHS = $(ARCHS_STANDARD)
17+
18+
CURRENT_PROJECT_VERSION = 1
19+
MARKETING_VERSION = 1.0
20+
21+
GENERATE_INFOPLIST_FILE = YES
22+
23+
ENABLE_TESTABILITY = NO

Xcode/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Xcode build files
2+
3+
The project file here can be used to build a variant of this package with Xcode. The project file is a regular Xcode project that builds the code base using the ALGORITHMS_NATIVE_BUILTINS configuration, producing a single framework bundle. Build settings are entirely configured via the provided xcconfig files.
4+
5+
Beware! The contents of this directory are not source stable. They are provided as is, with no compatibility promises across package releases. Future versions of this package can arbitrarily change these files or remove them, without any advance notice. (This can include patch releases.)

Xcode/Shared.xcconfig

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift Algorithms open source project
4+
//
5+
// Copyright (c) 2023 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
//
10+
//===----------------------------------------------------------------------===//
11+
12+
SDKROOT = macosx
13+
14+
CODE_SIGN_STYLE = Automatic
15+
CODE_SIGN_IDENTITY = -
16+
CODE_SIGN_IDENTITY[sdk=iphoneos*] = "iOS Developer"
17+
CODE_SIGN_IDENTITY[sdk=watchos*] = "iOS Developer"
18+
CODE_SIGN_IDENTITY[sdk=appletvos*] = "iOS Developer"
19+
20+
SWIFT_VERSION = 5.5
21+
ONLY_ACTIVE_ARCH[config=Debug] = YES
22+
23+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) ALGORITHMS_DARWIN_ONLY
24+
25+
SWIFT_COMPILATION_MODE[config=Release] = wholemodule
26+
SWIFT_COMPILATION_MODE[config=Debug] = singlefile
27+
28+
SWIFT_OPTIMIZATION_LEVEL[config=Release] = -O
29+
SWIFT_OPTIMIZATION_LEVEL[config=Debug] = -Onone
30+
31+
SWIFT_EMIT_LOC_STRINGS = NO
32+
SWIFT_INSTALL_OBJC_HEADER = NO
33+
34+
COPY_PHASE_STRIP = NO
35+
36+
DEBUG_INFORMATION_FORMAT[config=Release] = dwarf-with-dsym
37+
DEBUG_INFORMATION_FORMAT[config=Debug] = dwarf
38+
39+
ALWAYS_SEARCH_USER_PATHS = NO
40+
41+
ENABLE_TESTABILITY = NO
42+
ENABLE_USER_SCRIPT_SANDBOXING = YES
43+
DEAD_CODE_STRIPPING = YES
44+
45+
GCC_DYNAMIC_NO_PIC = NO
46+
GCC_NO_COMMON_BLOCKS = YES
47+
GCC_OPTIMIZATION_LEVEL[config=Debug] = 0
48+
49+
GCC_C_LANGUAGE_STANDARD = gnu11
50+
CLANG_CXX_LANGUAGE_STANDARD = gnu++20
51+
CLANG_ENABLE_MODULES = YES
52+
CLANG_ENABLE_OBJC_ARC = YES
53+
CLANG_ENABLE_OBJC_WEAK = YES
54+
ENABLE_NS_ASSERTIONS[config=Release] = NO
55+
ENABLE_STRICT_OBJC_MSGSEND = YES
56+
GCC_PREPROCESSOR_DEFINITIONS[config=Release] = DEBUG=1 $(inherited)
57+
58+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
59+
CLANG_WARN_BOOL_CONVERSION = YES
60+
CLANG_WARN_COMMA = YES
61+
CLANG_WARN_CONSTANT_CONVERSION = YES
62+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES
63+
CLANG_WARN_EMPTY_BODY = YES
64+
CLANG_WARN_ENUM_CONVERSION = YES
65+
CLANG_WARN_INFINITE_RECURSION = YES
66+
CLANG_WARN_INT_CONVERSION = YES
67+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
68+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES
69+
CLANG_WARN_STRICT_PROTOTYPES = YES
70+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
71+
CLANG_WARN_UNREACHABLE_CODE = YES
72+
73+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
74+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
75+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE
76+
GCC_WARN_UNUSED_FUNCTION = YES
77+
GCC_WARN_UNUSED_VARIABLE = YES
78+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
79+
CLANG_WARN_SUSPICIOUS_MOVE = YES
80+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
81+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
82+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES
83+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
84+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
85+
GCC_WARN_UNDECLARED_SELECTOR = YES
86+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
87+
CLANG_ANALYZER_NONNULL = YES
88+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE

0 commit comments

Comments
 (0)