[vlc-commits] [Git][videolan/vlc][master] 15 commits: package/win32: fix passing flags to meson

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 19 08:37:19 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c2e85398 by Steve Lhomme at 2024-10-19T08:02:09+00:00
package/win32: fix passing flags to meson

The escaping of strings doesn't work well when added in a variable as done in
fd2a8dbda8d3aa8b51b6d165da58c7b81eb290c3

- - - - -
922c4097 by Steve Lhomme at 2024-10-19T08:02:09+00:00
package/win32: use static C++ runtime with meson

This is how it's done in configure.ac as well.
We can't use and distribute a dynamic C++ runtime.

- - - - -
0ed10d6c by Steve Lhomme at 2024-10-19T08:02:09+00:00
meson: fix Windows build

modules/meson.build:159:68: ERROR: Object <[FeatureOptionHolder] holds [UserFeatureOption]: <mesonbuild.coredata.UserFeatureOption object at 0x7fb828a66a50>> of type UserFeatureOption does not support the `bool()` operator.

Regression from 47c63ce0027eb8438645edf76f8901f0a6da2d59

- - - - -
c0ad4072 by Steve Lhomme at 2024-10-19T08:02:09+00:00
d3d11: always link with d3d11.dll

meson equivalent of a8d52300164633e697b1d395c42936bd4380a55d

- - - - -
99c86c86 by Steve Lhomme at 2024-10-19T08:02:09+00:00
meson: add missing d3d11 dependency

All users of d3d11_common_lib should use it.

- - - - -
2b9fbb84 by Steve Lhomme at 2024-10-19T08:02:09+00:00
test: bits: fix printf formatting warning

We cast to the biggest signed integer size so it works in all used cases
(uint64_t is not used)

- - - - -
f7abb266 by Steve Lhomme at 2024-10-19T08:02:09+00:00
daala: fix include path corresponding to export include dir

The .pc files export include/daala so we should just include <codec.h>.

- - - - -
ed365dca by Steve Lhomme at 2024-10-19T08:02:09+00:00
package/win32: handle PDB generation with meson

meson doesn't know about cross-compiling with LLVM to get PDBs.
But we can pass the same flag forced in the configure script.

- - - - -
e324c59c by Steve Lhomme at 2024-10-19T08:02:09+00:00
package/win32: always use -gcodeview when using PDB

So it applies to autotools and meson builds.
It's currently forced in the configure script.

- - - - -
dc95d4c5 by Steve Lhomme at 2024-10-19T08:02:09+00:00
meson: fix glspectrum Windows build

It needs the glew headers from contribs.

- - - - -
2450f522 by Steve Lhomme at 2024-10-19T08:02:09+00:00
meson: don't build plugins.dat when cross compiling

Just as with autotools.

- - - - -
882ce5a3 by Steve Lhomme at 2024-10-19T08:02:09+00:00
contrib: use pkg-config for the meson pkg-config binary

"pkgconfig" is deprecated.

- - - - -
edd9b387 by Steve Lhomme at 2024-10-19T08:02:09+00:00
meson: add missing windows audio output

- - - - -
55d61600 by Steve Lhomme at 2024-10-19T08:02:09+00:00
package/win32: always export the pkg-config to use

We did the detection, we know what we should use.

- - - - -
59d62be9 by Steve Lhomme at 2024-10-19T08:02:09+00:00
package/win32: use a local crossfile.meson for the VLC build

The crossfile.meson from contribs won't be available in prebuilt contribs.

We can't use gen-meson-machinefile.py because it doesn't handle exe_wrapper".

- - - - -


11 changed files:

- bin/meson.build
- contrib/src/gen-meson-machinefile.py
- extras/package/win32/build.sh
- modules/access/screen/meson.build
- modules/audio_output/meson.build
- modules/codec/daala.c
- modules/codec/meson.build
- modules/meson.build
- modules/video_output/win32/meson.build
- modules/visualization/meson.build
- test/src/misc/bits.c


Changes:

=====================================
bin/meson.build
=====================================
@@ -52,7 +52,7 @@ if build_vlc and (host_system != 'darwin' or have_osx)
         command: [vlc_cache_gen_dep, meson.global_build_root() / 'modules'],
         # ninja command will be `ninja bin/plugins.dat`
         output: 'plugins.dat',
