Add support for Swift Package Manager #1032
35
Package.swift
Normal file
35
Package.swift
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// swift-tools-version:5.3
|
||||||
|
|||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "yoga",
|
||||||
|
platforms: [
|
||||||
|
.iOS(.v9),
|
||||||
|
.macOS(.v10_10),
|
||||||
|
.watchOS(.v2),
|
||||||
|
.tvOS(.v10),
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
.library(
|
||||||
|
name: "yoga",
|
||||||
|
targets: ["yoga"]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "yoga",
|
||||||
|
dependencies: [],
|
||||||
|
path: "./yoga",
|
||||||
|
publicHeadersPath: "./swiftpm-support",
|
||||||
|
cxxSettings: [
|
||||||
|
.headerSearchPath("../"),
|
||||||
|
],
|
||||||
|
linkerSettings: [
|
||||||
|
.linkedFramework("Foundation"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
cxxLanguageStandard: .cxx14
|
||||||
![]() this should probably be this should probably be `.cxx17`, as this is the version we are typically using internally.
![]() Yoga is targeting C++14 for a little bit longer. There was some unhappiness when I tried to bump from C++ 11 directly to 17. LLVM has had C++ 17 support for almost six years though, so I do plan for us to do a bump later this year. Same rules for same infra, and unlocking more support. See https://github.com/facebook/yoga/pull/1203 for discussion Yoga is targeting C++14 for a little bit longer. There was some unhappiness when I tried to bump from C++ 11 directly to 17.
LLVM has had C++ 17 support for almost six years though, so I do plan for us to do a bump later this year. Same rules for same infra, and unlocking more support.
See https://github.com/facebook/yoga/pull/1203 for discussion
|
|||||||
|
)
|
@@ -33,6 +33,7 @@ Pod::Spec.new do |spec|
|
|||||||
'-fPIC'
|
'-fPIC'
|
||||||
]
|
]
|
||||||
spec.source_files = 'yoga/**/*.{c,h,cpp}'
|
spec.source_files = 'yoga/**/*.{c,h,cpp}'
|
||||||
|
spec.exclude_files = 'yoga/swiftpm-support/*.h'
|
||||||
spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h'
|
spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
21
yoga/swiftpm-support/umbrella.h
Normal file
21
yoga/swiftpm-support/umbrella.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
![]() Is it possible to use the SWIFT_PACKAGE preprocessor flag here to make it even safer? Is it possible to use the [SWIFT_PACKAGE](https://github.com/apple/swift-package-manager/blob/main/Documentation/Usage.md#packaging-legacy-code) preprocessor flag here to make it even safer?
![]() Does not seem to be defined at the time the public header is compiled. Only when the code that's part of the package is built. Does not seem to be defined at the time the public header is compiled. Only when the code that's part of the package is built.
|
|||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#include "../YGEnums.h"
|
||||||
|
#include "../YGMacros.h"
|
||||||
|
#include "../YGNode.h"
|
||||||
|
#include "../YGStyle.h"
|
||||||
|
#include "../YGValue.h"
|
||||||
|
#include "../Yoga.h"
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user
we can probably use a more recent version of swift-tools here. At least
5.8
, until Xcode 15 become stable.We should maybe consider bumping this in CocoaPods as well then, which is currently set on 5.1