xkbcommon / libxkbcommon

keymap handling library for toolkits and window systems
https://xkbcommon.org
Other
278 stars 124 forks source link

crosscompile xkbcommon on linux for windows (2/2) #306

Open awarnke opened 1 year ago

awarnke commented 1 year ago

Hello,

crosscompiling xkbcommon on linux (OpenSuse 15.4) for windows works, when applying some changes:

1) For the #ifdef _MSC_VER issue, see https://github.com/xkbcommon/libxkbcommon/issues/305

2) There is another issue with the tests:

Even if I could compile these, they would not run on the build-host (linux) since the target-system is windows.

If I remove the lines 525 up to the line # Documentation from the meson.build. i can compile and install the lib. So: I removed the test cases.

It would be nice, if i could simply turn these off by a meson switch.?

PS: Some infos on setting up cross-compile of libxkbcommon for win are documented here: https://github.com/awarnke/crystal-facet-uml/tree/master/build/win

Kind Regards Andreas

whot commented 1 year ago

It would be nice, if i could simply turn these off by a meson switch.?

I reckon we'll eventually end up with enable-tests and run-tests meson options :) Because that happens with all other projects that have this requirement - on some systems building the tests isn't needed/wanted (usually on constrained systems) and on others building is wanted but running them isn't.

Do feel free to submit a PR though :)

awarnke commented 1 year ago

Thank you for the invitation to state a PR. Right now I have the feeling of having already too many projects. Lets see if I find the time …

bluetech commented 1 year ago

Hmm is the tests don't build when cross-compiling then that should be fixed I think? Compiling tests is no different from compiling the lib.

What are the errors compiling the tests?

they would not run on the build-host (linux) since the target-system is windows.

This is the reality in every cross-compiling scenario. The solution is to just not run the tests :) Or am I missing something?

awarnke commented 1 year ago

;-) The point is that there is no switch to turn the test off. (Half a year ago) Or I have not found it.

I had to change the meson.build script for that. Which is fine unless I intend to regularly pull updates and have to update the build scrip every time.

Andreas

awarnke commented 1 year ago

Example from other libraries:

meson setup . builddir --cross-file ../../cross_file.txt -Dprefix=${PREFIX} \
-Dwin32-backend=true -Dx11-backend=false -Dwayland-backend=false

see https://github.com/awarnke/crystal-facet-uml/blob/master/build/win/3rd_party/5_compile_graphics_libraries.sh#L142