-        build_by_default: true,
+        build_by_default: not meson.is_cross_build(),
     )
 
 endif


=====================================
contrib/src/gen-meson-machinefile.py
=====================================
@@ -72,7 +72,7 @@ if args.type == 'internal':
     _add_environ_val('ar', 'AR')
     _add_environ_val('ranlib', 'RANLIB')
     _add_environ_val('strip', 'STRIP')
-    _add_environ_val('pkgconfig', 'PKG_CONFIG')
+    _add_environ_val('pkg-config', 'PKG_CONFIG')
     _add_environ_val('windres', 'WINDRES')
 
     # Properties section


=====================================
extras/package/win32/build.sh
=====================================
@@ -192,6 +192,11 @@ then
         chmod +x build/bin/wine
     fi
 fi
+HOST="$(cc -dumpmachine)"
+HOST_ARCH="${HOST%%-*}"
+if [ "$HOST_ARCH" = "$ARCH" ]; then
+    VLC_EXE_WRAPPER="wine"
+fi
 
 cd ../../
 
@@ -334,6 +339,8 @@ echo $PATH
 mkdir -p contrib/contrib-$SHORTARCH && cd contrib/contrib-$SHORTARCH
 if [ ! -z "$WITH_PDB" ]; then
     CONTRIBFLAGS="$CONTRIBFLAGS --enable-pdb"
+    VLC_CFLAGS="$VLC_CFLAGS -gcodeview"
+    VLC_CXXFLAGS="$VLC_CXXFLAGS -gcodeview"
     if [ ! -z "$PDB_MAP" ]; then
         VLC_CFLAGS="$VLC_CFLAGS -fdebug-prefix-map='$VLC_ROOT_PATH'='$PDB_MAP'"
         VLC_CXXFLAGS="$VLC_CXXFLAGS -fdebug-prefix-map='$VLC_ROOT_PATH'='$PDB_MAP'"
@@ -366,6 +373,8 @@ if [ -z "$PKG_CONFIG" ]; then
         else
             VLC_PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:/usr/$TRIPLET/lib/pkgconfig:/usr/lib/$TRIPLET/pkgconfig"
         fi
+    else
+        VLC_PKG_CONFIG="$TRIPLET-pkg-config"
     fi
 else
     VLC_PKG_CONFIG="$PKG_CONFIG"
@@ -426,8 +435,6 @@ else
 fi
 cd ../..
 
-MCONFIGFLAGS="$MCONFIGFLAGS -Dc_args='${VLC_CFLAGS}' -Dc_link_args='${VLC_LDFLAGS}' -Dcpp_args='${VLC_CXXFLAGS}' -Dcpp_link_args='${VLC_LDFLAGS}'"
-
 if [ "$RELEASE" != "yes" ]; then
      CONFIGFLAGS="$CONFIGFLAGS --enable-debug"
      MCONFIGFLAGS="$MCONFIGFLAGS --buildtype debugoptimized"
@@ -479,10 +486,48 @@ if [ -n "$BUILD_MESON" ]; then
     mkdir -p $SHORTARCH-meson
     rm -rf $SHORTARCH-meson/meson-private
 
