www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Status of Meson with D

reply Remi Thebault <remi.thebault gmail.com> writes:
Hi D folks,

Over the last 2 years, significant improvements were brought to 
Meson to make it build D programs correctly and (rather) 
painlessly.
To name only a few:

  - `-makedeps` switch was merged in the compiler frontend and 
supported right away by Meson. It allows ninja to track which 
file imports which. This is simply necessary for correct 
compilation without having to clean and rebuild everything each 
time a file is edited.

  - more recently, a bug was fixed which allows to use Dub 
dependencies, including ones with complex sub-dependency schemes 
such as vibe-d. This will be available with meson-0.63 (release 
will probably occur in a few weeks).

There are many more fixes done by many people.
In general, Meson is easy to fix, and contributions get quickly 
reviewed and accepted.


Don't hesitate to try it out and to share your thoughts!

Cheers,
Rémi
May 12 2022
next sibling parent reply Andrea Fontana <nospam example.org> writes:
On Thursday, 12 May 2022 at 21:37:20 UTC, Remi Thebault wrote:

 Don't hesitate to try it out and to share your thoughts!

 Cheers,
 Rémi
Nice! That should have been posted on announce group. Is there any d-related link? Andrea
May 13 2022
parent Remi Thebault <remi.thebault gmail.com> writes:
On Friday, 13 May 2022 at 22:00:54 UTC, Andrea Fontana wrote:
 Is there any d-related link?
https://mesonbuild.com/D.html
May 15 2022
prev sibling next sibling parent reply max haughton <maxhaton gmail.com> writes:
On Thursday, 12 May 2022 at 21:37:20 UTC, Remi Thebault wrote:
 Hi D folks,

 Over the last 2 years, significant improvements were brought to 
 Meson to make it build D programs correctly and (rather) 
 painlessly.
 To name only a few:

 [...]
Could you write a little summary of this work so that we can show it off on the dlang blog?
May 15 2022
parent Remi Thebault <remi.thebault gmail.com> writes:
On Sunday, 15 May 2022 at 16:44:28 UTC, max haughton wrote:
 On Thursday, 12 May 2022 at 21:37:20 UTC, Remi Thebault wrote:
 Hi D folks,

 Over the last 2 years, significant improvements were brought 
 to Meson to make it build D programs correctly and (rather) 
 painlessly.
 To name only a few:

 [...]
Could you write a little summary of this work so that we can show it off on the dlang blog?
Support for D in Meson started in 2017. I didn't follow all progresses made since then so I can only speak about my own contributions (which started by end of 2020): - DMD and LDC `-makedeps` switch, supported right away by Meson. It allows ninja to track which file imports which. This is simply necessary for correct compilation without having to clean and rebuild everything each time a file is edited. - Fixed some glitches to pass the right arguments to the compiler - Fixed `-J` switch search path to include generated files. Allows to generate files with Meson and `import` them in the D code. Useful e.g. to generate SPIR-V files during the build and import them on the fly. - Fixed RSP (` file` switch) syntax on Windows. Allows to support long command lines, often necessary for linking. - Fixed Dub dependencies. Now Meson will correctly use the Dub libraries including those with sub-dependencies. Dub libraries must still be built by Dub for the right compiler/build type/configuration. If one is missing, Meson will correctly detect it and print the command to be run to install the missing libraries. - Support `d_module_versions` and `d_import_dirs` (for `-J` switch) in `declare_dependency`. Allows propagation of these build options to depending libraries or programs. - Support some D compiler checks during Meson configuration. Supports e.g. `meson.get_compiler('d').sizeof('void*')` to check at configure time if code is generated for 32bit or 64bit. Things work best with static libraries. Dynamic libraries do not receive much testing, and are a known caveat in D in general. Besides this and starting on version 0.63, Meson is ready to support most build scenarios for real world D programs without glitch.
May 15 2022
prev sibling next sibling parent Chris Piker <chris hoopjump.com> writes:
On Thursday, 12 May 2022 at 21:37:20 UTC, Remi Thebault wrote:
 Over the last 2 years, significant improvements were brought to 
 Meson to make it build D programs correctly and (rather) 
 painlessly.
 To name only a few:
