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
Add Cpp support #362
Add Cpp support #362
Conversation
@@ -105,6 +105,7 @@ extension Command { | |||
var args = module.basicArgs | |||
args += module.optimizationFlags(conf) | |||
args += ["-L\(prefix)"] | |||
args += module.languageArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't going to have the desired effect. Technically, if we wanted to do the right thing we would need to look at all dependencies of each ultimate link command, and see if any used C++, and if so then DTRT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah cool, I modified language args to search for any cpp source in dependencies too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still doesn't completely make sense, we want different language specific arguments for when we link versus when we compile. It only makes sense to pass -lc++ when we link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the name is bad then ... should I rename to lanugageLinkArgs?
(Note that this is linking stage)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I missed that. Yeah we should clearly distinguish between linking arguments and compiling arguments.
I'm not sure about link error off the top of my head... |
@@ -29,7 +29,7 @@ public struct Sources { | |||
|
|||
static public var validSwiftExtensions = Set<String>(["swift"]) | |||
|
|||
static public var validCExtensions = Set<String>(["c"]) | |||
static public var validCExtensions = Set<String>(["c", "m", "cc", "cpp", "cxx"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we are doing this, is there any reason not to include Objective-C++ at the same time? (.mm
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just haven't tested it yet... will do after objc and cpp gets merged
Nice work! I left a line note about the linker error. |
f048d3b
to
5ec54ab
Compare
@ddunbar Updated this one too... |
@@ -29,7 +29,7 @@ public struct Sources { | |||
|
|||
static public var validSwiftExtensions = Set<String>(["swift"]) | |||
|
|||
static public var validCExtensions = Set<String>(["c", "m"]) | |||
static public var validCExtensions = Set<String>(["c", "m", "cc", "cpp", "cxx"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should include 'mm' for C++.
@ddunbar fixed comments |
LGTM |
Depends on #360 merge