-
Notifications
You must be signed in to change notification settings - Fork 90
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
Enables C++ support in srcs #550
Conversation
additional_cc_copts.append("-I.") | ||
native.cc_library( | ||
native.objc_library( |
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 had to be an objc_library
to avoid an error in framework_packaging_impl
where it expected all deps would have an Objc
provider
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.
Believe this closes #537
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.
@jszumski - thanks for the PR and adding the test case overall, this LGTM! The one question I had for you is around the .mm
files. Addressing that may be better as a followup if it's going to change behavior for people. Historically, these needed to be compiled adjacent to the C++ in Bazel. If you reference, PodToBUILD ( ObjcLibrary.swift
) - I believe you'll find it done this way or similar - that it needs has to mirror cocoapods and apply C++ specific flags ( e.g. from CXX xcconfig group ) to the files
name = cpp_libname, | ||
srcs = cpp_sources + objc_private_hdrs, | ||
srcs = cpp_sources + objc_private_hdrs + objc_non_exported_hdrs, | ||
hdrs = objc_hdrs, | ||
copts = copts_by_build_setting.cc_copts + cc_copts + additional_cc_copts, |
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 is missing a number of flags: perhaps you can add as a followup.
additional_objc_vfs_deps = select({
"@build_bazel_rules_ios//:virtualize_frameworks": [framework_vfs_overlay_name_swift] + [framework_vfs_overlay_name],
"//conditions:default": [framework_vfs_overlay_name_swift] + [framework_vfs_overlay_name] if enable_framework_vfs else [],
})
additional_objc_vfs_copts = select({
"@build_bazel_rules_ios//:virtualize_frameworks": framework_vfs_objc_copts,
"//conditions:default": framework_vfs_objc_copts if enable_framework_vfs else [],
})
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.
A follow up is a good idea 👍
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.
FWIW, this works in our build which has C++ sources for a couple CocoaPods. We were previously rewriting these into .mm
files and now we don't have to! 🎉
if not name.endswith(".cpp"):
return name
return _copy_genrule(
name.replace(".cpp", "_transmmogrified.mm"),
name,
name.replace(".cpp", ".mm"),
)
An alternative to #304 that enables the existing C++ target. Resolves #537.
copt
values for each.