From f2de87c5520a3a2ebbaf02f8d24802c668dbab72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=80=E5=8D=93=E7=96=8C?= <55120045+WowbaggersLiquidLunch@users.noreply.github.com> Date: Wed, 2 Feb 2022 05:02:28 +0800 Subject: [PATCH 1/3] adopt Swift Collection's `OrderedSet` and `OrderedDictionary` They're better optimised and tested. --- Package.swift | 35 +++-- Sources/TSCBasic/GraphAlgorithms.swift | 8 +- Sources/TSCBasic/OrderedDictionary.swift | 125 ----------------- Sources/TSCBasic/OrderedSet.swift | 130 ------------------ Sources/TSCUtility/PkgConfig.swift | 5 +- .../OrderedDictionaryTests.swift | 29 ---- Tests/TSCBasicTests/OrderedSetTests.swift | 58 -------- 7 files changed, 29 insertions(+), 361 deletions(-) delete mode 100644 Sources/TSCBasic/OrderedDictionary.swift delete mode 100644 Sources/TSCBasic/OrderedSet.swift delete mode 100644 Tests/TSCBasicTests/OrderedDictionaryTests.swift delete mode 100644 Tests/TSCBasicTests/OrderedSetTests.swift diff --git a/Package.swift b/Package.swift index 6c115e4a..8d694ce1 100644 --- a/Package.swift +++ b/Package.swift @@ -44,7 +44,6 @@ let package = Package( name: "TSCTestSupport", targets: ["TSCTestSupport"]), ], - dependencies: [], targets: [ // MARK: Tools support core targets @@ -63,17 +62,23 @@ let package = Package( /** TSCBasic support library */ name: "TSCBasic", dependencies: [ - "TSCLibc", - "TSCclibc", - .product(name: "SystemPackage", package: "swift-system"), + "TSCLibc", + "TSCclibc", + .product(name: "OrderedCollections", package: "swift-collections"), + .product(name: "SystemPackage", package: "swift-system"), ], exclude: CMakeFiles + ["README.md"]), .target( /** Abstractions for common operations, should migrate to TSCBasic */ name: "TSCUtility", - dependencies: ["TSCBasic", "TSCclibc"], + dependencies: [ + "TSCBasic", + "TSCclibc", + .product(name: "OrderedCollections", package: "swift-collections"), + ], exclude: CMakeFiles), + // MARK: Additional Test Dependencies .target( @@ -102,17 +107,19 @@ let package = Package( ) /// When not using local dependencies, the branch to use for llbuild and TSC repositories. - let relatedDependenciesBranch = "main" +let relatedDependenciesBranch = "main" - if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { - package.dependencies += [ - .package(url: "https://github.com/apple/swift-system.git", .upToNextMinor(from: "1.1.1")), - ] - } else { +if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { package.dependencies += [ - .package(path: "../swift-system"), - ] - } + .package(url: "https://github.com/apple/swift-collections.git", .branch("main")), + .package(url: "https://github.com/apple/swift-system.git", .upToNextMinor(from: "1.1.1")), + ] +} else { + package.dependencies += [ + .package(path: "../swift-collections"), + .package(path: "../swift-system"), + ] +} // FIXME: conditionalise these flags since SwiftPM 5.3 and earlier will crash // for platforms they don't know about. diff --git a/Sources/TSCBasic/GraphAlgorithms.swift b/Sources/TSCBasic/GraphAlgorithms.swift index 02ac880e..2b971927 100644 --- a/Sources/TSCBasic/GraphAlgorithms.swift +++ b/Sources/TSCBasic/GraphAlgorithms.swift @@ -1,13 +1,15 @@ /* This source file is part of the Swift.org open source project - Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors + Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors Licensed under Apache License v2.0 with Runtime Library Exception See http://swift.org/LICENSE.txt for license information See http://swift.org/CONTRIBUTORS.txt for Swift project authors */ +import OrderedCollections + public enum GraphError: Error { /// A cycle was detected in the input. case unexpectedCycle @@ -69,7 +71,7 @@ public func topologicalSort( // Otherwise, visit each adjacent node. for succ in try successors(node) { - guard stack.append(succ) else { + guard stack.append(succ).inserted else { // If the successor is already in this current stack, we have found a cycle. // // FIXME: We could easily include information on the cycle we found here. @@ -120,7 +122,7 @@ public func findCycle( // FIXME: Convert to stack. func visit(_ node: T, _ successors: (T) throws -> [T]) rethrows -> (path: [T], cycle: [T])? { // If this node is already in the current path then we have found a cycle. - if !path.append(node) { + if !path.append(node).inserted { let index = path.firstIndex(of: node)! return (Array(path[path.startIndex.. { - - /// The element type of a dictionary: a tuple containing an individual - /// key-value pair. - public typealias Element = (key: Key, value: Value) - - /// The underlying storage for the OrderedDictionary. - fileprivate var array: [Key] - fileprivate var dict: [Key: Value] - - /// Create an empty OrderedDictionary object. - public init() { - self.array = [] - self.dict = [:] - } - - /// Accesses the value associated with the given key for reading and writing. - /// - /// This *key-based* subscript returns the value for the given key if the key - /// is found in the dictionary, or `nil` if the key is not found. - public subscript(key: Key) -> Value? { - get { - return dict[key] - } - set { - if let newValue = newValue { - updateValue(newValue, forKey: key) - } else { - removeValue(forKey: key) - } - } - } - - /// Updates the value stored in the dictionary for the given key, or adds a - /// new key-value pair if the key does not exist. - /// - /// Use this method instead of key-based subscripting when you need to know - /// whether the new value supplants the value of an existing key. If the - /// value of an existing key is updated, `updateValue(_:forKey:)` returns - /// the original value. - @discardableResult - public mutating func updateValue(_ value: Value, forKey key: Key) -> Value? { - // If there is already a value for this key, replace and return the old value. - if let oldValue = dict[key] { - dict[key] = value - return oldValue - } - - // Otherwise, create a new entry. - dict[key] = value - array.append(key) - return nil - } - - /// Removes the given key and its associated value from the dictionary. - /// - /// If the key is found in the dictionary, this method returns the key's - /// associated value. - @discardableResult - public mutating func removeValue(forKey key: Key) -> Value? { - guard let value = dict[key] else { - return nil - } - dict[key] = nil - array.remove(at: array.firstIndex(of: key)!) - return value - } - - /// An array containing just the values of the ordered dictionary. - public var values: [Value] { - return self.array.map { self.dict[$0]! } - } - - /// Remove all key-value pairs from the ordered dictionary. - public mutating func removeAll() { - self.array.removeAll() - self.dict.removeAll() - } -} - -extension OrderedDictionary: ExpressibleByDictionaryLiteral { - public init(dictionaryLiteral elements: (Key, Value)...) { - self.init() - for element in elements { - updateValue(element.1, forKey: element.0) - } - } -} - -extension OrderedDictionary: CustomStringConvertible { - public var description: String { - var string = "[" - for (idx, key) in array.enumerated() { - string += "\(key): \(dict[key]!)" - if idx != array.count - 1 { - string += ", " - } - } - string += "]" - return string - } -} - -extension OrderedDictionary: RandomAccessCollection { - public var startIndex: Int { return array.startIndex } - public var endIndex: Int { return array.endIndex } - public subscript(index: Int) -> Element { - let key = array[index] - let value = dict[key]! - return (key, value) - } -} diff --git a/Sources/TSCBasic/OrderedSet.swift b/Sources/TSCBasic/OrderedSet.swift deleted file mode 100644 index 7e004d90..00000000 --- a/Sources/TSCBasic/OrderedSet.swift +++ /dev/null @@ -1,130 +0,0 @@ -/* - This source file is part of the Swift.org open source project - - Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors - Licensed under Apache License v2.0 with Runtime Library Exception - - See http://swift.org/LICENSE.txt for license information - See http://swift.org/CONTRIBUTORS.txt for Swift project authors -*/ - -/// An ordered set is an ordered collection of instances of `Element` in which -/// uniqueness of the objects is guaranteed. -public struct OrderedSet: Equatable, Collection { - public typealias Element = E - public typealias Index = Int - - #if swift(>=4.1.50) - public typealias Indices = Range - #else - public typealias Indices = CountableRange - #endif - - private var array: [Element] - private var set: Set - - /// Creates an empty ordered set. - public init() { - self.array = [] - self.set = Set() - } - - /// Creates an ordered set with the contents of `array`. - /// - /// If an element occurs more than once in `element`, only the first one - /// will be included. - public init(_ array: [Element]) { - self.init() - for element in array { - append(element) - } - } - - // MARK: Working with an ordered set - - /// The number of elements the ordered set stores. - public var count: Int { return array.count } - - /// Returns `true` if the set is empty. - public var isEmpty: Bool { return array.isEmpty } - - /// Returns the contents of the set as an array. - public var contents: [Element] { return array } - - /// Returns `true` if the ordered set contains `member`. - public func contains(_ member: Element) -> Bool { - return set.contains(member) - } - - /// Adds an element to the ordered set. - /// - /// If it already contains the element, then the set is unchanged. - /// - /// - returns: True if the item was inserted. - @discardableResult - public mutating func append(_ newElement: Element) -> Bool { - let inserted = set.insert(newElement).inserted - if inserted { - array.append(newElement) - } - return inserted - } - - /// Remove and return the element at the beginning of the ordered set. - public mutating func removeFirst() -> Element { - let firstElement = array.removeFirst() - set.remove(firstElement) - return firstElement - } - - /// Remove and return the element at the end of the ordered set. - public mutating func removeLast() -> Element { - let lastElement = array.removeLast() - set.remove(lastElement) - return lastElement - } - - /// Remove all elements. - public mutating func removeAll(keepingCapacity keepCapacity: Bool) { - array.removeAll(keepingCapacity: keepCapacity) - set.removeAll(keepingCapacity: keepCapacity) - } - - /// Remove the given element. - /// - /// - returns: An element equal to member if member is contained in the set; otherwise, nil. - @discardableResult - public mutating func remove(_ element: Element) -> Element? { - let _removedElement = set.remove(element) - guard let removedElement = _removedElement else { return nil } - - let idx = array.firstIndex(of: element)! - array.remove(at: idx) - - return removedElement - } -} - -extension OrderedSet: ExpressibleByArrayLiteral { - /// Create an instance initialized with `elements`. - /// - /// If an element occurs more than once in `element`, only the first one - /// will be included. - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension OrderedSet: RandomAccessCollection { - public var startIndex: Int { return contents.startIndex } - public var endIndex: Int { return contents.endIndex } - public subscript(index: Int) -> Element { - return contents[index] - } -} - -public func == (lhs: OrderedSet, rhs: OrderedSet) -> Bool { - return lhs.contents == rhs.contents -} - -extension OrderedSet: Hashable where Element: Hashable { } diff --git a/Sources/TSCUtility/PkgConfig.swift b/Sources/TSCUtility/PkgConfig.swift index 464df4c2..ddb07e2a 100644 --- a/Sources/TSCUtility/PkgConfig.swift +++ b/Sources/TSCUtility/PkgConfig.swift @@ -1,15 +1,16 @@ /* This source file is part of the Swift.org open source project - Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors + Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors Licensed under Apache License v2.0 with Runtime Library Exception See http://swift.org/LICENSE.txt for license information See http://swift.org/CONTRIBUTORS.txt for Swift project authors */ -import TSCBasic import Foundation +import OrderedCollections +import TSCBasic // deprecated 12/21, moved to SwiftPM @available(*, deprecated, message: "moved into SwiftPM") diff --git a/Tests/TSCBasicTests/OrderedDictionaryTests.swift b/Tests/TSCBasicTests/OrderedDictionaryTests.swift deleted file mode 100644 index 09fd7126..00000000 --- a/Tests/TSCBasicTests/OrderedDictionaryTests.swift +++ /dev/null @@ -1,29 +0,0 @@ -/* - This source file is part of the Swift.org open source project - - Copyright 2018 Apple Inc. and the Swift project authors - Licensed under Apache License v2.0 with Runtime Library Exception - - See http://swift.org/LICENSE.txt for license information - See http://swift.org/CONTRIBUTORS.txt for Swift project authors -*/ - -import XCTest - -import TSCBasic - -class OrderedDictionaryTests: XCTestCase { - func testBasics() { - var dict: OrderedDictionary = ["a": "aa", "b": "bb", "c": "cc", "d": "dd"] - XCTAssertEqual(dict.description, "[a: aa, b: bb, c: cc, d: dd]") - - dict["a"] = "aaa" - XCTAssertEqual(dict.description, "[a: aaa, b: bb, c: cc, d: dd]") - - dict["e"] = "ee" - XCTAssertEqual(dict.description, "[a: aaa, b: bb, c: cc, d: dd, e: ee]") - - dict["b"] = nil - XCTAssertEqual(dict.description, "[a: aaa, c: cc, d: dd, e: ee]") - } -} diff --git a/Tests/TSCBasicTests/OrderedSetTests.swift b/Tests/TSCBasicTests/OrderedSetTests.swift deleted file mode 100644 index 22219fc0..00000000 --- a/Tests/TSCBasicTests/OrderedSetTests.swift +++ /dev/null @@ -1,58 +0,0 @@ -/* - This source file is part of the Swift.org open source project - - Copyright 2016 Apple Inc. and the Swift project authors - Licensed under Apache License v2.0 with Runtime Library Exception - - See http://swift.org/LICENSE.txt for license information - See http://swift.org/CONTRIBUTORS.txt for Swift project authors -*/ - -import XCTest - -import TSCBasic - -typealias OrderedSet = TSCBasic.OrderedSet - -class OrderedSetTests: XCTestCase { - func testBasics() { - // Create an empty set. - var set = OrderedSet() - XCTAssertTrue(set.isEmpty) - XCTAssertEqual(set.contents, []) - - // Create a new set with some strings. - set = OrderedSet(["one", "two", "three"]) - XCTAssertFalse(set.isEmpty) - XCTAssertEqual(set.count, 3) - XCTAssertEqual(set[0], "one") - XCTAssertEqual(set[1], "two") - XCTAssertEqual(set[2], "three") - XCTAssertEqual(set.contents, ["one", "two", "three"]) - - // Try adding the same item again - the set should be unchanged. - XCTAssertEqual(set.append("two"), false) - XCTAssertEqual(set.count, 3) - XCTAssertEqual(set[0], "one") - XCTAssertEqual(set[1], "two") - XCTAssertEqual(set[2], "three") - - // Remove the last element. - let three = set.removeLast() - XCTAssertEqual(set.count, 2) - XCTAssertEqual(set[0], "one") - XCTAssertEqual(set[1], "two") - XCTAssertEqual(three, "three") - - // Remove all the objects. - set.removeAll(keepingCapacity: true) - XCTAssertEqual(set.count, 0) - XCTAssertTrue(set.isEmpty) - XCTAssertEqual(set.contents, []) - - set.append("Hello") - XCTAssertEqual(set.remove("Hello"), "Hello") - XCTAssertEqual(set.remove("Hello"), nil) - XCTAssertEqual(set.remove("cool"), nil) - } -} From d5359c1a881d597cdcbb1f1802faee9bc8c60b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=80=E5=8D=93=E7=96=8C?= <55120045+WowbaggersLiquidLunch@users.noreply.github.com> Date: Wed, 2 Feb 2022 05:04:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?add=20swift-collections=20to=20`TSCBasic`?= =?UTF-8?q?=20and=20`TSCUtiility`=E2=80=99s=20`CMakeLists`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/TSCBasic/CMakeLists.txt | 3 +-- Sources/TSCUtility/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/TSCBasic/CMakeLists.txt b/Sources/TSCBasic/CMakeLists.txt index 73517a6a..9187a889 100644 --- a/Sources/TSCBasic/CMakeLists.txt +++ b/Sources/TSCBasic/CMakeLists.txt @@ -32,8 +32,6 @@ add_library(TSCBasic Lock.swift OSLog.swift ObjectIdentifierProtocol.swift - OrderedDictionary.swift - OrderedSet.swift WritableByteStream.swift Path.swift PathShims.swift @@ -58,6 +56,7 @@ target_compile_options(TSCBasic PUBLIC "$<$:SHELL:-Xcc -D_CRT_SECURE_NO_WARNINGS>") target_link_libraries(TSCBasic PUBLIC SwiftSystem::SystemPackage + OrderedCollections TSCLibc) target_link_libraries(TSCBasic PRIVATE TSCclibc) diff --git a/Sources/TSCUtility/CMakeLists.txt b/Sources/TSCUtility/CMakeLists.txt index 96aa7ddc..0d4478da 100644 --- a/Sources/TSCUtility/CMakeLists.txt +++ b/Sources/TSCUtility/CMakeLists.txt @@ -45,6 +45,7 @@ add_library(TSCUtility misc.swift ) target_link_libraries(TSCUtility PUBLIC + OrderedCollections TSCBasic) target_link_libraries(TSCUtility PRIVATE TSCclibc From 7afde185ccd52ab2fcb72ba33424bf17a50eb8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=80=E5=8D=93=E7=96=8C?= <55120045+WowbaggersLiquidLunch@users.noreply.github.com> Date: Wed, 2 Feb 2022 05:18:42 +0800 Subject: [PATCH 3/3] cmake --- .gitignore | 20 ++++++++--- CMakeLists.txt | 1 + Sources/TSCBasic/CMakeLists.txt | 2 +- Sources/TSCUtility/CMakeLists.txt | 2 +- Utilities/build-script-helper.py | 55 +++++++++++++++++++++++++++++-- 5 files changed, 71 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 4b488575..d2af99ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,21 @@ +# macOS .DS_Store + +# SwiftPM +.swiftpm /.build -/Packages +Package.resolved + +# CMake +CMakeCache.txt +CMakeFiles + +# Xcode /*.xcodeproj xcuserdata/ -.swiftpm -build + +# VScode .vscode -Package.resolved + +/Packages +build diff --git a/CMakeLists.txt b/CMakeLists.txt index c514239c..ebe84577 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ find_package(Foundation QUIET) find_package(Threads QUIET) find_package(SQLite3 REQUIRED) find_package(SwiftSystem CONFIG REQUIRED) +find_package(SwiftCollections REQUIRED) add_subdirectory(Sources) add_subdirectory(cmake/modules) diff --git a/Sources/TSCBasic/CMakeLists.txt b/Sources/TSCBasic/CMakeLists.txt index 9187a889..0e34e432 100644 --- a/Sources/TSCBasic/CMakeLists.txt +++ b/Sources/TSCBasic/CMakeLists.txt @@ -56,7 +56,7 @@ target_compile_options(TSCBasic PUBLIC "$<$:SHELL:-Xcc -D_CRT_SECURE_NO_WARNINGS>") target_link_libraries(TSCBasic PUBLIC SwiftSystem::SystemPackage - OrderedCollections + SwiftCollections::OrderedCollections TSCLibc) target_link_libraries(TSCBasic PRIVATE TSCclibc) diff --git a/Sources/TSCUtility/CMakeLists.txt b/Sources/TSCUtility/CMakeLists.txt index 0d4478da..1441207f 100644 --- a/Sources/TSCUtility/CMakeLists.txt +++ b/Sources/TSCUtility/CMakeLists.txt @@ -45,7 +45,7 @@ add_library(TSCUtility misc.swift ) target_link_libraries(TSCUtility PUBLIC - OrderedCollections + SwiftCollections::OrderedCollections TSCBasic) target_link_libraries(TSCUtility PRIVATE TSCclibc diff --git a/Utilities/build-script-helper.py b/Utilities/build-script-helper.py index f1357871..f12dd6d3 100755 --- a/Utilities/build-script-helper.py +++ b/Utilities/build-script-helper.py @@ -25,6 +25,8 @@ import sys import errno +g_macos_deployment_target = '10.10' + def note(message): print("--- %s: note: %s" % (os.path.basename(sys.argv[0]), message)) sys.stdout.flush() @@ -71,6 +73,11 @@ def main(): """) subparsers = parser.add_subparsers(dest='command') + # clean + parser_clean = subparsers.add_parser("clean", help="cleans build artifacts") + parser_clean.set_defaults(func=clean) + add_global_args(parser_clean) + # build parser_build = subparsers.add_parser("build", help="builds TSC using CMake") parser_build.set_defaults(func=build) @@ -120,6 +127,7 @@ def parse_global_args(args): """Parses and cleans arguments necessary for all actions.""" args.build_dir = os.path.abspath(args.build_dir) args.project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + args.swift_collections_source_dir = os.path.join(args.project_root, "..", "swift-collections") if platform.system() == 'Darwin': args.sysroot = call_output(["xcrun", "--sdk", "macosx", "--show-sdk-path"], verbose=args.verbose) @@ -133,6 +141,7 @@ def parse_build_args(args): args.swiftc_path = get_swiftc_path(args) args.cmake_path = get_cmake_path(args) args.ninja_path = get_ninja_path(args) + args.target_dir = os.path.join(args.build_dir, get_build_target(args)) def get_swiftc_path(args): """Returns the path to the Swift compiler.""" @@ -180,14 +189,38 @@ def get_ninja_path(args): else: return call_output(["which", "ninja"], verbose=args.verbose) +def get_build_target(args, cross_compile=False): + """Returns the target-triple of the current machine or for cross-compilation.""" + try: + command = [args.swiftc_path, '-print-target-info'] + if cross_compile: + cross_compile_json = json.load(open(args.cross_compile_config)) + command += ['-target', cross_compile_json["target"]] + target_info_json = subprocess.check_output(command, + stderr=subprocess.PIPE, universal_newlines=True).strip() + args.target_info = json.loads(target_info_json) + return args.target_info["target"]["unversionedTriple"] + except Exception as e: + # Temporary fallback for Darwin. + if platform.system() == 'Darwin': + return 'x86_64-apple-macosx' + else: + error(str(e)) + # ----------------------------------------------------------- # Actions # ----------------------------------------------------------- def build(args): parse_build_args(args) + build_swift_collections(args) build_tsc(args) +def clean(args): + parse_global_args(args) + + call(["rm", "-rf", args.build_dir], verbose=args.verbose) + # ----------------------------------------------------------- # Build functions # ----------------------------------------------------------- @@ -222,11 +255,27 @@ def build_with_cmake(args, cmake_args, source_path, build_dir): call(ninja_cmd, cwd=build_dir, verbose=args.verbose) -def build_tsc(args): +def build_swift_collections(args): + note("Building swift-collections") + args.swift_collections_build_dir = os.path.join(args.target_dir, "swift-collections") + cmake_flags = [] if platform.system() == 'Darwin': - cmake_flags.append("-DCMAKE_C_FLAGS=-target x86_64-apple-macosx10.10") - cmake_flags.append("-DCMAKE_OSX_DEPLOYMENT_TARGET=10.10") + cmake_flags.append("-DCMAKE_C_FLAGS=-target %s%s" % (get_build_target(args), g_macos_deployment_target)) + cmake_flags.append("-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target) + + build_with_cmake(args, cmake_flags, args.swift_collections_source_dir, args.swift_collections_build_dir) + + +def build_tsc(args): + note("Building TSC") + + cmake_flags = [ + "-DSwiftCollections_DIR=" + os.path.join(args.swift_collections_build_dir, "cmake/modules"), + ] + if platform.system() == 'Darwin': + cmake_flags.append("-DCMAKE_C_FLAGS=-target %s%s" % (get_build_target(args), g_macos_deployment_target)) + cmake_flags.append("-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target) build_with_cmake(args, cmake_flags, args.project_root, args.build_dir)