-
Notifications
You must be signed in to change notification settings - Fork 39
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
Meson support #413
Meson support #413
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #413 +/- ##
=======================================
Coverage 88.76% 88.76%
=======================================
Files 82 82
Lines 14633 14633
=======================================
Hits 12989 12989
Misses 1644 1644 ☔ View full report in Codecov by Sentry. |
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.
Thank you for opening this!
I'm definitely open to this for nanoarrow as long as the options that are exposed are tested and there is an example somewhere of how to use nanoarrow as a meson dependency. Off the top of my head, a script like ci/scripts/meson-build.sh
might be a low-effort way to do this, and we could maybe add it as a weekly job (like release verification)?
Sounds good - I just copied over the minimal example and switched it to Meson. It is still a little different from what end users would do long term (i.e. would be nice to have nanoarrow in the WrapDB) but I think the gist of it is there |
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.
would be nice to have nanoarrow in the WrapDB)
Perhaps after 0.5.0 (in a month or so) it could be submitted? No pressure, but if you'd be willing to take that on I'd be happy to support anything else that needs to happen.
examples/meson-minimal/src/app.c
Outdated
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.
There is a more minimal example in the cmake build tests folder in examples/
that might be a better fit here (and also might be a better fit in the minimal cmake example, too, in some future PR making all our examples better).
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.
Can you point me to which example you are talking about? I copied the source code for this over from cmake-minimal
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
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.
Does this need a comment explaining what the difference would be if this weren't in the source tree? (At least until nanoarrow is in the wrap database?)
src/nanoarrow/meson.build
Outdated
# TODO: CMake uses a regex to extract major/minor/patch from this string | ||
version = '0.5.0-SNAPSHOT' |
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 can be hard-coded as long as it's in the version-bumping script (linked above)
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 ended up replacing this in the latest version to pull from the project configuration. I don't believe meson supports regular expressions so its a bit more convoluted than the CMake version to split that into major / minor / patch, but I think should work
src/nanoarrow/meson.build
Outdated
# TODO: the CMake configuration sets a different C++ version depending on | ||
# the version of Arrow used. Meson allows this standard to be set by subproject | ||
# do we need to do anything here? |
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 don't think we need this for the Meson build...we need some way to make sure that this works on Centos7, but not for very long, and we can just use CMake to test that.
.github/workflows/meson-build.yaml
Outdated
paths: | ||
- '.github/workflows/meson-build.yaml' | ||
- 'ci/scripts/build-with-meson.sh' |
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.
Probably this should also run when any of the config or options or build files are modified?
Yea happy to do so |
dev/benchmarks/c/meson.build
Outdated
incdir = '../../../src' | ||
incdir2 = '../../../src/nanoarrow' |
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.
thanks for the PR, I am not an expert on meson but this feels odd. Isn't there a way to not hardcode those directory paths?
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.
Nice catch - I set that up before I created the nanoarrow_dep
target, but can switch over to that
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 took a run through the READMEs and found a couple of things! Meson is cool!
.github/workflows/meson-build.yaml
Outdated
- 'meson.build' | ||
- 'meson.options' | ||
- 'src/nanoarrow/meson.build' | ||
- 'dev/benchmarks/meson.build' | ||
- 'dev/benchmarks/c/meson.build' |
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.
- 'meson.build' | |
- 'meson.options' | |
- 'src/nanoarrow/meson.build' | |
- 'dev/benchmarks/meson.build' | |
- 'dev/benchmarks/c/meson.build' | |
- '**meson.build' | |
- '**meson.options' |
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.
There should only ever be one meson.options
file at the project root so I didn't add the wildcard for that. But nice idea on the meson.build files
examples/meson-minimal/README.md
Outdated
under the License. | ||
--> | ||
|
||
# Minimal CMake Example |
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.
# Minimal CMake Example | |
# Minimal Meson Example |
examples/meson-minimal/src/app.c
Outdated
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 still think that the minimal example could be smaller here:
arrow-nanoarrow/examples/cmake-scenarios/src/app.cpp
Lines 18 to 26 in 9935713
#include "nanoarrow/nanoarrow.h" | |
#include "nanoarrow/nanoarrow.hpp" | |
int main(int argc, char* argv[]) { | |
nanoarrow::UniqueSchema schema; | |
NANOARROW_RETURN_NOT_OK(ArrowSchemaInitFromType(schema.get(), NANOARROW_TYPE_INT32)); | |
printf("Schema format for int32 is '%s'", schema->format); | |
return EXIT_SUCCESS; | |
} |
README.md
Outdated
Upon a successful build you can execute the test suite and benchmarks with the following commands: | ||
|
||
```sh | ||
meson test # default test run |
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.
meson test # default test run | |
meson test nanoarrow: # default test run |
README.md
Outdated
```sh | ||
meson test # default test run | ||
meson test --wrap valgrind # run tests under valgrind | ||
meson test --benchmark # run benchmarks |
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.
meson test --benchmark # run benchmarks | |
meson test --benchmark --verbose # run benchmarks |
examples/meson-minimal/README.md
Outdated
resulting length (or any error encountered whilst building the array). | ||
|
||
```bash | ||
./example_cmake_minimal_app |
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.
./example_cmake_minimal_app | |
./example_meson_minimal_app |
I believe I addressed all feedback but let me know if anything is outstanding |
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.
Sorry...I missed that notification! Thank you!
Not sure if there is a desire for supporting another build backend, but figured I would share in case. Meson seems a bit simpler than the existing CMake configuration, and has the advantage of: 1. Installing dependencies via the wrap database easily 2. Potentially making nanoarrow installable via the [WrapDB](https://mesonbuild.com/Adding-new-projects-to-wrapdb.html) Point 2 is not covered here, but might be a nice future enhancement for downstream Python libraries like NumPy and pandas that use Meson as their build systems
Not sure if there is a desire for supporting another build backend, but figured I would share in case.
Meson seems a bit simpler than the existing CMake configuration, and has the advantage of:
Point 2 is not covered here, but might be a nice future enhancement for downstream Python libraries like NumPy and pandas that use Meson as their build systems