Configure feature test macros in meson

Refs #2807 <https://github.com/Genymobile/scrcpy/pull/2807>

Co-authored-by: RipleyTom <RipleyTom@users.noreply.github.com>
This commit is contained in:
Romain Vimont 2021-11-20 21:24:56 +01:00
parent 226f3b2c91
commit ba547e3895
3 changed files with 10 additions and 12 deletions

View file

@ -39,16 +39,26 @@ src = [
'src/util/tick.c', 'src/util/tick.c',
] ]
conf = configuration_data()
if host_machine.system() == 'windows' if host_machine.system() == 'windows'
src += [ src += [
'src/sys/win/file.c', 'src/sys/win/file.c',
'src/sys/win/process.c', 'src/sys/win/process.c',
] ]
conf.set('_WIN32_WINNT', '0x0600')
conf.set('WINVER', '0x0600')
else else
src += [ src += [
'src/sys/unix/file.c', 'src/sys/unix/file.c',
'src/sys/unix/process.c', 'src/sys/unix/process.c',
] ]
conf.set('_POSIX_C_SOURCE', '200809L')
conf.set('_XOPEN_SOURCE', '700')
conf.set('_GNU_SOURCE', true)
if host_machine.system() == 'darwin'
conf.set('_DARWIN_C_SOURCE', true)
endif
endif endif
v4l2_support = host_machine.system() == 'linux' v4l2_support = host_machine.system() == 'linux'
@ -128,8 +138,6 @@ if host_machine.system() == 'windows'
dependencies += cc.find_library('ws2_32') dependencies += cc.find_library('ws2_32')
endif endif
conf = configuration_data()
foreach f : check_functions foreach f : check_functions
if cc.has_function(f) if cc.has_function(f)
define = 'HAVE_' + f.underscorify().to_upper() define = 'HAVE_' + f.underscorify().to_upper()

View file

@ -1,13 +1,6 @@
#ifndef COMPAT_H #ifndef COMPAT_H
#define COMPAT_H #define COMPAT_H
#define _POSIX_C_SOURCE 200809L
#define _XOPEN_SOURCE 700
#define _GNU_SOURCE
#ifdef __APPLE__
# define _DARWIN_C_SOURCE
#endif
#include "config.h" #include "config.h"
#include <libavformat/version.h> #include <libavformat/version.h>

View file

@ -1,6 +1,3 @@
// <https://devblogs.microsoft.com/oldnewthing/20111216-00/?p=8873>
#define _WIN32_WINNT 0x0600 // For extended process API
#include "util/process.h" #include "util/process.h"
#include <processthreadsapi.h> #include <processthreadsapi.h>