[vlc-commits] [Git][videolan/vlc][master] 4 commits: meson: only set _WIN32_WINNT if it's not set in the environment

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jan 13 15:00:17 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5b27a787 by Steve Lhomme at 2023-01-13T14:35:04+00:00
meson: only set _WIN32_WINNT if it's not set in the environment

The same way it's done in configure.ac

- - - - -
79f063df by Steve Lhomme at 2023-01-13T14:35:04+00:00
configure: only use sdkddkver.h to test the default _WIN32_WINNT

It's supported on all mingw-w64 versions we support. We don't need the
whole windows.h for that.

- - - - -
f30f5378 by Steve Lhomme at 2023-01-13T14:35:04+00:00
meson: add synchronization library when building for Win8+

- - - - -
1c8607bc by Steve Lhomme at 2023-01-13T14:35:04+00:00
meson: remove forcing _WIN32_IE

It's been removed in fdbf5c77b56b018e44b65512a57d3e407a5adc10

- - - - -


4 changed files:

- config.h.meson
- configure.ac
- meson.build
- src/meson.build


Changes:

=====================================
config.h.meson
=====================================
@@ -42,15 +42,8 @@
 #mesondefine UNICODE
 #mesondefine _UNICODE
 
-# ifndef _WIN32_WINNT
 /* Define for Windows 7 APIs. */
 #mesondefine _WIN32_WINNT
-# endif
-
-# ifndef _WIN32_IE
-/* Define for IE 6.0 (and shell) APIs. */
-#mesondefine _WIN32_IE
-# endif
 
 /* Extensions to ISO C89 from ISO C99. */
 #mesondefine _ISOC99_SOURCE


=====================================
configure.ac
=====================================
@@ -271,7 +271,7 @@ int foo() { return my_array[0]; }
       [[#ifdef _WIN32_WINNT
        # error _WIN32_WINNT already defined
        #else
-       # include <windows.h>
+       # include <sdkddkver.h>
        # if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0601
        #  error _WIN32_WINNT toolchain default high enough
        # endif


=====================================
meson.build
=====================================
@@ -284,9 +284,24 @@ if host_system == 'windows'
     # Defines needed for Windows
     windows_defines = [
         ['UNICODE',      1], # Define to 1 for Unicode (Wide Chars) APIs
-        ['_WIN32_WINNT', '0x0601'], # Define for Windows 7 APIs
     ]
 
+windows_version_test = '''
+#ifdef _WIN32_WINNT
+# error _WIN32_WINNT already defined
+#else
+# include <sdkddkver.h>
+# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0601
+#  error _WIN32_WINNT toolchain default high enough
+# endif
+#endif
+'''
+    if cc.compiles(windows_version_test, name: 'need _WIN32_WINNT defined to Win7')
+        windows_defines += [
+            ['_WIN32_WINNT', '0x0601'] # Define for Windows 7 APIs
+        ]
+    endif
+
     foreach d : windows_defines
         cdata.set(d.get(0), d.get(1))
         vlc_conf_prefix = vlc_conf_prefix + '#define @0@ @1@\n'.format(d.get(0), d.get(1))


=====================================
src/meson.build
=====================================
@@ -42,9 +42,21 @@ if host_system == 'darwin'
     libvlccore_deps += corefoundation_dep
     libvlccore_deps += dependency('CFNetwork', required: true)
 elif host_system == 'windows'
+min_windows_version_test = '''
+#include <sdkddkver.h>
+#if !defined(@0@)
+# error SDK too old for @0@
+#elif _WIN32_WINNT < @0@
+# error building for older version than @0@
+#endif
+'''
+
     libvlccore_deps += cc.find_library('bcrypt')
     libvlccore_deps += cc.find_library('winmm')
     libvlccore_deps += cc.find_library('normaliz')
+    if cc.compiles(min_windows_version_test.format('_WIN32_WINNT_WIN8'), name: 'Compiling for Win8+')
+        libvlccore_deps += cc.find_library('synchronization')
+    endif
     vlccore_cargs += ['-DVLC_DLL_EXPORT']
 endif
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1e98c09c3486f73538e35c856697e3699f9c68d4...1c8607bc970b2d34ec16c569b4025c9c2a5dac80

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1e98c09c3486f73538e35c856697e3699f9c68d4...1c8607bc970b2d34ec16c569b4025c9c2a5dac80
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list