shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
674 stars 134 forks source link

Build and Test with MSVC in GHA #588

Open blapie opened 1 month ago

blapie commented 1 month ago

Why a new feature? Is your feature request related to a problem? Please describe it.

We currently support Msys2 environment and build with clang. A recent PR claims to fix compilation with MSVC, can we now test that in CI?

What feature would you like?

Extend existing msys2 workflow to compile with MSVC.

How would you like this feature to be implemented?

I don't think this can be done by adding a new sys value here. Instead we might simply need to correctly set CC, CXX and the linker. It might just be a case of setting up MSVC on top of msys2 (whatever flavor or it), in a way similar to that discussed in this thread. Example here.

Can you please confirm @Andarwinux how we could best approach that and if you recommend any action that could help in the process?

How portable is the feature across architectures and platforms?

This is for Windows on x86 only for now, but could probably be extended to Windows on Arm in the future

Andarwinux commented 1 month ago

Combining MSVC and MSYS2 is only an extreme case, i.e. projects that can't get rid of Autotools/GNU Make but need MSVC support, whereas sleef is based on CMake, so there's no need to use MSYS2. Building sleef shouldn't be difficult, but the dependencies are a problem, openssl and mpfr. Fortunately, vcpkg provides some ports.

https://github.com/microsoft/vcpkg/tree/master/ports/openssl https://github.com/microsoft/vcpkg/tree/master/ports/mpfr

shibatch commented 1 month ago

MSYS is not required if you just want to build. You can build from the command prompt as usual. Please refer to the batch file included in tlfloat.

https://github.com/shibatch/tlfloat/blob/main/winbuild-msvc.bat

If you also want to do testing, we used to use a method of combining testers built with Cygwin. This method is quite tricky.

blapie commented 1 month ago

Sure, thanks both! Makes sense that there is no need to drag msys into the equation, it's just the environment I'm most familiar with, for the reasons @Andarwinux mentioned.

I will have a go at drafting a workflow to test outside msys and with MSVC.