Xcodegen: link a product of another xcproj?

Created on 12 Apr 2018  路  6Comments  路  Source: yonaskolb/XcodeGen

i have a project and i want to link a .a that is the product of another xcproj. how can i do that?

so my proj is MyProj and a target MyApp. there is another one called SomeLib with a target Lib and a product lib.a. i want to link lib.a to MyApp.

question

Most helpful comment

so i do

  - framework: some/path/Other.xcodeproj
    implicit: true

so far so good. now this Other project has a scheme called Wow that makes a product called libWow.a.

how do i link that .a, so its built before my code starts compiling?

All 6 comments

I believe you can use the implicit dependencies feature to achieve this.

From the project spec docs -

Implicit Framework options:

This only applies to framework dependencies. Implicit framework dependencies are useful in Xcode Workspaces which have multiple .xcodeproj that are not embedded within each other yet have a dependency on a framework built in an adjacent .xcodeproj. By having Find Implicit Dependencies checked within your scheme Build Options Xcode can link built frameworks in BUILT_PRODUCTS_DIR.

implicit: Bool - Whether the framework is an implicit dependency. Defaults to false .

the problem is that my project is a project, not a workspace that contains these extra projects.

How would you of done this in without XcodeGen? I assume just drag the framework in?
In that case you can add a framework dependency

targets:
  MyTarget:
    dependencies:
      - framework: path/to/framework.a
        embed: true

You then may have to set OTHER_LDFLAGS and LIBRARY_SEARCH_PATHS as mentioned here:
https://github.com/yonaskolb/XcodeGen/issues/271

@yonaskolb i tried again today but i still think there is something missing.

my project is using a .a file that is a product of another project. that other project has a shared scheme, that builds this .a file, that i need for my project as a dependency.

using - framework: .. i can only add the path of the .a file, but that doesnt work because the .a will never be built, and it doesnt exist yet, or i can add the path of the other project, but that isnt going to build the .a file i need from it.

does that make sense?

Should be able to use implicit: true to have it look in the built products directory.

so i do

  - framework: some/path/Other.xcodeproj
    implicit: true

so far so good. now this Other project has a scheme called Wow that makes a product called libWow.a.

how do i link that .a, so its built before my code starts compiling?

Was this page helpful?
0 / 5 - 0 ratings