StringZilla icon indicating copy to clipboard operation
StringZilla copied to clipboard

CMake targets for the C shared library

Open Tafnab opened this issue 1 year ago • 3 comments

Since StringZilla depends upon AVX or AVX-512 (as the case may be), does it automatically fail-over if the processor it's running on doesn't have AVX-512?

For example, if I build on a machine with AVX-512 and run on one with AVX, will StringZilla just work, no problems?

Tafnab avatar Mar 25 '24 19:03 Tafnab

Yes, @Tafnab, that's the "Dynamic Dispatch" part. If you add c/lib.c to you build pipeline, it will include all the backends into the binary, and will then pick the best one available at run time. If you only use the headers, that won't work. We can probably improve the CMake to expose multiple targets (related to #85), but I am always afraid of refactoring CMake 😅

ashvardanian avatar Mar 25 '24 22:03 ashvardanian

@ashvardanian: I'm really interested in using it only for C++. c/lib.c looks like C++ will like it also. So what you're saying is that, in my C++ program (main somewhere), I should include this file, as well as the headers.

Tafnab avatar Mar 26 '24 21:03 Tafnab

Yes @Tafnab, that would be the way to do it, until I merge #85 and #136 - which may take a few weeks - refactoring CMake is a nightmare 😭

ashvardanian avatar Apr 17 '24 20:04 ashvardanian