summaryrefslogtreecommitdiff
path: root/lib/os.h
diff options
context:
space:
mode:
authorRalph Giles <giles@thaumas.net>2021-05-09 11:31:21 -0700
committerRalph Giles <giles@thaumas.net>2021-05-09 11:45:06 -0700
commitc7b63a76a28c8700c76b04143b200d33a110b22d (patch)
tree76219ab6a36bf2ed7ca782badee14705e7eeb009 /lib/os.h
parent4e1155cc77a2c672f3dd18f9a32dbf1404693289 (diff)
downloadlibvorbis-git-c7b63a76a28c8700c76b04143b200d33a110b22d.tar.gz
Set _USE_MATH_DEFINES for MSVC builds.math_defines
Add this define to lib/os.h and test/util.c so M_PI is available when building with Microsoft's math.h. On other systems, it's typically enabled by default, e.g. through __USE_XOPEN or __USE_GNU. We already had a fallback definition of M_PI in os.h which was used by the core library, but not included in the test harness, which failed to compile under CMake and MSVC. Using the system define should be more consistent. Based on a patch by Ozkan Sezer.
Diffstat (limited to 'lib/os.h')
-rw-r--r--lib/os.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/os.h b/lib/os.h
index 9ded7358..f0947dc9 100644
--- a/lib/os.h
+++ b/lib/os.h
@@ -20,6 +20,10 @@
#include "config.h"
#endif
+#ifdef _MSC_VER
+#define _USE_MATH_DEFINES
+#endif
+
#include <math.h>
#include <ogg/os_types.h>