Status of Meson with D

Remi Thebault remi.thebault at gmail.com
Sun May 15 17:55:25 UTC 2022


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.




More information about the Digitalmars-d mailing list