From f86af7237f63b8d489c0df45dc0174c83780dc05 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 7 Dec 2021 10:14:30 +0200 Subject: [PATCH] stbi: add a link_to_libm.c.v helper, to ensure `import stbi` works always. --- vlib/stbi/link_to_libm.c.v | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 vlib/stbi/link_to_libm.c.v diff --git a/vlib/stbi/link_to_libm.c.v b/vlib/stbi/link_to_libm.c.v new file mode 100644 index 0000000000..6af2b692a7 --- /dev/null +++ b/vlib/stbi/link_to_libm.c.v @@ -0,0 +1,21 @@ +// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved. +// Use of this source code is governed by an MIT license +// that can be found in the LICENSE file. +module stbi + +// NB: stbi uses math.h because of `ldexp` and `pow`, for which we *do* have +// pure V implementations, but our `math` module still depends on libm +// because of 'powf', 'cosf', 'sinf', 'sqrtf' and 'tanf'. + +// TODO: remove this file, when we have pure V implementations for the above +// functions too, and so `math` is no longer dependent on `libm` at all. + +#include + +$if windows { + $if tinyc { + #flag @VEXEROOT/thirdparty/tcc/lib/openlibm.o + } +} $else { + #flag -lm +}