Skip to content

Commit

Permalink
Configure feature test macros in meson
Browse files Browse the repository at this point in the history
Refs #2807 <#2807>

Co-authored-by: RipleyTom <[email protected]>
  • Loading branch information
rom1v and RipleyTom committed Nov 20, 2021
1 parent 226f3b2 commit ba547e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
12 changes: 10 additions & 2 deletions app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,26 @@ src = [
'src/util/tick.c',
]

conf = configuration_data()

if host_machine.system() == 'windows'
src += [
'src/sys/win/file.c',
'src/sys/win/process.c',
]
conf.set('_WIN32_WINNT', '0x0600')
conf.set('WINVER', '0x0600')
else
src += [
'src/sys/unix/file.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

v4l2_support = host_machine.system() == 'linux'
Expand Down Expand Up @@ -128,8 +138,6 @@ if host_machine.system() == 'windows'
dependencies += cc.find_library('ws2_32')
endif

conf = configuration_data()

foreach f : check_functions
if cc.has_function(f)
define = 'HAVE_' + f.underscorify().to_upper()
Expand Down
7 changes: 0 additions & 7 deletions app/src/compat.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#ifndef 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 <libavformat/version.h>
Expand Down
3 changes: 0 additions & 3 deletions app/src/sys/win/process.c
Original file line number Diff line number Diff line change
@@ -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 <processthreadsapi.h>
Expand Down

0 comments on commit ba547e3

Please sign in to comment.