-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meson build system #38
base: master
Are you sure you want to change the base?
Conversation
https://mesonbuild.com/ requirements: - meson 0.38 - python 3.3 (required by meson) - ninja (C++11) or samurai (C99) Note: HAVE_SSE41 is checked for but never ever defined, not even by ax_ext.m4, so I have not bothered setting it in the conf file.
Requires meson 0.47 (and thus python 3.5)
Alternative to #2 |
if false # the code uses defines, not separate files | ||
simd_mod = import('unstable-simd') | ||
libb2_simd = simd_mod.check('blake2b', | ||
sse2: 'blake2b-sse2.c', | ||
ssse3: 'blake2b-ssse3.c', | ||
sse41: 'blake2b-sse41.c', | ||
avx: 'blake2b-avx.c', | ||
# xop is not available in meson | ||
) | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://mesonbuild.com/Simd-module.html
This would have actually been fairly convenient, since meson's compiler definitions include MSVC and include SIMD mappings.
A future optimization would be to improve the meson SIMD module to also allow retrieving a list of compiler-supported isets alongside their CFLAGS, then reuse that for a completely custom implementation of library building. In order to reuse it for the native codepath, it would additionally require all-new code to teach a compiler how to test for CPU (not compiler) support. I have WIP code for this, but it would end up requiring bleeding edge versions of meson...
Is i tpossible to merge that PR and tag the new version? 🤔 |
Fairly straightforward port from autotools to meson. Should work on Linux, *BSD, Solaris, macOS and Windows. Probably works on AIX via gcc.
Detecting CPU or compiler availability of instruction sets relies on GCC or clang specific
__builtin_cpu_supports
and checking if the compiler accepts-m<iset>
, but should fall back reasonably well to unoptimized binaries on, say, MSVC -- which currently isn't supported anyway, the autotools build system is both Windows unfriendly and also hardcodes assumptions like... accepting GCC-style flags for-m<iset>
. Oh well, at least it should build. Implementing that can be left to someone who cares about Windows.Benefits:
--wrap-mode=[default|nofallback|forcefallback]
or--force-fallback-for=libb2
)This is a third of the time ./configure or make takes on the same machine. :)
Note that libb2 currently fails to ./configure properly at all, unless you run it as
bash configure --prefix /usr --enable-fat
it trips over a syntax error and disables both fat and native binaries.