-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Extra compiler/linker options in Package.swift #75
Conversation
Thanks, this is something that maybe we need. However, please provide a usecase that justifies this so we can discuss the ramifications. |
Thanks, for these issues we'd like to solve this with modifications to how module map packages work. I will be writing up a proposal for this hopefully today. We are not opposed to supporting arbitrary command line options but we want to avoid it as long as possible, supporting such things offers power and flexibility to developers they may need, but it also causes build problems that can be difficult to fix for end-users who don't understand the packages they are consuming that well. |
@mxcl How is different at the end? If we specify header path in modules, it will still cause problems if something is missing and it will be hard to consume it anyway. I understand your rationale but I am not sure how module maps can improve it. Plus changing the way how module maps work require changes in Clang if I am not mistaken. Anyway looking forward to your proposal. |
|
@mxcl I agree that Even though This is the use case that I consider about this 'other compiler/linker options'. (of course this case might be just for system module developers, not for all users) import PackageDescription
let LIB_ROOT = "<place of my development version of lib instead of OS lib path>"
let SRC_ROOT = "<place of my project>"
let cflags = [
"-I\(LIB_ROOT)/include",
"-I\(SRC_ROOT)/ModuleMaps",
"-F-module-map=\(SRC_ROOT)/ModuleMaps/CZeroMQ/module.modulemap",
]
let lflags = [
"-L\(LIB_ROOT)/lib",
"-lzmq",
"-lczmq",
]
let package = Package(
name:"Hello",
// dependencies: [
// .Package(url:"../CZeroMQ", majorVersion:1),
// ],
otherCompilerOptions:cflags,
otherLinkerOptions:lflags
) Of course I could separate system module when it is ready for release, but while Since SPM produces |
…tions # Conflicts: # Sources/swift-build/main.swift
I think there is value in discussing the possibility of this feature for terminus-packages (ie. root-packages, the package swift-build builds but not for any packages it fetches). My main concern is avoiding dependency hell scenarios. My secondary concern is preventing packages at any part of the graph from demanding build settings that are fragile. Build toolchains are fundamentally fragile. One only has to browse the comments and ratings for popular IDEs to appreciate that. We strongly desire to reduce fragility. We can solve your motivating problem: that it is tedious to tag packages you are developing, and have intention to do so with some concept of "dev packages". |
It is worth noting that the existing of arbitrary search paths is exactly one thing which makes good module support very difficult (because modules from the Clang perspective are intimately intertwined with header search paths, and allowing any project to contribute them is a recipe for disaster). One of our goals in trying to maintain tight control over the dependencies is to try and deliver a much more reliable experience in the long run... |
…call-exit <rdar://problem/30059364> BuildEngine shouldn't call exit for error handling that isn't necessarily a programmer error
[pull] swiftwasm from master
Add
otherCompilerOptions
andotherLinkerOptions
inPackage
for Package.swift