meson: adjust win32 defines

- Don't define _GNU_SOURCE on Windows, no need
- Define WIN32_LEAN_AND_MEAN to strip some unneded headers from
  windows.h
- Define NOMINMAX and _USE_MATH_DEFINES as they are common for Windows
  headers
This commit is contained in:
Kacper Michajłow 2023-11-24 07:19:19 +01:00 committed by sfan5
parent dff48031a1
commit ed107c4116
5 changed files with 12 additions and 3 deletions

View File

@ -21,6 +21,7 @@
#include <wchar.h>
#include <windows.h>
#include <errors.h>
#include <mmsystem.h>
#include <ksguid.h>
#include <ksmedia.h>
#include <avrt.h>

View File

@ -260,7 +260,7 @@ sources = files(
# compiler stuff
cc = meson.get_compiler('c')
flags = ['-D_GNU_SOURCE', '-D_FILE_OFFSET_BITS=64']
flags = ['-D_FILE_OFFSET_BITS=64']
link_flags = []
test_flags = ['-Werror=implicit-function-declaration',
@ -304,8 +304,9 @@ features += {'darwin': darwin}
features += {'posix': posix}
features += {'dos-paths': win32, 'win32': win32}
mswin_flags = ['-D_WIN32_WINNT=0x0602', '-DUNICODE', '-DCOBJMACROS',
'-DINITGUID', '-U__STRICT_ANSI__']
mswin_flags = ['-D_WIN32_WINNT=0x0602', '-DWINVER=0x0602', '-DUNICODE',
'-DCOBJMACROS', '-DINITGUID', '-U__STRICT_ANSI__', '-DNOMINMAX',
'-D_USE_MATH_DEFINES', '-DWIN32_LEAN_AND_MEAN']
if host_machine.system() == 'windows'
flags += [mswin_flags]
@ -315,6 +316,10 @@ if host_machine.system() == 'cygwin'
flags += [mswin_flags, '-mwin32']
endif
if posix
flags += ['-D_GNU_SOURCE']
endif
noexecstack = false
if cc.has_link_argument('-Wl,-z,noexecstack')
link_flags += '-Wl,-z,noexecstack'

View File

@ -1,4 +1,5 @@
#include <windows.h>
#include <shellapi.h>
#ifndef BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE
#define BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE (0x0001)

View File

@ -50,6 +50,7 @@
#ifdef _WIN32
#include <windows.h>
#include <winioctl.h>
#include <winternl.h>
#include <io.h>

View File

@ -18,6 +18,7 @@
#include <windows.h>
#include <ole2.h>
#include <shellapi.h>
#include <shobjidl.h>
#include "common/msg.h"