Build a command line app with ArgumentParser from existing xcode project

I have a command line app written in Swift. It does not use the Swift package manager, and instead has a rather complex xcode project.

I want to use ArgumentParser. The documented way to do this is to import the Swift package, which Xcode 11 can do in the GUI.

The problem is that the built executable depends on the ArgumentParser framework's dylib. I need a standalone executable that doesn't depend on dynamic libraries besides those that come with Catalina.

When I use the Swift package manager to build a project that depends on ArgumentParser, it is able to do so without a dynamic library dependency. It seems to link in the swiftmodule file. I can't find a way to persuade Xcode to build one of those.

Is it possible to build a command line app using Xcode that uses ArgumentParser without requiring me to distribute the ArgumentParser dylib along with my main app binary?

My ideal solution would be to add the github ArgumentParser repo as a submodule, add its xcode project to my workspace, and depend on one of the build targets. But I'm open to other approaches.

Terms of Service

Privacy Policy

Cookie Policy