MSVC: Define _USE_MATH_DEFINES via meson.build

This way M_PI and other constants are available everywhere.
The constants are behind a preprocessor macro because they
aren't part of standard C.
This commit is contained in:
Luca Bacci 2026-03-27 10:34:33 +01:00
parent 1ec2a448e9
commit c988a8e36e
5 changed files with 2 additions and 9 deletions

View file

@ -102,6 +102,7 @@ if cc.get_id() == 'msvc'
language : ['c', 'cpp'])
add_project_arguments(['-D_CRT_SECURE_NO_WARNINGS',
'-D_CRT_NONSTDC_NO_WARNINGS',
'-D_USE_MATH_DEFINES',
], language : ['c', 'cpp'])
endif

View file

@ -24,7 +24,7 @@
*/
#include "cairo-perf.h"
#define _USE_MATH_DEFINES /* for M_SQRT2 on win32 */
#include <math.h>
static void

View file

@ -55,9 +55,6 @@
#include <stdarg.h>
#include <stddef.h>
#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include <limits.h>
#include <stdio.h>

View file

@ -55,7 +55,6 @@ typedef unsigned __int64 uint64_t;
#endif
#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#include <float.h>
#endif

View file

@ -46,10 +46,6 @@
#include <stdlib.h> /* mkstemp */
#include <string.h>
#ifdef _MSC_VER
#define _USE_MATH_DEFINES /* for M_LN2, M_PI and M_SQRT2 on win32 */
#endif
#include <math.h>
#include <limits.h> /* INT_MAX */
#include <assert.h>