[vlc-commits] [Git][videolan/vlc][master] 5 commits: meson_options: add vlc build option

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jan 14 14:20:57 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b2810412 by Johannes Kauffmann at 2023-01-14T14:03:40+00:00
meson_options: add vlc build option

- - - - -
f81f7cc5 by Johannes Kauffmann at 2023-01-14T14:03:40+00:00
meson: disable binaries if vlc isn't build

Plugin cache gen still needs to be done here.

- - - - -
9d3082c6 by Johannes Kauffmann at 2023-01-14T14:03:40+00:00
meson_options: add winstore_app build option

- - - - -
a01c567b by Johannes Kauffmann at 2023-01-14T14:03:40+00:00
meson: add initial winstore support

This patch tries to replicate configure.ac (at the time of writing)
from line 407 - 438, except the strict aliasing check. Libraries such as
ole32 are linked by default by meson, so those have been omitted.
Another difference: the check has been moved out of the mingw check.

This is not meant to be functional just yet, but having the winstore
option gives a starting point for further support.

- - - - -
b83c84e1 by Johannes Kauffmann at 2023-01-14T14:03:40+00:00
meson: correct (winstore) libvlccore srcs and libs

Add the correct libvlccore sources for winstore and non-winstore builds.

Following 53219ebda136abd39c1d5f7975308ae066053ece, link the correct
libraries. Omit libraries which are already linked by meson.

- - - - -


5 changed files:

- bin/meson.build
- config.h.meson
- meson.build
- meson_options.txt
- src/meson.build


Changes:

=====================================
bin/meson.build
=====================================
@@ -1,35 +1,40 @@
-vlc_sources = []
+# Do we build the main VLC binary?
+build_vlc = get_option('vlc')
 
-vlc_deps = [m_lib, dl_lib, threads_dep]
+if build_vlc
+    vlc_sources = []
 
-if host_system == 'darwin'
-    vlc_sources += ['darwinvlc.m']
-    vlc_deps += corefoundation_dep
-    vlc_deps += dependency('Cocoa', required: true)
-elif host_system == 'windows'
-    vlc_sources += ['winvlc.c']
-else
-    vlc_sources += ['vlc.c', 'override.c']
-endif
+    vlc_deps = [m_lib, dl_lib, threads_dep]
+
+    if host_system == 'darwin'
+        vlc_sources += ['darwinvlc.m']
+        vlc_deps += corefoundation_dep
+        vlc_deps += dependency('Cocoa', required: true)
+    elif host_system == 'windows'
+        vlc_sources += ['winvlc.c']
+    else
+        vlc_sources += ['vlc.c', 'override.c']
+    endif
 
-executable('vlc',
-    vlc_sources,
-    link_with: [libvlc],
-    include_directories: [vlc_include_dirs],
-    dependencies: vlc_deps,
-    install: true,
-    win_subsystem: 'windows'
-)
+    executable('vlc',
+        vlc_sources,
+        link_with: [libvlc],
+        include_directories: [vlc_include_dirs],
+        dependencies: vlc_deps,
+        install: true,
+        win_subsystem: 'windows'
+    )
 
-vlc_top_builddir_def = '-DTOP_BUILDDIR="@0@"'.format(vlc_build_root)
-vlc_top_srcdir_def = '-DTOP_SRCDIR="@0@"'.format(vlc_src_root)
+    vlc_top_builddir_def = '-DTOP_BUILDDIR="@0@"'.format(vlc_build_root)
+    vlc_top_srcdir_def = '-DTOP_SRCDIR="@0@"'.format(vlc_src_root)
 
-executable('vlc-static',
-    vlc_sources,
-    link_with: [libvlc],
-    include_directories: [vlc_include_dirs],
-    dependencies: vlc_deps,
-    c_args: [vlc_top_builddir_def, vlc_top_srcdir_def],
-    objc_args: [vlc_top_builddir_def, vlc_top_srcdir_def],
-    win_subsystem: 'windows'
-)
+    executable('vlc-static',
+        vlc_sources,
+        link_with: [libvlc],
+        include_directories: [vlc_include_dirs],
+        dependencies: vlc_deps,
+        c_args: [vlc_top_builddir_def, vlc_top_srcdir_def],
+        objc_args: [vlc_top_builddir_def, vlc_top_srcdir_def],
+        win_subsystem: 'windows'
+    )
+endif


=====================================
config.h.meson
=====================================
@@ -604,8 +604,8 @@
 /* host which ran configure */
 #mesondefine VLC_COMPILE_HOST
 
-/* TODO: Define to 1 if you want to build for Windows Store apps */
-#undef VLC_WINSTORE_APP
+/* Define to 1 if building for Windows Store. */
+#mesondefine VLC_WINSTORE_APP
 
 /* Define to 1 if build machine is big endian */
 #mesondefine WORDS_BIGENDIAN


