-
Notifications
You must be signed in to change notification settings - Fork 26
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
building works only via build.sh #5
Comments
Good point! I have updated the README to talk about build scripts (and the Resources directory). Hopefully, in future, once the package manager learns about pkg-config, this won't be necessary any more! |
Great - the documentation is much clearer now. Thanks for the quick reply. Yes, it would be great if at some point a native |
Actually there is still a significant issue. If I modify my program's source code and run build.sh, it regenerates all the wrappers and then recompiles all GTK-related Swift modules, which takes a long time. So each edit/compile iteration is super slow. From a quick glance at build.sh it seems I could call 'swift build' myself as long as I pass the right $CFLAGS and $LINKFLAGS to it. That would skip the wrapper generation, but it would still apparently recompile all the GTK Swift modules on each iteration, which is still super slow. Is there any known workaround? |
That's strange -- which version of Swift are you using? If you look at the build.sh, it should contain the following two lines (if you copied it from the SwiftHelloGtk example project): gtk=`echo .build/checkouts/SwiftGtk.*/Sources/Gtk-3.0.swift` This ensures that the wrappers are only generated if they don't exist. This should work for Swift 3.1 or higher. Also, if you are only changing your own source code (and not any of the generated files), the compiler should be clever enough only to re-compile your files, not the Gtk wrapper or other dependencies. |
Thanks for the reply. I'm running Swift 3.1.1 on Ubuntu 17.04. I had copied your SwiftHelloCairoGtk project as a starting point for my own. Looking at this again, it seems that
But SwiftHelloCairoGtk has
In SwiftHelloGtk, running So is build.sh in SwiftHelloCairoGtk outdated or wrong? If so, maybe you could update it - thanks! |
Also: in the documentation you wrote "unfortunately the Swift Package manager does not (yet) know how to run external programs such as pkg-config". But I think it does! The documentation at https://github.com/apple/swift-package-manager/blob/master/Documentation/PackageDescriptionV3.md indicates that you can specify a |
Yes, that's the plan. But, as far as I could see, at this stage, this is only available on the "master" (trunk) that is earmarked for Swift 4 (I couldn't get it to work for released versions of Swift up to 3.1.1). |
I believe the |
Just tried using the pkgConfig parameter, but this is what I get: error: nonWhitelistedFlags("Non whitelisted flags found: ["-Wl,-framework", "-Wl,CoreFoundation"] in pc file glib-2.0") I get this on macOS with the following Package.swift for the CGLib package:
|
BTW, I have clarified in the README now that |
I just tried building your CGLib example on Ubuntu 17.04 and it worked OK - I didn't see the nonWhitelistedFlags error, and I was able to call a glib function from a test program. I used the same package.swift as you. module.modulemap looks like this:
Unfortunately I had to include an absolute path fo the glib.h header as you can see above. pkg-config knows about the include path for that header ( |
I experienced this same issue, and it's because of the
Now whenever I hit build, it takes a reasonable amount of time. 😄 |
Yes, the path has changed with the latest version of the Swift Package Manager. I have updated the scripts in |
I just want to add the following for reference: When this gets implemented some time, it might help getting rid of the the build scripts. By the way, have you thought about just storing the |
Yes, extensible build tools would probably help. We'd have to see how they would work with generated sources, but hopefully there is a way to integrate them. The problem with storing the |
The main branch now uses Swift-5.6 plugins for building. |
SwiftGtk looks great! I've only just started to try it out, but so far it looks very useful and impressive!
The documentation at https://github.com/rhx/SwiftGtk implies that I can just add the SwiftGtk dependency to an existing project, then build as usual. But I've found that I can't do that and successfully build via
swift build
. On Ubuntu 17.04 that leads to this error:So I think you should either (a) make it possible to build via
swift build
, or (b) update the doc to indicate that I need to copy various files from the SwiftHelloGTK project (build.sh, config.sh and so on) into my project.The text was updated successfully, but these errors were encountered: