Skip to content
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

Merged
merged 1 commit into from May 21, 2016
Merged

Add Cpp support #362

merged 1 commit into from May 21, 2016

Conversation

ankitspd
Copy link
Member

@ankitspd ankitspd commented May 20, 2016

Depends on #360 merge

@@ -105,6 +105,7 @@ extension Command {
var args = module.basicArgs
args += module.optimizationFlags(conf)
args += ["-L\(prefix)"]
args += module.languageArgs
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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)

Copy link
Member

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.

@ddunbar
Copy link
Member

ddunbar commented May 20, 2016

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"])
Copy link
Collaborator

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)

Copy link
Member Author

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

@briancroom
Copy link
Collaborator

briancroom commented May 21, 2016

Nice work!

I left a line note about the linker error.

@ankitspd ankitspd force-pushed the cpp-support branch 3 times, most recently from f048d3b to 5ec54ab Compare May 21, 2016 14:18
@ankitspd
Copy link
Member Author

@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"])
Copy link
Member

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++.

@ankitspd
Copy link
Member Author

@ddunbar fixed comments

@ddunbar
Copy link
Member

ddunbar commented May 21, 2016

LGTM

@ddunbar ddunbar merged commit 1d99181 into apple:master May 21, 2016
@ankitspd ankitspd deleted the cpp-support branch May 21, 2016 19:25
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.

None yet

4 participants