=====================================
meson.build
=====================================
@@ -277,6 +277,8 @@ endif
 #
 
 have_mingw = false
+have_win_desktop = false
+have_win_store = false
 mingw_libs = []
 
 if host_system == 'windows'
@@ -363,6 +365,9 @@ windows_version_test = '''
             mingw_libs += mingwex_lib
         endif
 
+        # TODO: enable when meson 0.63 is required
+        # add_project_dependencies(mingw_libs, language: ['c', 'cpp'])
+
         # Check for fnative-struct or mms-bitfields support for MinGW
         if cc.has_argument('-mms-bitfields')
             add_project_arguments('-mms-bitfields',
@@ -384,6 +389,18 @@ windows_version_test = '''
             language: ['c', 'cpp'])
     endif
 
+    # Check if we are building for Windows Store
+    if get_option('winstore_app')
+        have_win_store = true
+        cdata.set('VLC_WINSTORE_APP', 1)
+        add_project_arguments('-DWINSTORECOMPAT', language: ['c', 'cpp'])
+        windowsappcompat_lib = cc.find_library('windowsappcompat')
+        # TODO: enable when meson 0.63 is required
+        # add_project_dependencies(windowsappcompat_lib, language: ['c', 'cpp'])
+    else
+        have_win_desktop = true
+    endif
+
 endif
 
 if cc.has_argument('-Werror-implicit-function-declaration')
@@ -573,6 +590,10 @@ endif
 
 libcompat_sources = []
 
+if have_win_store
+    libcompat_sources += 'gai_strerror.c'
+endif
+
 # Check all functions in libcompat_functions array
 foreach f : libcompat_functions
     if cc.has_function(f[0], prefix : vlc_conf_prefix + f[1], dependencies: [rt_lib, socket_libs])


=====================================
meson_options.txt
=====================================
@@ -1,5 +1,10 @@
 # General options
 
+option('vlc',
+    type : 'boolean',
+    value : 'true',
+    description : 'Build the VLC executable program.')
+
 option('nls',
     type : 'feature',
     value : 'auto',
@@ -35,6 +40,11 @@ option('run_as_root',
     value : false,
     description : 'Allow running VLC as root')
 
+option('winstore_app',
+    type : 'boolean',
+    value : 'false',
+    description : 'Build targeted for Windows Store apps')
+
 # TODO: Missing pdb option, this should probably be solved in meson itself
 
 # TODO: Missing ssp option
@@ -44,7 +54,6 @@ option('run_as_root',
 # TODO: Missing sve option
 # TODO: Missing branch_protection option
 # TODO: Missing altivec option
-# TODO: Missing vlc option
 # TODO: Missing update-check option
 
 # Font options


=====================================
src/meson.build
=====================================
@@ -52,8 +52,12 @@ min_windows_version_test = '''
 '''
 
     libvlccore_deps += cc.find_library('bcrypt')
-    libvlccore_deps += cc.find_library('winmm')
     libvlccore_deps += cc.find_library('normaliz')
+    if not have_win_store
+        libvlccore_deps += cc.find_library('winmm')
+    else
+        libvlccore_deps += cc.find_library('runtimeobject')
+    endif
     if cc.compiles(min_windows_version_test.format('_WIN32_WINNT_WIN8'), name: 'Compiling for Win8+')
         libvlccore_deps += cc.find_library('synchronization')
     endif
@@ -310,7 +314,6 @@ if host_system == 'darwin'
     libvlccore_link_args += '-Wl,-U,_vlc_static_modules'
 elif host_system == 'windows'
     libvlccore_sources += [
-        'win32/dirs.c',
         'win32/error.c',
         'win32/filesystem.c',
         'win32/netconf.c',
@@ -318,9 +321,20 @@ elif host_system == 'windows'
         'win32/rand.c',
         'win32/specific.c',
         'win32/thread.c',
-
-        'win32/timer.c' # TODO: this is non-winstore
     ]
+
+    if have_win_store
+        libvlccore_sources += [
+            'posix/timer.c',
+            'win32/dirs-uap.c',
+        ]
+    else
+        libvlccore_sources += [
+            'win32/timer.c',
+            'win32/dirs.c',
+            'win32/spawn.c',
+        ]
+    endif
 elif host_system == 'linux'
     libvlccore_sources += [
         'posix/dirs.c',



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2bb31fd7c75c6dfa70815a478ceb9b2f3cb63f5b...b83c84e1fe9ab367f262aa0308934725b0b668fe

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2bb31fd7c75c6dfa70815a478ceb9b2f3cb63f5b...b83c84e1fe9ab367f262aa0308934725b0b668fe
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