...
  - more recently, a bug was fixed which allows to use Dub 
 dependencies, including ones with complex sub-dependency 
 schemes such as vibe-d. This will be available with meson-0.63 
 (release will probably occur in a few weeks).
Hey this handy. I've been looking for a "make install" option for vibe.d, looks like meson provides that, will check it out very soon. Thanks for posting here, I wouldn't have known about it otherwise.
May 23 2022
prev sibling parent Chris Piker <chris hoopjump.com> writes:
On Thursday, 12 May 2022 at 21:37:20 UTC, Remi Thebault wrote:
 Don't hesitate to try it out and to share your thoughts!
Hi Remi Thanks for all your work! Here's my first attempt to use meson below. It's probably obvious that I need to read more instructions. So meson itself seems to run okay, but trying to build vibe.d with gcc-12.1 which isn't working out so well. I'm pressing a lot of new things to work together below so I'm not surprised something broke. By the way, the goal is to produce a vibe-d shared-object + "headers" that I can use in an air-gapped build system for an upcoming project. Worked somewhat, but I wasn't able to build vibe.d using meson. The path taken: **Install GDC-12.1** ```bash wget http://mirrors.concertpass.com/gcc/releases/gcc-12.1.0/gcc-12.1.0.tar.xz under ``` **Install newest meson** ```bash $ git clone git github.com:mesonbuild/meson.git $ cd meson pip3 install . $ which meson /home/USER/.local/bin/meson ``` So far so good **Build vibe.d using gcc-12.1** ```bash $ git clone git github.com:vibe-d/vibe.d.git $ cd vibe.d $ export LD_RUN_PATH=/usr/local/gcc12/lib64 $ export PATH=/usr/local/gcc12/bin:$PATH $ meson setup builddir $ env DC=/usr/local/gcc12/bin/gdc-12 meson setup builddir ``` Which produces... ``` The Meson build system Version: 0.62.99 Source dir: /home/cwp/git/vibe.d Build dir: /home/cwp/git/vibe.d/builddir Build type: native build Project name: Vibe.d Project version: 0.9.5 D compiler for the host machine: /usr/local/gcc12/bin/gdc-12 (gcc 12.1.0 "gdc-12 (GCC) 12.1.0") D linker for the host machine: /usr/local/gcc12/bin/gdc-12 ld.bfd 2.34 Host machine cpu family: x86_64 Host machine cpu: x86_64 Found pkg-config: /usr/bin/pkg-config (0.29.1) Run-time dependency zlib found: YES 1.2.11 Run-time dependency libcrypto found: YES 1.1.1f Run-time dependency libssl found: YES 1.1.1f Found CMake: /usr/bin/cmake (3.22.1) WARNING: CMake Toolchain: Failed to determine CMake compilers state Run-time dependency diet found: NO (tried pkgconfig and cmake) Looking for a fallback subproject for the dependency diet Executing subproject diet diet| Project name: Diet-NG diet| Project version: 1.7.4 diet| D compiler for the host machine: /usr/local/gcc12/bin/gdc-12 (gcc 12.1.0 "gdc-12 (GCC) 12.1.0") diet| D linker for the host machine: /usr/local/gcc12/bin/gdc-12 ld.bfd 2.34 lib/subprojects/diet/meson.build:55:0: ERROR: Unknown method "unittest_args" in object <[CompilerHolder] holds [GnuDCompiler]: <GnuDCompiler: v12.1.0 `/usr/local/gcc12/bin/gdc-12`>> of type CompilerHolder. ``` I've never used meson before, so the actions above are likely *very* naive.
May 24 2022