[v4,2/2] build: generate Windows build artefacts when needed

Message ID 20221202110945.519708-2-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v4,1/2] drivers: fix symbol exports when map is omitted |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation warning apply issues

Commit Message

David Marchand Dec. 2, 2022, 11:09 a.m. UTC
  We have been generating some Windows and mingw artefacts on all OS while
there is no need for them.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/meson.build | 27 +++++++++++++--------------
 lib/meson.build     | 29 +++++++++++++++--------------
 2 files changed, 28 insertions(+), 28 deletions(-)
  

Patch

diff --git a/drivers/meson.build b/drivers/meson.build
index 5188302057..c6d619200f 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -206,7 +206,6 @@  foreach subpath:subdirs
 
         # now build the shared driver
         version_map = '@0@/@1@/version.map'.format(meson.current_source_dir(), drv_path)
-        implib = 'lib' + lib_name + '.dll.a'
 
         lk_deps = []
         lk_args = []
@@ -227,25 +226,25 @@  foreach subpath:subdirs
             endif
         endif
 
-        def_file = custom_target(lib_name + '_def',
-                command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
-                input: version_map,
-                output: '@0@_exports.def'.format(lib_name))
-
-        mingw_map = custom_target(lib_name + '_mingw',
-                command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
-                input: version_map,
-                output: '@0@_mingw.map'.format(lib_name))
-
-        lk_deps += [def_file, mingw_map]
-
         if is_windows
             if is_ms_linker
+                def_file = custom_target(lib_name + '_def',
+                        command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+                        input: version_map,
+                        output: '@0@_exports.def'.format(lib_name))
+                lk_deps += [def_file]
+
                 lk_args = ['-Wl,/def:' + def_file.full_path()]
                 if meson.version().version_compare('<0.54.0')
-                    lk_args += ['-Wl,/implib:drivers\\' + implib]
+                    lk_args += ['-Wl,/implib:drivers\\lib' + lib_name + '.dll.a']
                 endif
             else
+                mingw_map = custom_target(lib_name + '_mingw',
+                        command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+                        input: version_map,
+                        output: '@0@_mingw.map'.format(lib_name))
+                lk_deps += [mingw_map]
+
                 lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
             endif
         else
diff --git a/lib/meson.build b/lib/meson.build
index fd55925340..a90fee31b7 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -224,34 +224,35 @@  foreach l:libraries
         # RTE_BUILD_SHARED_LIB defined
         cflags += '-DRTE_BUILD_SHARED_LIB'
     endif
-    version_map = '@0@/@1@/version.map'.format(
-            meson.current_source_dir(), l)
-    implib = 'librte_' + l + '.dll.a'
 
-    def_file = custom_target(libname + '_def',
-            command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
-            input: version_map,
-            output: '@0@_exports.def'.format(libname))
-
-    mingw_map = custom_target(libname + '_mingw',
-            command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
-            input: version_map,
-            output: '@0@_mingw.map'.format(libname))
+    version_map = '@0@/@1@/version.map'.format(meson.current_source_dir(), l)
+    lk_deps = [version_map]
 
     if is_ms_linker
+        def_file = custom_target(libname + '_def',
+                command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+                input: version_map,
+                output: '@0@_exports.def'.format(libname))
+        lk_deps += [def_file]
+
         lk_args = ['-Wl,/def:' + def_file.full_path()]
         if meson.version().version_compare('<0.54.0')
-            lk_args += ['-Wl,/implib:lib\\' + implib]
+            lk_args += ['-Wl,/implib:lib\\librte_' + l + '.dll.a']
         endif
     else
         if is_windows
+            mingw_map = custom_target(libname + '_mingw',
+                    command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+                    input: version_map,
+                    output: '@0@_mingw.map'.format(libname))
+            lk_deps += [mingw_map]
+
             lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
         else
             lk_args = ['-Wl,--version-script=' + version_map]
         endif
     endif
 
-    lk_deps = [version_map, def_file, mingw_map]
     if developer_mode and not is_windows
         # on unix systems check the output of the
         # check-symbols.sh script, using it as a