Open robbert-vdh opened 3 years ago
As far as I know, CMake does not have the equivalent of the meson native system. So a CMake project is either completely cross, or completely native.
Do you want to compile the entire subproject as native?
I would want to have the subproject both as native and as non-native in the same meson.build file, so having both a vst3_sdk_native
and a vst3_sdk_cross
in that example meson.build I posted above would be perfect. I'm building an application that consists of both a native library and a cross compiled binary that both share most of the same dependencies.
This should be fairly easy to implement with the cmake.subproject_options()
to specifically set the native
kwarg for all/some targets.
Assuming the project itself does not specify platform-specific defines/compiler options that mess up the final build...
Ouch yeah side effects like that sound like it could make having both a native and a non-native copy of the same CMake subproject a bit tricky. I didn't want to reinvent the wheel so I tried making it work with the CMake module first, but I'll just write my own meson.build file for the subproject for the time being. Cross-builds are always a bit tricky, so I'm interested to see how if a good solution to this issue is possible!
I came to the conclusion that using native library dependencies from subprojects also doesn't work when cross compiling, is this correct or am I missing something? So in a subproject (using wrap-git) I have a Meson build definition that defines a static library and declares a dependency for it. I couldn't figure out a way to use this dependency with both my native and my non-native targets. For the time being I've just resorted to exporting all of the sources, include directories and compiler options needed to build those libraries and then I just assemble the dependencies myself in my own project's meson.build file, but that of course is one giant hack.
Ya, its a know deficiency, it's on my list is things to fix, but it's non trivial
I'm not sure whether this counts as a bug or as a feature request.
Describe the bug When cross compiling (i.e. with
--cross-file
), it is not possible to useinclude('cmake').subproject('foo').dependency('bar')
in a native build target. This is possible when using regular subprojects and withdependency()
.<cmake_subproject>.dependency()
also does not support thenative
option.To Reproduce
Create a project with a
meson.build
file like this:With some arbitrary
cross.conf
file, for instance:And the following wrap file in
subprojects/vst3.wrap
(any CMake project will work, this is just how I ran into this issue):Create an empty
src/some-library.cpp
file.Now try to initialize the project with
meson setup build --cross-file cross.conf
.Expected behavior The project gets created without any errors. Running
ninja -C build
should compile the empty file without any issues.Observed behavior Meson errors out during
meson setup
with the following error:system parameters