/usr/include/cglm/simd/sse2/mat4.h:91:1: warning: unable to translate function, demoted to extern
Zig fails to translate this function (and some others) and demotes it to extern, hence the link issue. If you get this on master I believe you should report this issue. Meanwhile, as a workaround, you can wrap this function in C and export it, but this would hurt performance since it would not be inlined
The translate-c and @cImport features can only translate a subset of C designed to primarily handle constants, typedefs, and function declarations. The SIMD parts of CGLM rely on architecture specific compiler builtins for gcc, clang, etc, which won’t translate. The current way to use header only libraries is to not use them as header only, and to compile and link the implementation separately.
Is this still something that can be achieved with zig cc though? Obviously I can cmake the lib and use the .a, for now I’m just toying with stuff for myself. But if I had to distribute the project, I wouldn’t want people to have to install cmake.
>The current way to use header only libraries is to not use them as header only exe.addIncludePath(b.path("lib/stb_image/" ++ stb_image_version)); is all I do for stb_image and it works.
I tried building cglm in the buildscript, similarly to how I build glfw: