bazelbuild / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazelbuild.github.io/rules_foreign_cc
Apache License 2.0
649 stars 232 forks source link

Meson lacks support for cross compilation #1222

Open allsey87 opened 1 week ago

allsey87 commented 1 week ago

Meson support was merged in #986, but appears to not have support for cross compilation. I am concluding this from a use case where I am trying to cross compile using the Emscripten compiler. For this to work, a cross file should be provided to meson setup, however there is no logic for passing cross file as can be seen here:

https://github.com/bazelbuild/rules_foreign_cc/blob/9d5727d5e51bf1be8423dff7996bdb4d847b47e6/foreign_cc/meson.bzl#L113-L119

I think this should be solved by generating a cross file for Meson mirroring what is done for the CMake toolchain file here:

https://github.com/bazelbuild/rules_foreign_cc/blob/9d5727d5e51bf1be8423dff7996bdb4d847b47e6/foreign_cc/private/cmake_script.bzl#L197-L230

What do you think @jheaff1, @jsharpe, and @edison-moreland?

jsharpe commented 1 week ago

Very happy to accept a PR that adds support for cross-compilation for meson.

allsey87 commented 1 week ago

If we can move quickly, I can look into that but let's start with #1223