Commit f09ae987bffc2ede00341bc6f0e903ae6810def5

Adrian Perez de Castro 2019-08-05T13:51:09

build: Skip building some tests on MSVC for now This is a stopgap measure to quickly get tests building with MSVC for now, at some point the tests could be rewritten to avoid using getopt() and mkdtemp() or to ship an implementation.

diff --git a/meson.build b/meson.build
index d8b9430..a43fc0c 100644
--- a/meson.build
+++ b/meson.build
@@ -344,11 +344,14 @@ test(
     executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
     env: test_env,
 )
-test(
-    'context',
-    executable('test-context', 'test/context.c', dependencies: test_dep),
-    env: test_env,
-)
+# TODO: This test currently uses some functions that don't exist on Windows.
+if cc.get_id() != 'msvc'
+  test(
+      'context',
+      executable('test-context', 'test/context.c', dependencies: test_dep),
+      env: test_env,
+  )
+endif
 test(
     'rules-file',
     executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
@@ -427,9 +430,11 @@ executable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
 
 
 # Demo programs.
-executable('rmlvo-to-kccgst', 'test/rmlvo-to-kccgst.c', dependencies: test_dep)
-executable('rmlvo-to-keymap', 'test/rmlvo-to-keymap.c', dependencies: test_dep)
-executable('print-compiled-keymap', 'test/print-compiled-keymap.c', dependencies: test_dep)
+if cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE')
+    executable('rmlvo-to-kccgst', 'test/rmlvo-to-kccgst.c', dependencies: test_dep)
+    executable('rmlvo-to-keymap', 'test/rmlvo-to-keymap.c', dependencies: test_dep)
+    executable('print-compiled-keymap', 'test/print-compiled-keymap.c', dependencies: test_dep)
+endif
 if cc.has_header('linux/input.h')
     executable('interactive-evdev', 'test/interactive-evdev.c', dependencies: test_dep)
 endif