Swift Package Manager (SPM) Deployment Target

Does anyone know if it’s possible to set the deployment target when building with the Swift Package Manager (SPM)? From what I can tell, it is not currently possible to override it based on the source code itself. In the pbxproj().swift <https://github.com/apple/swift-package-manager/blob/master/Sources/Xcodeproj/pbxproj\(\)\.swift\#L73\-L78&gt; file, the MACOSX_DEPLOYMENT_TARGET is hardcoded to 10.10 with a FIXME saying it needs to be configurable.

If this currently cannot be overridden, then I’d like to file a feature request so we can build Alamofire 4.0.0 with the SPM. If it can be overridden, I’d really appreciate someone letting me know how.

Thanks in advance!

There isn't yet a builtin way to manage this. When generating an Xcode project, you can use the undocumented `--xcconfig-overrides` option to pass a path to an extra .xcconfig file you wish to include in the project and have build settings read from. You could then override the deployment target there.

See also:
  [swift-build-dev] swiftpm macOS target override

- Daniel

···

On Sep 24, 2016, at 4:44 PM, Gmail via swift-users <swift-users@swift.org> wrote:

Does anyone know if it’s possible to set the deployment target when building with the Swift Package Manager (SPM)? From what I can tell, it is not currently possible to override it based on the source code itself. In the pbxproj().swift <https://github.com/apple/swift-package-manager/blob/master/Sources/Xcodeproj/pbxproj\(\)\.swift\#L73\-L78&gt; file, the MACOSX_DEPLOYMENT_TARGET is hardcoded to 10.10 with a FIXME saying it needs to be configurable.

If this currently cannot be overridden, then I’d like to file a feature request so we can build Alamofire 4.0.0 with the SPM. If it can be overridden, I’d really appreciate someone letting me know how.

Thanks in advance!

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Here's the PR that allows you to override this from the command line:

···

--
Keith Smiley

On 09/26, Daniel Dunbar via swift-users wrote:

There isn't yet a builtin way to manage this. When generating an Xcode project, you can use the undocumented `--xcconfig-overrides` option to pass a path to an extra .xcconfig file you wish to include in the project and have build settings read from. You could then override the deployment target there.

See also:
  [swift-build-dev] swiftpm macOS target override

- Daniel

> On Sep 24, 2016, at 4:44 PM, Gmail via swift-users <swift-users@swift.org> wrote:
>
> Does anyone know if it’s possible to set the deployment target when building with the Swift Package Manager (SPM)? From what I can tell, it is not currently possible to override it based on the source code itself. In the pbxproj().swift <https://github.com/apple/swift-package-manager/blob/master/Sources/Xcodeproj/pbxproj\(\)\.swift\#L73\-L78&gt; file, the MACOSX_DEPLOYMENT_TARGET is hardcoded to 10.10 with a FIXME saying it needs to be configurable.
>
> If this currently cannot be overridden, then I’d like to file a feature request so we can build Alamofire 4.0.0 with the SPM. If it can be overridden, I’d really appreciate someone letting me know how.
>
> Thanks in advance!
>
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Thanks for all the help so far everyone. I’ve now been able to successfully compile an example command line tool with Alamofire using `--xcconfig-overrides` flag and an .xcconfig file. However, I’ve run into one issue and have an additional question.

The issue I’m hitting is that the project still has the `MACOSX_DEPLOYMENT_TARGET` manually set (it’s bold) to `10.10` even though the xcconfig is loaded and has overridden it. If I delete the manual setting, the deployment target is set to 10.11 which is coming from the xcconfig file. While this is certainly nice, it may throw some people off at first when using this approach.

The second question I have is whether this type of override is planned for `swift build` or just for creating an Xcode project? My apologies if this has been answered in other threads, but I haven’t been able to track this down yet.

Thanks!

···

--

Christian

On Sep 30, 2016, at 11:08 AM, Keith Smiley <k@keith.so> wrote:

Here's the PR that allows you to override this from the command line:
Reorder swiftc args to allow user override by keith · Pull Request #715 · apple/swift-package-manager · GitHub

--
Keith Smiley

On 09/26, Daniel Dunbar via swift-users wrote:

There isn't yet a builtin way to manage this. When generating an Xcode project, you can use the undocumented `--xcconfig-overrides` option to pass a path to an extra .xcconfig file you wish to include in the project and have build settings read from. You could then override the deployment target there.

See also:
[swift-build-dev] swiftpm macOS target override

- Daniel

On Sep 24, 2016, at 4:44 PM, Gmail via swift-users <swift-users@swift.org> wrote:

Does anyone know if it’s possible to set the deployment target when building with the Swift Package Manager (SPM)? From what I can tell, it is not currently possible to override it based on the source code itself. In the pbxproj().swift <https://github.com/apple/swift-package-manager/blob/master/Sources/Xcodeproj/pbxproj\(\)\.swift\#L73\-L78&gt; file, the MACOSX_DEPLOYMENT_TARGET is hardcoded to 10.10 with a FIXME saying it needs to be configurable.

