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

feat: add the zig_shared_library rule to generate shared objects or dynamic libraries #103

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

Titousensei
Copy link
Contributor

Solves #102

This is what I have so far. I'm not sure what command to run for the cross-platform tests. @aherrmann please advise.

Copy link
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, that's already looking great! You're close.

One small comment (some test definitions are missing).

I'm not sure what command to run for the cross-platform tests. @aherrmann please advise.

These tests are included in the standard test suites. So, they'll run when you run bazel test //.... To run these tests specifically you can use the command bazel test //zig/tests:target_platform_test. (The tests use Bazel's transitions system under the hood to test different target platforms.)

@Titousensei Titousensei force-pushed the shared_lib branch 2 times, most recently from 5cc8a1e to 14f0c84 Compare October 10, 2023 21:38
@Titousensei
Copy link
Contributor Author

Updated to fix the tests and address the comments:

  • renamed library target name to shared (was library), so make it more obvious the the name libshared.so is what's intended
  • added prefix for linux and macos
  • fixed soname
  • fixed tests and added more (threaded and mode)

@Titousensei Titousensei marked this pull request as ready for review October 10, 2023 21:40
@Titousensei Titousensei requested a review from aherrmann October 10, 2023 21:40
@Titousensei
Copy link
Contributor Author

Fixed tests failures related to defs import

```
./zig/private/common/zig_build.bzl:206: uninitialized: Variable "dynamic" may not have been initialized. (https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#uninitialized)
```
The 'lib' prefix was not taken into account.
Copy link
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing this feature!

I fixed a few more minor issues. I also noticed that there was a typo in the docs, these docs are automatically generated by running bazel run //docs:update, or by bazel run //utils:update which also updates other generated files.

@aherrmann aherrmann changed the title Implement rule zig_shared_library feat: add the zig_shared_library rule to generate shared objects or dynamic libraries Oct 11, 2023
@aherrmann aherrmann enabled auto-merge October 11, 2023 06:13
@aherrmann aherrmann merged commit f7512fc into aherrmann:main Oct 11, 2023
@Titousensei Titousensei deleted the shared_lib branch October 11, 2023 16:04
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.

2 participants