How to create meson.build with external libs?

p.shkadzko p.shkadzko at gmail.com
Sun Jan 12 22:00:33 UTC 2020


Ok, I am trying to meson and is struggling with meson.build file. 
I looked up the examples page: 
https://github.com/mesonbuild/meson/tree/master/test%20cases/d 
which has a lot of examples but not the one that shows you how to 
build your project with some external dependency :)

Let's say we have a simple dir "myproj" with "meson.build" in it 
and some source files like "app.d" and "helper_functions.d".

~/myproj
    app.d
    helper_functions.d
    meson.build

"helper_functions.d" uses let's say lubeck library which 
according to 
https://forum.dlang.org/thread/nghoprwkihazjikyhshz@forum.dlang.org is supported by meson.

Here is my meson.build:
-----------------------
project('demo', 'd',
   version : '0.1',
   default_options : ['warning_level=3']
   )

lubeck = dependency('lubeck', version: '>=1.1.7')
ed = executable('mir_quickstart', 'app.d', dependencies: lubeck, 
install : true)


However, when I try to build it I get the following error:
-----
$ meson build
The Meson build system
Version: 0.52.1
Source dir: /home/user/dev/github/demo
Build dir: /home/user/dev/github/demo/build
Build type: native build
Project name: demo
Project version: 0.1
D compiler for the host machine: ldc2 (llvm 1.18.0 "LDC - the 
LLVM D compiler (1.18.0):")
D linker for the host machine: GNU ld.gold 2.33.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (1.6.3)
Found CMake: /usr/bin/cmake (3.16.2)
Run-time dependency lubeck found: NO (tried pkgconfig and cmake)

meson.build:8:0: ERROR: Dependency "lubeck" not found, tried 
pkgconfig and cmake

A full log can be found at 
/home/user/dev/github/demo/build/meson-l
-----

What do I need to do in order to build the project with "lubeck" 
dependency in meson?


More information about the Digitalmars-d-learn mailing list