If this currently cannot be overridden, then I’d like to file a feature request so we can build Alamofire 4.0.0 with the SPM. If it can be overridden, I’d really appreciate someone letting me know how.

Thanks in advance!

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

And here’s the command I’ve been using to generate the Xcode project for anyone else interested:

$ swift package generate-xcodeproj --verbose --xcconfig-overrides ./Configuration.xcconfig --output ./SPMTester.xcodeproj

And the xcconfig:

SDKROOT = macosx
MACOSX_DEPLOYMENT_TARGET = 10.11

Cheers,

···

--

Christian

Thanks for all the help so far everyone. I’ve now been able to successfully compile an example command line tool with Alamofire using `--xcconfig-overrides` flag and an .xcconfig file. However, I’ve run into one issue and have an additional question.

The issue I’m hitting is that the project still has the `MACOSX_DEPLOYMENT_TARGET` manually set (it’s bold) to `10.10` even though the xcconfig is loaded and has overridden it. If I delete the manual setting, the deployment target is set to 10.11 which is coming from the xcconfig file. While this is certainly nice, it may throw some people off at first when using this approach.

The second question I have is whether this type of override is planned for `swift build` or just for creating an Xcode project? My apologies if this has been answered in other threads, but I haven’t been able to track this down yet.

Thanks!
--

Christian

On Sep 30, 2016, at 11:08 AM, Keith Smiley <k@keith.so> wrote:

Here's the PR that allows you to override this from the command line:
https://github.com/apple/swift-package-manager/pull/715

--
Keith Smiley

On 09/26, Daniel Dunbar via swift-users wrote:

There isn't yet a builtin way to manage this. When generating an Xcode project, you can use the undocumented `--xcconfig-overrides` option to pass a path to an extra .xcconfig file you wish to include in the project and have build settings read from. You could then override the deployment target there.

See also:
[swift-build-dev] swiftpm macOS target override

- Daniel

On Sep 24, 2016, at 4:44 PM, Gmail via swift-users <swift-users@swift.org> wrote:

Does anyone know if it’s possible to set the deployment target when building with the Swift Package Manager (SPM)? From what I can tell, it is not currently possible to override it based on the source code itself. In the pbxproj().swift <https://github.com/apple/swift-package-manager/blob/master/Sources/Xcodeproj/pbxproj\(\)\.swift\#L73\-L78&gt; file, the MACOSX_DEPLOYMENT_TARGET is hardcoded to 10.10 with a FIXME saying it needs to be configurable.

If this currently cannot be overridden, then I’d like to file a feature request so we can build Alamofire 4.0.0 with the SPM. If it can be overridden, I’d really appreciate someone letting me know how.

Thanks in advance!

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

This seems to work with the swift package tool shipped with Xcode 8, but not off
of master. It looks like this commit Generate Xcode projects using a layered data model instead of · apple/swift-package-manager@4f1459e · GitHub
changed this because now settings are stored in the xcodeproj instead of in a
xcconfig that imported your override xcconfig.

I think because of this, if we plan to continue to have the --xcconfig-overrides
flag we should consider going back to the old method.

···

--
Keith Smiley

On 10/02, Gmail wrote:

And here’s the command I’ve been using to generate the Xcode project for anyone else interested:

$ swift package generate-xcodeproj --verbose --xcconfig-overrides ./Configuration.xcconfig --output ./SPMTester.xcodeproj

And the xcconfig:

SDKROOT = macosx
MACOSX_DEPLOYMENT_TARGET = 10.11

Cheers,
--

Christian

> Thanks for all the help so far everyone. I’ve now been able to successfully compile an example command line tool with Alamofire using `--xcconfig-overrides` flag and an .xcconfig file. However, I’ve run into one issue and have an additional question.
>
> The issue I’m hitting is that the project still has the `MACOSX_DEPLOYMENT_TARGET` manually set (it’s bold) to `10.10` even though the xcconfig is loaded and has overridden it. If I delete the manual setting, the deployment target is set to 10.11 which is coming from the xcconfig file. While this is certainly nice, it may throw some people off at first when using this approach.
>
> The second question I have is whether this type of override is planned for `swift build` or just for creating an Xcode project? My apologies if this has been answered in other threads, but I haven’t been able to track this down yet.
>
> Thanks!
> --
>
> Christian
>
>> On Sep 30, 2016, at 11:08 AM, Keith Smiley <k@keith.so> wrote:
>>
>> Here's the PR that allows you to override this from the command line:
>> https://github.com/apple/swift-package-manager/pull/715
>>
>> --
>> Keith Smiley
>>
>> On 09/26, Daniel Dunbar via swift-users wrote:
>>> There isn't yet a builtin way to manage this. When generating an Xcode project, you can use the undocumented `--xcconfig-overrides` option to pass a path to an extra .xcconfig file you wish to include in the project and have build settings read from. You could then override the deployment target there.
>>>
>>> See also:
>>> [swift-build-dev] swiftpm macOS target override
>>>
>>> - Daniel
>>>
>>>> On Sep 24, 2016, at 4:44 PM, Gmail via swift-users <swift-users@swift.org> wrote:
>>>>
>>>> Does anyone know if it’s possible to set the deployment target when building with the Swift Package Manager (SPM)? From what I can tell, it is not currently possible to override it based on the source code itself. In the pbxproj().swift <https://github.com/apple/swift-package-manager/blob/master/Sources/Xcodeproj/pbxproj\(\)\.swift\#L73\-L78&gt; file, the MACOSX_DEPLOYMENT_TARGET is hardcoded to 10.10 with a FIXME saying it needs to be configurable.
>>>>
>>>> If this currently cannot be overridden, then I’d like to file a feature request so we can build Alamofire 4.0.0 with the SPM. If it can be overridden, I’d really appreciate someone letting me know how.
>>>>
>>>> Thanks in advance!
>>>>
>>>> _______________________________________________
>>>> swift-users mailing list
>>>> swift-users@swift.org
>>>> https://lists.swift.org/mailman/listinfo/swift-users
>>>
>>
>>> _______________________________________________
>>> swift-users mailing list
>>> swift-users@swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-users
>>
>

