libxkbcommon icon indicating copy to clipboard operation
libxkbcommon copied to clipboard

crosscompile xkbcommon on linux for windows (2/2)

Open awarnke opened this issue 3 years ago • 5 comments

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

awarnke avatar Oct 31 '22 05:10 awarnke

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 :)

whot avatar Nov 14 '22 04:11 whot

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 …

awarnke avatar Nov 14 '22 19:11 awarnke

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?

bluetech avatar Apr 11 '23 20:04 bluetech

;-) 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 avatar Apr 13 '23 17:04 awarnke

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

awarnke avatar Apr 14 '23 04:04 awarnke