[vlc-commits] [Git][videolan/vlc][master] contrib: pass compiler flags to Meson via the command line

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Sep 29 08:46:54 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6e912b40 by Steve Lhomme at 2022-09-29T07:23:26+00:00
contrib: pass compiler flags to Meson via the command line

Rather than the cross file which generates warnings. It also allows to override
each flag per target.

- - - - -


2 changed files:

- contrib/src/gen-meson-crossfile.py
- contrib/src/main.mak


Changes:

=====================================
contrib/src/gen-meson-crossfile.py
=====================================
@@ -43,15 +43,6 @@ _add_environ_val('windres', 'WINDRES')
 args.file.write("\n[properties]\n")
 args.file.write("needs_exe_wrapper = true\n")
 _add_environ_val('pkg_config_libdir', 'PKG_CONFIG_LIBDIR')
-_add_environ_arr('c_args', 'CFLAGS')
-_add_environ_arr('c_link_args', 'LDFLAGS')
-_add_environ_arr('cpp_args', 'CXXFLAGS')
-_add_environ_arr('cpp_link_args', 'LDFLAGS')
-if os.environ.get('HOST_SYSTEM') == 'darwin':
-    _add_environ_val('objc_args', 'CFLAGS')
-    _add_environ_val('objcpp_args', 'CXXFLAGS')
-    _add_environ_val('objc_link_args', 'LDFLAGS')
-    _add_environ_arr('objcpp_link_args', 'LDFLAGS')
 
 # Host machine section
 args.file.write("\n[host_machine]\n")


=====================================
contrib/src/main.mak
=====================================
@@ -332,11 +332,7 @@ HOSTTOOLS := \
 	PATH="$(PREFIX)/bin:$(PATH)" \
 	PKG_CONFIG="$(PKG_CONFIG)"
 
-HOSTVARS_MESON := $(HOSTTOOLS) \
-	CPPFLAGS="$(CPPFLAGS)" \
-	CFLAGS="$(CFLAGS)" \
-	CXXFLAGS="$(CXXFLAGS)" \
-	LDFLAGS="$(LDFLAGS)"
+HOSTVARS_MESON := $(HOSTTOOLS)
 
 # Add these flags after Meson consumed the CFLAGS/CXXFLAGS
 # as when setting those for Meson, it would apply to tests
@@ -486,6 +482,10 @@ endif
 ifdef HAVE_BITCODE_ENABLED
 MESONFLAGS += -Db_bitcode=true
 endif
+MESONFLAGS += -Dc_args="$(CFLAGS)" -Dc_link_args="$(LDFLAGS)" -Dcpp_args="$(CXXFLAGS)" -Dcpp_link_args="$(LDFLAGS)"
+ifdef HAVE_DARWIN_OS
+MESONFLAGS += -Dobjc_args="$(CFLAGS)" -Dobjc_link_args="$(LDFLAGS)" -Dobjcpp_args="$(CXXFLAGS)" -Dobjcpp_link_args="$(LDFLAGS)"
+endif
 
 ifdef HAVE_CROSS_COMPILE
 # When cross-compiling meson uses the env vars like



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e912b40384f4be0bd5ce7632d2034fb4c03e23b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e912b40384f4be0bd5ce7632d2034fb4c03e23b
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