+    if [ -n "$WITH_PDB" ]; then
+        VLC_LDFLAGS="$VLC_LDFLAGS -Wl,-pdb="
+    fi
+
+    # generate the crossfile.meson
+    test -e $SHORTARCH-meson/crossfile.meson && unlink $SHORTARCH-meson/crossfile.meson
+    exec 3>$SHORTARCH-meson/crossfile.meson || return $?
+
+    printf '# This file was automatically generated!\n\n' >&3
+    printf '[binaries]\n' >&3
+    printf 'c = '"'"'%s'"'"'\n' "${CC}" >&3
+    printf 'cpp = '"'"'%s'"'"'\n' "${CXX:-$TRIPLET-g++}" >&3
+    if [ -n "$VLC_AR" ]; then
+        printf 'ar = '"'"'%s'"'"'\n' "${VLC_AR}" >&3
+    fi
+    if [ -n "$VLC_RANLIB" ]; then
+        printf 'ranlib = '"'"'%s'"'"'\n' "${VLC_RANLIB}" >&3
+    fi
+    printf 'strip = '"'"'%s'"'"'\n' "${TRIPLET}-strip" >&3
+    if [ -n "$VLC_PKG_CONFIG" ]; then
+        printf 'pkg-config = '"'"'%s'"'"'\n' "${VLC_PKG_CONFIG}" >&3
+    fi
+    printf 'windres = '"'"'%s'"'"'\n' "${TRIPLET}-windres" >&3
+    if [ -n "$VLC_EXE_WRAPPER" ]; then
+        printf 'exe_wrapper = '"'"'%s'"'"'\n' "${VLC_EXE_WRAPPER}" >&3
+    fi
+
+    printf '\n[host_machine]\n' >&3
+    printf 'system = '"'"'windows'"'"'\n' >&3
+    printf 'cpu_family = '"'"'%s'"'"'\n' "${ARCH}" >&3
+    printf 'endian = '"'"'little'"'"'\n' >&3
+    printf 'cpu = '"'"'%s'"'"'\n' "${ARCH}" >&3
+
+
     info "Configuring VLC"
     BUILD_PATH="$( pwd -P )"
     cd ${VLC_ROOT_PATH}
-    meson setup ${BUILD_PATH}/$SHORTARCH-meson $MCONFIGFLAGS --cross-file ${BUILD_PATH}/contrib/contrib-$SHORTARCH/crossfile.meson --cross-file ${BUILD_PATH}/contrib/$CONTRIB_PREFIX/share/meson/cross/contrib.ini
+    meson setup ${BUILD_PATH}/$SHORTARCH-meson \
+        -Dc_args="${VLC_CFLAGS}" -Dc_link_args="${VLC_LDFLAGS}" -Dcpp_args="${VLC_CXXFLAGS}" -Dcpp_link_args="${VLC_LDFLAGS} -static-libstdc++" \
+        $MCONFIGFLAGS \
+        --cross-file ${BUILD_PATH}/$SHORTARCH-meson/crossfile.meson \
+        --cross-file ${BUILD_PATH}/contrib/$CONTRIB_PREFIX/share/meson/cross/contrib.ini
 
     info "Compiling"
     cd ${BUILD_PATH}/$SHORTARCH-meson


=====================================
modules/access/screen/meson.build
=====================================
@@ -22,7 +22,7 @@ if get_option('screen').allowed()
     if host_system == 'windows'
       screen_files += files('win32.c', 'dxgi.cpp')
       gdi32_dep = cc.find_library('gdi32')
-      screen_deps += [gdi32_dep]
+      screen_deps += [gdi32_dep, cc.find_library('d3d11')]
       screen_cppargs += libcom_cppflags
       screen_link_with += d3d11_common_lib
     else


=====================================
modules/audio_output/meson.build
=====================================
@@ -98,3 +98,26 @@ if have_osx or have_ios or have_tvos
         'objc_args' : ['-fobjc-arc']
     }
 endif
+
+if host_system == 'windows'
+vlc_modules += {
+    'name' : 'mmdevice',
+    'sources' : files('mmdevice.c'),
+    'enabled' : have_win_desktop,
+}
+
+vlc_modules += {
+    'name' : 'winstore',
+    'sources' : files('winstore.c'),
+    'enabled' : have_win_store,
+}
+
+vlc_modules += {
+    'name' : 'wasapi',
+    'sources' : files('wasapi.c'),
+    'dependencies' : [ksuser_lib],
+    'enabled' : get_option('wasapi')
+      .require(host_system == 'windows', error_message: 'WASAPI requires Windows')
+      .allowed() and ksuser_lib.found()
+}
+endif


=====================================
modules/codec/daala.c
=====================================
@@ -35,10 +35,10 @@
 #include <vlc_meta.h>
 #include "../demux/xiph.h"
 
-#include <daala/codec.h>
-#include <daala/daaladec.h>
+#include <codec.h>
+#include <daaladec.h>
 #ifdef ENABLE_SOUT
-#include <daala/daalaenc.h>
+#include <daalaenc.h>
 #endif
 
 #include <limits.h>


=====================================
modules/codec/meson.build
=====================================
@@ -632,10 +632,7 @@ if host_system == 'windows'
         install: false
     )
 
