-
Notifications
You must be signed in to change notification settings - Fork 633
Add Meson buildsystem support #424
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks, I know nothing about Meson so if it builds then it looks good to me. I just don't see the main unit tests being built and run. |
|
You're right! I'm not sure how I missed adding that. the latest version has that tested added. |
966e1e7 to
8dd0b2e
Compare
|
Does this run the tests? |
|
It looks like it builds the tests but doesn't run them. I think it would be good to run them as well. |
|
Yeah, i think it should be running them, but it doesn't. I'm not sure if it's a GitHub configuration issue or something in the Meson. I haven't had time to look this week, but I'm hoping to on Monday |
|
@dcbaker Are you still working on this? |
This is primarily intended to be useful for projects using Meson wishing to consume cxxopts as a subproject. By hosting the files upstream users get the benefit of automatic parity with the CMake based install provided by an OS vendor or distribution. The implementation attempts to mirror the CMake build as much as possible, with the exception of generating the cmake-config files, which Meson doesn't currently support. It uses a small python script to parse the cxxopts.hpp header to extract the version, due to a concious design decision of Meson to leave such complex logic to external scripting languages like Python.
f2e8f2b to
d4ddc8c
Compare
|
@lazysegtree I had completely forgotten about it TBH, thanks for remding me :) The tests are now running, and I think that covers all of the requested changes |
| option( | ||
| 'examples', | ||
| type : 'feature', | ||
| description : 'Whether to build examples. Defaults to enabled when not built as a subproject, otherwise disabled.', | ||
| ) | ||
| option( | ||
| 'tests', | ||
| type : 'feature', | ||
| description : 'Whether to build tests. Defaults to enabled when not built as a subproject, otherwise disabled.', | ||
| ) | ||
| option( | ||
| 'warnings', | ||
| type : 'feature', | ||
| description : 'Whether to add additional warnings. Defaults to enabled when not built as a subproject, otherwise disabled.', | ||
| ) | ||
| option( | ||
| 'icu', | ||
| type : 'feature', | ||
| value : 'disabled', | ||
| description : 'use ICU Unicode 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.
Since all options like examples, and warning aren't covered in build workflows, it would be nice that you could provide logs from your system that they can successfully execute now. Something like results of meson run --option=example.
This will provide a proof that all the meson build instructions you have written, works as expected.
And will act as a proof that the options worked in the past at one place, if build breaks at some point in the future.
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.
@dcbaker It looks to me that we are not running the tests find-package-test and add-subdirectory-test that targets the src/example.cpp . Is that not a problem? Are those tests on for something cmake specific? Or it would benefit to add them later ( don't have to be this PR, we can track that in a different PR)
cmake output from github workflow -
Run ctest -C $BUILD_TYPE --output-on-failure
Test project /home/runner/work/cxxopts/cxxopts/build/test
Start 1: options
1/3 Test #1: options .......................... Passed 0.00 sec
Start 2: find-package-test
2/3 Test #2: find-package-test ................ Passed 6.45 sec
Start 3: add-subdirectory-test
3/3 Test #3: add-subdirectory-test ............ Passed 6.26 sec
100% tests passed, 0 tests failed out of 3
Total Test time (real) = 12.73 sec
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.
The find-package test relies on having the cmake config files. Meson can generate very simple cmake files, but not using targets like cxxopts does, but we haven't put effort into generating more complex ones because CMake itself is migrating away from that toward CPS, and we are also working on CPS support, so there isn't really a good way for me to implement it.
The add-subdirectory test doesn't make a lot of sense for Meson either, as Meson has always had a feature more like CMake's ExternalProject, and doesn't allow external projects to be added as a subdirectory. I could potentially add a test to use cxxopts via a subproject call (roughly equivalent to ExternalProject), if you'd like.
6033252 to
3436819
Compare
I've tried to be a bit more minimal here than the CMake tests are, since there's already a good cross section of testing there. For Meson, I just want to touch test each of the major platforms to ensure that it works
|
Latest version includes building with ICU support on and off on Ubuntu, as well as running the example on Ubuntu. I can add tests to toggle examples on and off, as well as turning the warnings off, they're both currently turned on by default |
lazysegtree
left a comment
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.
LGTM
Meson, Like CMake and Bazel, is a modern build system supporting C++ with the ability to configure and build dependencies from source. To do this effectively, it needs native Meson build definitions for the project to be built. This PR adds those definitions with as much parity to the C++ build system as possible, with the exception of the generation of the CMake configuration files (Meson cannot generate sophisticated ones using targets), and without some of the tests, since one is for CMake files it doesn't generate, and the other is for fuzzing, which is still a painful experience in Meson.
I've provided CI jobs, but much more minimal ones than what CMake runs.
This change is