mingwcross-compilingmingw32conanmeson-build

How to make meson find my windres binary?


I'm building freetype 2.13.2 (along other dependencies) using the conan package manager, in cross-compiling setting (using mingw32 on a linux host).

I get the following error message

../src/meson.build:239:11: ERROR: Could not find Windows resource compiler

As I understand, meson looks for a binary called windres whereas my binary is called x86_64-w64-mingw32-windres.

How do I tell meson (via conan) the name of my windres binary?

My conan command line is

 conan install .. -pr:b=default -pr:h=windows-cross --build=missing
$ cat ~/.conan/profiles/default
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=11
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
$ cat ~/.conan/profiles/windows-cross
[settings]
os=Windows
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=10
compiler.libcxx=libstdc++11
build_type=Release

[env]
CONAN_CMAKE_TOOLCHAIN_FILE=/home/per/mingw-w64-x86_64.cmake
CC=x86_64-w64-mingw32-gcc
CXX=x86_64-w64-mingw32-g++
AR=x86_64-w64-mingw32-ar
AS=x86_64-w64-mingw32-as
RANLIB=x86_64-w64-mingw32-ranlib
STRIP=x86_64-w64-mingw32-strip
RC=x86_64-w64-mingw32-windres
CONAN_CMAKE_GENERATOR=MinGW Makefiles
$ cat /home/per/mingw-w64-x86_64.cmake
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)

# cross compilers to use for C, C++ and Fortran
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)

# target environment on the build host system
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})

# modify default behavior of FIND_XXX() commands
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Solution

  • According to this link meson defaults to the value of environment variable WINDRES.

    So try setting WINDRES=x86_64-w64-mingw32-windres in the environment.