Skip to content
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

[SR-3948] Support Build Settings #5111

rballard opened this issue Feb 13, 2017 · 1 comment

[SR-3948] Support Build Settings #5111

rballard opened this issue Feb 13, 2017 · 1 comment


Copy link

Previous ID SR-3948
Radar rdar://problem/23270646
Original Reporter @rballard
Type New Feature
Additional Detail from JIRA
Votes 6
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: acfa70332a18c4718006cf3e62144d2e

is duplicated by:

  • SR-883 Support conditional dependencies
  • SR-3233 Demands -Xlinker invocation even though modulemap already contains it
  • SR-3488 C/C++ packages can't be built for Android
  • SR-3838 Swift Package Manager can't specify C-language mode (-std option) per module
  • SR-4194 Lookup pkg-config files in system packages
  • SR-5851 swift build can't change -target
  • SR-8497 Make cross-test-target dependencies possible
  • SR-3484 Swift PM fails to build package with C++ and ObjC++ targets

relates to:

  • SR-3660 Add support for custom build configuration

Issue Description:

The package manager has no way to provide specific settings, such as compiler flags, for building the targets in a package. Some settings are critical for production code, such as the "deployment target" (the minimum OS version that the built code will run on). We need to provide a way to set at least the most important settings which users will need control over.

Copy link

swift-ci commented Sep 7, 2017

Comment by Amr Aboelela (JIRA)

In UserToolchain.swift:

self.extraSwiftCFlags = [


        "-sdk", destination.sdk.asString

    \] + destination.extraSwiftCFlags

And in build_ubuntu_cross_compilation_toolchain:

swift build --destination /tmp/cross-toolchain/ubuntu-xenial-destination.json


cat > "$cross_tc_basename/ubuntu-xenial-destination.json" <<EOF


"version": 1,

"sdk": "$(pwd)/$cross_tc_basename/$linux_sdk_name",

"toolchain-bin-dir": "$(pwd)/$cross_tc_basename/$xc_tc_name/usr/bin",

"target": "linux-unknown-x86_64",



So the answer of our question seems to create a destination.json file, fill it with the deployment target then run:

$ swift build --destination destination.json

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants