Eli Schwartz: 1 implement automatic array conversion of even more args 1 files changed, 8 insertions(+), 8 deletions(-)
I just pushed a fix, which at least works for Chipmunk2D.
Copy & paste the following snippet into your terminal to import this patchset into git:
curl -s https://lists.sr.ht/~lattis/muon/patches/25078/mbox | git am -3Learn more about email & git
While we are here, take the opportunity to actually check the type of the contents, which formerly was just "obj_array containing obj_any". I have left alone: - link_with, since it needs to handle both libraries and custom_target - include_directories, as it does custom type coercion - dependencies, since it needs to handle dependencies, external_libraries, and declare_dependencies, and using obj_dependency at least causes external library failure
In commit 8f9511aeab7eeaa22c6381263185461af15c00b9 "ensure deps is an array of dependencies" external libraries found via get_compiler('c').find_library('foo') are no longer accepted, which violates my intention from this commit. $ for i in */; do (cd $i; muon setup builddir || read); done [...] info detected compiler gcc 11.1.0 (cc) info configuring 'chipmunk', version: 6.2.2 info '-Wno-unused-parameter' supported: YES info found library 'm' at '/usr/lib/libm.so' /home/eschwartz/git/mesonbuild/wrapdb/subprojects/Chipmunk2D-Chipmunk-6.2.2/meson.build:20:46: error: expected type dependency, got external_library 20 | ], include_directories : inc, dependencies : m_dep) ^ /home/eschwartz/git/mesonbuild/wrapdb/subprojects/Chipmunk2D-Chipmunk-6.2.2/meson.build:10:7: error: in builtin function library 10 | lib = library('chipmunk', ['src/chipmunk.c', 'src/cpArbiter.c', 'src/cpArray.c', 'src/cpBB.c', ^ -- Eli Schwartz Arch Linux Bug Wrangler and Trusted User
--- src/functions/default.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/functions/default.c b/src/functions/default.c index 18219d5..61a4a36 100644 --- a/src/functions/default.c +++ b/src/functions/default.c @@ -87,7 +87,7 @@ func_project(struct workspace *wk, uint32_t _, uint32_t args_node, uint32_t *obj kw_version }; struct args_kw akw[] = { - [kw_default_options] = { "default_options", obj_array }, + [kw_default_options] = { "default_options", ARG_TYPE_ARRAY_OF | obj_string }, [kw_license] = { "license" }, [kw_meson_version] = { "meson_version", obj_string }, [kw_subproject_dir] = { "subproject_dir", obj_string }, @@ -324,8 +324,8 @@ func_declare_dependency(struct workspace *wk, uint32_t _, uint32_t args_node, ui kw_include_directories, }; struct args_kw akw[] = { - [kw_link_with] = { "link_with", obj_array }, - [kw_include_directories] = { "include_directories", obj_any }, + [kw_link_with] = { "link_with", ARG_TYPE_ARRAY_OF | obj_any }, + [kw_include_directories] = { "include_directories", ARG_TYPE_ARRAY_OF | obj_any }, 0 }; @@ -382,7 +382,7 @@ tgt_common(struct workspace *wk, uint32_t args_node, uint32_t *obj, enum tgt_typ struct args_kw akw[] = { [kw_sources] = { "sources", ARG_TYPE_ARRAY_OF | obj_any }, [kw_include_directories] = { "include_directories", ARG_TYPE_ARRAY_OF | obj_any }, - [kw_dependencies] = { "dependencies", obj_array }, + [kw_dependencies] = { "dependencies", ARG_TYPE_ARRAY_OF | obj_any }, [kw_install] = { "install", obj_bool }, [kw_install_dir] = { "install_dir", obj_string }, [kw_link_with] = { "link_with", ARG_TYPE_ARRAY_OF | obj_any }, @@ -391,9 +391,9 @@ tgt_common(struct workspace *wk, uint32_t args_node, uint32_t *obj, enum tgt_typ [kw_extra_files] = { "extra_files", obj_any }, // ignored [kw_target_type] = { "target_type", obj_string }, /* lang args */ - [kw_c_args] = { "c_args", obj_array }, - [kw_cpp_args] = { "cpp_args", obj_array }, - [kw_objc_args] = { "objc_args", obj_array }, + [kw_c_args] = { "c_args", ARG_TYPE_ARRAY_OF | obj_string }, + [kw_cpp_args] = { "cpp_args", ARG_TYPE_ARRAY_OF | obj_string }, + [kw_objc_args] = { "objc_args", ARG_TYPE_ARRAY_OF | obj_string }, [kw_link_args] = { "link_args", ARG_TYPE_ARRAY_OF | obj_string }, 0 }; @@ -621,7 +621,7 @@ func_subproject(struct workspace *wk, uint32_t rcvr, uint32_t args_node, uint32_ kw_default_options, }; struct args_kw akw[] = { - [kw_default_options] = { "default_options", obj_array }, + [kw_default_options] = { "default_options", ARG_TYPE_ARRAY_OF | obj_string }, 0 }; -- 2.33.0
Thank you, this looks good to me. I really appreciate you taking the time to test this on some real projects. As far as list flattening goes, I have been addressing it so far with ad-hoc application of the obj_array_foreach_flat, which iterates over the array as if it were flattened. Maybe ARG_TYPE_ARRAY_OF should imply that the array gets flattened also. We could even flatten all arrays passed as arguments, but I'm not sure about that imo.