[Mesa-dev] [PATCH] docs: add documentation for building with meson
Nicolai Hähnle
nhaehnle at gmail.com
Tue Oct 17 20:40:00 UTC 2017
On 17.10.2017 22:33, Dylan Baker wrote:
> Quoting Nicolai Hähnle (2017-10-17 13:05:12)
>> On 17.10.2017 21:21, Dylan Baker wrote:
>>> +<dt><code>CC, CFLAGS, CXX, CXXFLAGS</code></dt>
>>> +<dd><p>These environment variables
>>> +control the C and C++ compilers used during the build. The default compilers
>>> +depends on your operating system. Meson supports GCC, Clang, and MSVC as first
>>> +class compilers. There is some support for the Intel ICC compiler. No other
>>> +C/C++ compilers are currently supported.
>>> +</dd>
>>> +
>>> +<dt><code>PKG_CONFIG_PATH</code></dt>
>>> +<dd><p>The
>>> +<code>pkg-config</code> utility is a hard requirement for configuring and
>>> +building mesa. It is used to search for external libraries
>>> +on the system. This environment variable is used to control the search
>>> +path for <code>pkg-config</code>. For instance, setting
>>> +<code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig</code> will search for
>>> +package metadata in <code>/usr/X11R6</code> before the standard
>>> +directories.</p>
>>> +</dd>
>>> +</dl>
>>
>> Not knowing Meson, how do environment variables like CFLAGS, CC, etc.
>> work? Are they "latched" when calling `meson $builddir`? When calling
>> `meson configure`? Both? Does setting them have an effect when calling
>> `ninja`?
>
> I'll update this document as well, but for your edification: they are "latched"
> by meson and stored in it's configuration information, they can be overwritten
> when meson is initialized or re-initialized. That means that passing them to
> "meson configure" won't change anything, since meson configure just touches
> stored variables, but doesn't re-initialize. Passing them to ninja will only do
> something if ninja decides that it needs to re-initialize, say if you touch a
> meson.build file.
Thanks!
> examples:
> CC=clang CXX=clang++ meson build-clang
> CC=notacompiler CXX=notacompiler ninja -C build
> will result in building with clang/clang++
>
> touch meson.build
> CC=notacompiler CXX=notacompiler ninja -C build
> nothing works, since ninja will re-initialize meson and it will read the
> environment and set the compiler to notacompiler and fail.
:(
Presumably at least it doesn't break if CC and CXX are unset? In the
sense that the old values are kept?
Cheers,
Nicolai
>
> I'll also add this to the documentation, but meson remembers options, and meson
> configure only changes options that you supply so:
> meson build --prefix=/tmp
> meson configure build -Ddri-drivers=i965
> will not reset the prefix.
>
> Dylan
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list