Here's the open bug for this [SR-2811] Generated Xcode projects need to allow .xcconfig files to override project settings · Issue #5202 · apple/swift-package-manager · GitHub

···

--
Keith Smiley

On Sun, Oct 9, 2016, at 15:00, Keith Smiley via swift-users wrote:

This seems to work with the swift package tool shipped with Xcode 8, but
not off
of master. It looks like this commit
Generate Xcode projects using a layered data model instead of · apple/swift-package-manager@4f1459e · GitHub
changed this because now settings are stored in the xcodeproj instead of
in a
xcconfig that imported your override xcconfig.

I think because of this, if we plan to continue to have the
--xcconfig-overrides
flag we should consider going back to the old method.

--
Keith Smiley

On 10/02, Gmail wrote:
> And here’s the command I’ve been using to generate the Xcode project for anyone else interested:
>
> $ swift package generate-xcodeproj --verbose --xcconfig-overrides ./Configuration.xcconfig --output ./SPMTester.xcodeproj
>
> And the xcconfig:
>
> SDKROOT = macosx
> MACOSX_DEPLOYMENT_TARGET = 10.11
>
> Cheers,
> --
>
> Christian
>
>
> > Thanks for all the help so far everyone. I’ve now been able to successfully compile an example command line tool with Alamofire using `--xcconfig-overrides` flag and an .xcconfig file. However, I’ve run into one issue and have an additional question.
> >
> > The issue I’m hitting is that the project still has the `MACOSX_DEPLOYMENT_TARGET` manually set (it’s bold) to `10.10` even though the xcconfig is loaded and has overridden it. If I delete the manual setting, the deployment target is set to 10.11 which is coming from the xcconfig file. While this is certainly nice, it may throw some people off at first when using this approach.
> >
> > The second question I have is whether this type of override is planned for `swift build` or just for creating an Xcode project? My apologies if this has been answered in other threads, but I haven’t been able to track this down yet.
> >
> > Thanks!
> > --
> >
> > Christian
> >
> >> On Sep 30, 2016, at 11:08 AM, Keith Smiley <k@keith.so> wrote:
> >>
> >> Here's the PR that allows you to override this from the command line:
> >> https://github.com/apple/swift-package-manager/pull/715
> >>
> >> --
> >> Keith Smiley
> >>
> >> On 09/26, Daniel Dunbar via swift-users wrote:
> >>> There isn't yet a builtin way to manage this. When generating an Xcode project, you can use the undocumented `--xcconfig-overrides` option to pass a path to an extra .xcconfig file you wish to include in the project and have build settings read from. You could then override the deployment target there.
> >>>
> >>> See also:
> >>> [swift-build-dev] swiftpm macOS target override
> >>>
> >>> - Daniel
> >>>
> >>>> On Sep 24, 2016, at 4:44 PM, Gmail via swift-users <swift-users@swift.org> wrote:
> >>>>
> >>>> Does anyone know if it’s possible to set the deployment target when building with the Swift Package Manager (SPM)? From what I can tell, it is not currently possible to override it based on the source code itself. In the pbxproj().swift <https://github.com/apple/swift-package-manager/blob/master/Sources/Xcodeproj/pbxproj\(\)\.swift\#L73\-L78&gt; file, the MACOSX_DEPLOYMENT_TARGET is hardcoded to 10.10 with a FIXME saying it needs to be configurable.
> >>>>
> >>>> If this currently cannot be overridden, then I’d like to file a feature request so we can build Alamofire 4.0.0 with the SPM. If it can be overridden, I’d really appreciate someone letting me know how.
> >>>>
> >>>> Thanks in advance!
> >>>>
> >>>> _______________________________________________
> >>>> swift-users mailing list
> >>>> swift-users@swift.org
> >>>> https://lists.swift.org/mailman/listinfo/swift-users
> >>>
> >>
> >>> _______________________________________________
> >>> swift-users mailing list
> >>> swift-users@swift.org
> >>> https://lists.swift.org/mailman/listinfo/swift-users
> >>
> >
>
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users