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

fix: set C/C++ language standards per target #1217

Merged
merged 37 commits into from
Oct 23, 2024
Merged

Conversation

cgrindel
Copy link
Owner

@cgrindel cgrindel commented Sep 8, 2024

This PR refactors the creation of C, C++, ObjC, and ObjC++ targets. For each C-like target in a Swift package, we now create a separate xxx_library target based upon the type of the source file (e.g. C, C++, ObjC, ObjC++, and assembly). These child libraries are added to a parent library that represents the Swift package target.

The goal of this work was to support language standard flags in the Bazel targets generated by rules_swift_package_manager. If a C language standard is specified in the Swift package, it is applied to the C and ObjC targets. If a C++ language standard is specified, it is applied to the C++ and the ObjC++ targets.

Note

The configuration for rules_xcodeproj in the Firebase example had to be updated to use the sandbox. Without this change, we were seeing duplicate definition errors. If you see these errors in your build, you may need to do the same.

Closes #1079 .

@cgrindel cgrindel self-assigned this Sep 8, 2024
@cgrindel cgrindel force-pushed the gh1079_c_std_settings2 branch 2 times, most recently from 9706eb5 to ca19083 Compare September 28, 2024 15:59
@cgrindel cgrindel mentioned this pull request Sep 30, 2024
19 tasks
@cgrindel cgrindel marked this pull request as ready for review October 21, 2024 13:46
swiftpkg/tests/swiftpkg_build_files_tests.bzl Outdated Show resolved Hide resolved
swiftpkg/tests/swiftpkg_build_files_tests.bzl Outdated Show resolved Hide resolved
@cgrindel
Copy link
Owner Author

@Mergifyio queue

Copy link
Contributor

mergify bot commented Oct 23, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 6d12d53

@mergify mergify bot merged commit 6d12d53 into main Oct 23, 2024
33 checks passed
@mergify mergify bot deleted the gh1079_c_std_settings2 branch October 23, 2024 14:29
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.

C/C++ language standards should be set per-target
3 participants