-    mft_deps = [ cc.find_library('mfplat') ]
-    if get_option('winstore_app')
-        mft_deps += [ cc.find_library('d3d11') ]
-    endif
+    mft_deps = [ cc.find_library('mfplat'), cc.find_library('d3d11') ]
     vlc_modules += {
         'name' : 'mft',
         'sources' : files(
@@ -764,14 +761,17 @@ vlc_modules += {
 # VP8/VP9 with alpha pseudo-decoder
 vpx_alpha_sources = files('vpx_alpha.c')
 vpx_alpha_with = [ ]
+vpx_alpha_deps = [ ]
 if host_system == 'windows'
     vpx_alpha_sources += files('alpha_d3d11.cpp')
     vpx_alpha_with += [ d3d11_common_lib ]
+    vpx_alpha_deps += [ cc.find_library('d3d11') ]
 endif
 vlc_modules += {
     'name' : 'vpx_alpha',
     'sources' : vpx_alpha_sources,
-    'link_with' : vpx_alpha_with
+    'link_with' : vpx_alpha_with,
+    'dependencies' : [vpx_alpha_deps],
 }
 
 # libaom AV1 codec


=====================================
modules/meson.build
=====================================
@@ -156,7 +156,7 @@ opengles_dep = frameworks['OpenGLES']
 # WASAPI-related dependency
 ksuser_lib = cc.find_library('ksuser',
                              has_headers: ['audioclient.h'],
-                             required: host_system == 'windows' and get_option('wasapi'))
+                             required: host_system == 'windows' and get_option('wasapi').enabled())
 
 # Helper libraries for modules
 # These are helper libraries used by some modules
@@ -405,7 +405,7 @@ if get_option('rust').enabled()
         '3': ['-C', 'opt-level=3'],
         's': ['-C', 'opt-level=s'],
     }
-    
+
     print_static_libs_rustc = run_command([cargo_rustc_static_libs, cargo_bin],
         check: true, capture: true)
     rust_common_link_args = print_static_libs_rustc.stdout().split()
@@ -414,7 +414,7 @@ if get_option('rust').enabled()
     # meson where array += element is not equal to array += array
     rust_flags = get_option('extra_rust_flags')
     rust_flags += rust_optimization_args[get_option('optimization')]
-    
+
     cargo_target_dir = join_paths(meson.current_build_dir(), 'cargo_target')
 
     extra_cargo_args = []


=====================================
modules/video_output/win32/meson.build
=====================================
@@ -9,10 +9,9 @@ d3d11_sources = files('direct3d11.cpp', 'd3d11_quad.cpp', 'd3d11_scaler.cpp',
 d3d11_link_with = [ d3d11_common_lib ]
 d3d11_cargs = []
 d3d11_cxxargs = [ libcom_cppflags ]
-d3d11_deps = [ cc.find_library('dxgi') ]
+d3d11_deps = [ cc.find_library('dxgi'), cc.find_library('d3d11') ]
 if get_option('winstore_app')
     d3d11_deps += [
-        cc.find_library('d3d11'),
         cc.find_library('d3dcompiler_47')
     ]
 else


=====================================
modules/visualization/meson.build
=====================================
@@ -6,6 +6,7 @@ vlc_modules += {
       'visual/window.c', 'visual/window.h',
       'visual/window_presets.h'),
     'dependencies' : [opengl_dep, m_lib],
+    'c_args' : [ contrib_inc_args ],
     'enabled' : opengl_dep.found(),
 }
 


=====================================
test/src/misc/bits.c
=====================================
@@ -26,7 +26,7 @@
     ssize_t a = (foo); \
     ssize_t b = (bar); \
     if(a != b) { \
-        printf("Failed (%s) line %d : %ld != %ld\n", psz_tag, __LINE__, a, b ); \
+        printf("Failed (%s) line %d : %" PRId64 " != %" PRId64 "\n", psz_tag, __LINE__, (int64_t)(a), (int64_t)(b) ); \
         return 1; \
     } } while( 0 )
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8d83dc7834b61ca7fe2e373f98d57a2751c5d21d...59d62be92cb0ade3a66e04d0f82f7a22ed9f3893

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8d83dc7834b61ca7fe2e373f98d57a2751c5d21d...59d62be92cb0ade3a66e04d0f82f7a22ed9f3893
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