json icon indicating copy to clipboard operation
json copied to clipboard

Bring Meson build definition more in line with CMake

Open dcbaker opened this issue 1 year ago • 13 comments

Update the Meson build definition to use Meson best practices, and bring into alignment with the CMake build files.

Particularly, This changes the meson build to only expose a single target, like the CMake does, controlled by an option with the same name. It additionally exposes the GlobalUDLs and ImplicitConversions options, which have behavioral implementations a consumer may wish to control. I have not exposed other options as they don't seem to be important for behavior.

The options names do not have the JSON_ prefix, and Meson already has (sub)project option namespaces, so adding JSON_ would worse (-Dnlohmann_json:ImplicitConversions vs -Dnlohmann_json:JSON_ImplicitConversions).

Pull request checklist

Read the Contribution Guidelines for detailed information.

  • [x] Changes are described in the pull request, or an existing issue is referenced.
  • [x] The test suite compiles and runs without error.
  • [ ] Code coverage is 100%. Test cases can be added by editing the test suite.
  • [x] The source code is amalgamated; that is, after making changes to the sources in the include/nlohmann directory, run make amalgamate to create the single-header files single_include/nlohmann/json.hpp and single_include/nlohmann/json_fwd.hpp. The whole process is described here.

dcbaker avatar Sep 09 '24 17:09 dcbaker

Is meson_options.txt really needed? If so, can it be moved into a subdirectory?

nlohmann avatar Sep 13 '24 12:09 nlohmann

Meson options must be specified in a meson_options.txt (or for fairly new versions of Meson in a meson.options file), and that file has to be in the same directory as the root meson.build file. Meson options are read-only from the meson.build files, and are read in before the parsing of the meson.build file starts.

dcbaker avatar Sep 13 '24 16:09 dcbaker

This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions!

github-actions[bot] avatar Jan 19 '25 00:01 github-actions[bot]

I know that the meson_options.txt seems to be a blocker here, if I opened a new PR with the patches up until meson_options.txt is added, would that allow those changes to move faster?

dcbaker avatar Jan 19 '25 01:01 dcbaker

How is this related to #3885?

nlohmann avatar Jan 19 '25 15:01 nlohmann

It's not at all. I can comment there.

dcbaker avatar Jan 19 '25 18:01 dcbaker

Please do - I don't know Meson and will not be able to solve any of these issues.

nlohmann avatar Jan 19 '25 18:01 nlohmann

This PR improves the meson build significantly. All the headers are now being installed. It doesn’t address the .cmake files (but that is a seperate issue.)

it would be good to see this merged.

https://github.com/nlohmann/json/issues/3885#issuecomment-1356724948

./usr/lib/pkgconfig/nlohmann_json.pc
./usr/include/nlohmann/detail/string_concat.hpp
./usr/include/nlohmann/detail/string_escape.hpp
./usr/include/nlohmann/detail/value_t.hpp
./usr/include/nlohmann/detail/macro_scope.hpp
./usr/include/nlohmann/detail/abi_macros.hpp
./usr/include/nlohmann/detail/iterators/iter_impl.hpp
./usr/include/nlohmann/detail/iterators/primitive_iterator.hpp
./usr/include/nlohmann/detail/iterators/json_reverse_iterator.hpp
./usr/include/nlohmann/detail/iterators/iteration_proxy.hpp
./usr/include/nlohmann/detail/iterators/iterator_traits.hpp
./usr/include/nlohmann/detail/iterators/internal_iterator.hpp
./usr/include/nlohmann/detail/hash.hpp
./usr/include/nlohmann/detail/input/lexer.hpp
./usr/include/nlohmann/detail/input/json_sax.hpp
./usr/include/nlohmann/detail/input/input_adapters.hpp
./usr/include/nlohmann/detail/input/position_t.hpp
./usr/include/nlohmann/detail/input/binary_reader.hpp
./usr/include/nlohmann/detail/input/parser.hpp
./usr/include/nlohmann/detail/exceptions.hpp
./usr/include/nlohmann/detail/json_custom_base_class.hpp
./usr/include/nlohmann/detail/conversions/to_json.hpp
./usr/include/nlohmann/detail/conversions/from_json.hpp
./usr/include/nlohmann/detail/conversions/to_chars.hpp
./usr/include/nlohmann/detail/json_ref.hpp
./usr/include/nlohmann/detail/output/serializer.hpp
./usr/include/nlohmann/detail/output/binary_writer.hpp
./usr/include/nlohmann/detail/output/output_adapters.hpp
./usr/include/nlohmann/detail/json_pointer.hpp
./usr/include/nlohmann/detail/meta/is_sax.hpp
./usr/include/nlohmann/detail/meta/type_traits.hpp
./usr/include/nlohmann/detail/meta/identity_tag.hpp
./usr/include/nlohmann/detail/meta/detected.hpp
./usr/include/nlohmann/detail/meta/cpp_future.hpp
./usr/include/nlohmann/detail/meta/void_t.hpp
./usr/include/nlohmann/detail/meta/call_std/end.hpp
./usr/include/nlohmann/detail/meta/call_std/begin.hpp
./usr/include/nlohmann/detail/meta/std_fs.hpp
./usr/include/nlohmann/detail/macro_unscope.hpp
./usr/include/nlohmann/adl_serializer.hpp
./usr/include/nlohmann/json_fwd.hpp
./usr/include/nlohmann/thirdparty/hedley/hedley_undef.hpp
./usr/include/nlohmann/thirdparty/hedley/hedley.hpp
./usr/include/nlohmann/ordered_map.hpp
./usr/include/nlohmann/json.hpp
./usr/include/nlohmann/byte_container_with_subtype.hpp

heitbaum avatar Jan 20 '25 02:01 heitbaum

I've rebased on the current develop branch to fix conflicts and added my signed-off-by

dcbaker avatar Jan 20 '25 19:01 dcbaker

Coverage Status

coverage: 99.191%. remained the same when pulling 30c24bf33928e0121af8d59aa1e7764ab8e70c4c on dcbaker:submit/meson-updates into 034f3ecdc6b17b075071be693d92f36232c0d671 on nlohmann:develop.

coveralls avatar Jan 20 '25 20:01 coveralls

This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions!

github-actions[bot] avatar Feb 28 '25 00:02 github-actions[bot]

I had forgotten about this, oops.

This still needs more work, but I've rebased on the devel branch and added some Meson information to the FILES.md file.

I want to look at the pkg config file thing some more as there is some discrepency between the .pc file and the cmake export files.

dcbaker avatar Oct 31 '25 19:10 dcbaker

This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions!

github-actions[bot] avatar Dec 01 '25 00:12 github-actions[bot]