Skip to content

[Xcodeproj] Generating clibs targets, beginning #205

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

Closed
wants to merge 7 commits into from
Closed

[Xcodeproj] Generating clibs targets, beginning #205

wants to merge 7 commits into from

Conversation

goloveychuk
Copy link
Contributor

Now -X command ignoring c targets and deps. This commit is early beginning, nothing is working.
Created PR, because I need help.
Xcode now writes

 <unknown>:0: error: unexpected input file: /Users/badim/github/swift/Venice/Packages/CLibvenice-0.4.0/Sources/chan.c

errors. To reproduce:

git clone [email protected]:Zewo/Venice.git
swift build -X

It's just an example, it could be other lib
So the question. How I can setup xcode project to build c lib from source and use modulemap as module to export. I just need generated xcodeproj xml, so I can reproduce it in spm code.
Thanks

@@ -99,6 +99,28 @@ public class TestModule: SwiftModule {
}
}

public class XcodeModule: Module {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there should be a XcodeModule since Modules here are things which can be built.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a protocol would be better, XCodeRepresentable or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to make a protocol. But -G use all Module fields. I made a protocol which copies all Module properties and stopped in

public var dependencies: [Module]  /// in build order

Don't remember an error. Also I'm not very good in swift, maybe it possible.

@goloveychuk
Copy link
Contributor Author

The problem in description is solved.

@goloveychuk goloveychuk changed the title Xcode generating clibs targets, beginning [Xcodeproj] Generating clibs targets, beginning Mar 20, 2016
@goloveychuk
Copy link
Contributor Author

@mxcl Could you please help with it?

What is done:

  1. swift build -X generates targets for clang modules.
  2. temporary it generates .framework instead of dylib, because I'm not sure modulemaps stuff works with dylibs. At least with framework it's importing c libs targets.
  3. It's putting modulemap path in project settings

Where are errors:

  1. It can't find a headers. E.g.
    https://github.com/Zewo/CLibvenice/blob/master/Sources/include/module.modulemap
  2. Even if I put absolute header's path - xcode fails in linking step.

I don't have strong xcode background so I can't configure xcode project by hands. If you or somebody else can send me xproj xml, I can reproduce it in code.
It's very stopping developing on swift with spm, while we can't write code in xcode. Thanks. I can merge with master, if needed

@Danappelxx
Copy link

@mxcl I haven't been watching too closely, but it looks like support for C libs in Xcode projects (what this PR is trying to implement) is still not here. #226 gets us half the way there (adding support for module maps) but still does not address the issue of packages with C sources (in the include directory).

I know you're very busy doing great work, but its frustrating to have a PR like this that is waiting for guidance from contributors but instead gets ignored for well over a week.

@ddunbar
Copy link
Contributor

ddunbar commented Apr 1, 2016

We have limited bandwidth, like any open source project. It is pretty common for requests to need "pings" when people are busy.

Also, if you really want to see this patch make progress then consider seeing if you can provide the necessary review directly!

@mxcl
Copy link
Contributor

mxcl commented Apr 1, 2016

I apologize. I am behind and for this specific topic I have reservations. I'll get to it soon.

@Danappelxx
Copy link

@ddunbar: Fair enough! I would help out with the review myself if I had a better understanding of Xcode, along with knowing the direction which you guys would like to take here (for example, I'm still not sure why SPM generates dynamic library targets instead of framework target).

@mxcl: Glad to hear that! Patiently waiting 😃

@aciidgh
Copy link
Contributor

aciidgh commented Apr 1, 2016

I was working on this yesterday, I probably will be able to finish this patch soon today.

@goloveychuk
Copy link
Contributor Author

@aciidb0mb3r
do you trying to rewrite it with XcodeProjectProtocol ?

@aciidgh
Copy link
Contributor

aciidgh commented Apr 1, 2016

Yes, but if you still want to give it another try feel free.
I was thinking of a XcodeProject protocol which SwiftModule and ClangModule will conform to.

@goloveychuk
Copy link
Contributor Author

I tried to make it with protocols but stopped with .dependecies, which are of Project type.
I added xcodeDependencies with casting to protocol, and failed with smth else. I tried and failed 3 times :) If you didn't started I can share code and cooperate.

@goloveychuk
Copy link
Contributor Author

@aciidb0mb3r I done it! With templates and extension XcodeModuleProtocol where Self: Module {
I will merge and commit here

@goloveychuk
Copy link
Contributor Author

Look at #235

@goloveychuk goloveychuk closed this Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants