Skip to content

Instantly share code, notes, and snippets.

@liangqi
Created April 24, 2026 17:40
Show Gist options
  • Select an option

  • Save liangqi/3276be964fa394d5daaf2f2ead7737de to your computer and use it in GitHub Desktop.

Select an option

Save liangqi/3276be964fa394d5daaf2f2ead7737de to your computer and use it in GitHub Desktop.
AI coding - test project - python3 convert meson to cmake
Create a python 3 project to convert meson project to cmake.
* using lexer and parser approach.
Reference:
* meson project: https://github.com/mesonbuild/meson/
* cmake2meson script: https://github.com/mesonbuild/meson/blob/master/tools/cmake2meson.py
Example meson projects:
* https://gitlab.freedesktop.org/wayland/wayland
* https://gitlab.freedesktop.org/fontconfig/fontconfig.git
You can clone them and test locally.
Hints for wayland project:
* Create config.h.cmake.in file, and use configure_file(), and use it to convert configuration_data(), the config_h in wayland project.
* For meson compiler_flags(), cmake can use target_compile_options().
* For meson cc_args, cmake can use add_compile_options().
* For include check in meson, for 'sys/prctl.h', 'sys/procctl.h', 'sys/ucred.h', cmake can use check_include_file()
* For function check in meson, for 'accept4', 'mkostemp', 'posix_fallocate', 'prctl', 'memfd_create', 'mremap', 'strndup', cmake can use check_function_exists()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment