On 11/22/21 11:23 AM, 'Mark' wrote:
> It still won't build but I think from the output that I need to add
> more dependencies, this time maybe on Xft.
I took a look at the actual fltk-config program. It seems for some
strange reason you need to use both --libs and --ldflags, the latter
contains all the libs for the dependencies it needs.
I also made a terrible mistake before. You need to use .strip() on all
the outputs of run_command, to ensure that they get split on whitespace
and turned into arrays.
project('hello fltk', 'cpp', version: '0.1.0')
fltk_config = find_program('fltk-config')
fltk_include_dirs = run_command(fltk_config, '--includedir', check:
true).stdout().strip().split()
fltk_cxxflags = run_command(fltk_config, '--cxxflags', check:
true).stdout().strip().split()
fltk_link_args = run_command(fltk_config, '--ldflags', '--libs', check:
true).stdout().strip().split()
fltk_dep = declare_dependency(compile_args: fltk_cxxflags,
include_directories: fltk_include_dirs,
link_args: fltk_link_args)
cc = meson.get_compiler('cpp')
executable('hellofltk', 'hello.cpp', dependencies: [fltk_dep])
Again, if they just provided pkg-config files upstream then you wouldn't
need to struggle with this, it would just be:
fltk_dep = dependency('fltk')
and it would correctly figure out include directories, libs,
dependencies, everything all for you. Instead they have a non-standard
shell script which is confusing to use, and likely doesn't handle
cross-compiling correctly.
--
Eli Schwartz