-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix/Cleanup some unnecessary build setting #9228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// swift-tools-version: 6.2 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "CCPackage", | ||
products: [ | ||
.library(name: "CCTarget", type: .static, targets: ["CCTarget"]), | ||
], | ||
targets: [ | ||
.target(name: "CCTarget", ), | ||
.executableTarget(name: "executable", dependencies: ["CCTarget"]), | ||
] | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
#include <string> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// The Swift Programming Language | ||
// https://docs.swift.org/swift-book | ||
|
||
@main | ||
struct Executable { | ||
static func main() { | ||
print("Hello, world!") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -488,14 +488,16 @@ extension PackagePIFProjectBuilder { | |
if enableDuplicateLinkageCulling { | ||
impartedSettings[.LD_WARN_DUPLICATE_LIBRARIES] = "NO" | ||
} | ||
impartedSettings[.OTHER_LDFLAGS] = (sourceModule.isCxx ? ["-lc++"] : []) + ["$(inherited)"] | ||
impartedSettings[.OTHER_LDRFLAGS] = [] | ||
log( | ||
.debug, | ||
indent: 1, | ||
"Added '\(impartedSettings[.OTHER_LDFLAGS]!)' to imparted OTHER_LDFLAGS" | ||
) | ||
|
||
if sourceModule.isCxx { | ||
for platform in ProjectModel.BuildSettings.Platform.allCases { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Windows, clang uses the MSVC C++ runtime, not libc++, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like it, -lc++ was not found, and it look like the linker is adding the MSVC libraries as c++ packages seem to be building now |
||
// darwin & freebsd | ||
if [.macOS, .macCatalyst, .iOS, .watchOS, .tvOS, .xrOS, .driverKit, .freebsd].contains(platform) { | ||
settings[.OTHER_LDFLAGS, platform] = ["-lc++", "$(inherited)"] | ||
} else if [.android, .linux, .wasi, .openbsd].contains(platform) { | ||
settings[.OTHER_LDFLAGS, platform] = ["-lstdc++", "$(inherited)"] | ||
} | ||
} | ||
} | ||
// This should be only for dynamic targets, but that isn't possible today. | ||
// Improvement is tracked by rdar://77403529 (Only impart `PackageFrameworks` search paths to clients of dynamic | ||
// package targets and products). | ||
|
@@ -820,7 +822,6 @@ extension PackagePIFProjectBuilder { | |
impartedSettings[.OTHER_CFLAGS] = ["-fmodule-map-file=\(systemLibrary.modulemapFileAbsolutePath)"] + | ||
pkgConfig.cFlags.prepending("$(inherited)") | ||
impartedSettings[.OTHER_LDFLAGS] = pkgConfig.libs.prepending("$(inherited)") | ||
impartedSettings[.OTHER_LDRFLAGS] = [] | ||
impartedSettings[.OTHER_SWIFT_FLAGS] = ["-Xcc"] + impartedSettings[.OTHER_CFLAGS]! | ||
log(.debug, indent: 1, "Added '\(systemLibrary.path.pathString)' to imparted HEADER_SEARCH_PATHS") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know why this was set? Could be a default value that this is explicitly wanting to clear out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it came over from the old PIF builder, not sure the history here.