diff --git a/run_unittests.py b/run_unittests.py index 08ec7740c..64874968f 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -899,7 +899,7 @@ class AllPlatformTests(BasePlatformTests): raise Exception('Could not find someexe and somfxe commands') # Check include order for 'someexe' incs = [a for a in shlex.split(execmd) if a.startswith("-I")] - self.assertEqual(len(incs), 8) + self.assertEqual(len(incs), 9) # target private dir self.assertPathEqual(incs[0], "-Isub4/someexe@exe") # target build subdir @@ -916,6 +916,8 @@ class AllPlatformTests(BasePlatformTests): self.assertPathEqual(incs[6], "-Isub1") # target internal dependency include_directories: source dir self.assertPathBasenameEqual(incs[7], 'sub1') + # custom target include dir + self.assertPathEqual(incs[8], '-Ictsub') # Check include order for 'somefxe' incs = [a for a in shlex.split(fxecmd) if a.startswith('-I')] self.assertEqual(len(incs), 9) diff --git a/test cases/common/138 include order/ctsub/copyfile.py b/test cases/common/138 include order/ctsub/copyfile.py new file mode 100644 index 000000000..ff42ac359 --- /dev/null +++ b/test cases/common/138 include order/ctsub/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/138 include order/ctsub/emptyfile.c b/test cases/common/138 include order/ctsub/emptyfile.c new file mode 100644 index 000000000..e69de29bb diff --git a/test cases/common/138 include order/ctsub/main.h b/test cases/common/138 include order/ctsub/main.h new file mode 100644 index 000000000..9d9acf36f --- /dev/null +++ b/test cases/common/138 include order/ctsub/main.h @@ -0,0 +1 @@ +#error "ctsub/main.h included" diff --git a/test cases/common/138 include order/ctsub/meson.build b/test cases/common/138 include order/ctsub/meson.build new file mode 100644 index 000000000..a242e0764 --- /dev/null +++ b/test cases/common/138 include order/ctsub/meson.build @@ -0,0 +1,9 @@ +# https://github.com/mesonbuild/meson/pull/2291 +copy = find_program('copyfile.py') +configure_file(input : 'main.h', + output : 'main.h', + command : [copy, '@INPUT@', '@OUTPUT@']) +ctfile = custom_target('emptyfile', + input : 'emptyfile.c', + output : 'emptyfile.c', + command : [copy, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/common/138 include order/meson.build b/test cases/common/138 include order/meson.build index c79cb0a48..c370bb1d1 100644 --- a/test cases/common/138 include order/meson.build +++ b/test cases/common/138 include order/meson.build @@ -10,6 +10,8 @@ project('include order', 'c') # 5. Include paths added via `include_directories:` of internal deps # Within this, the build dir takes precedence over the source dir +# Custom target dir with a built header +subdir('ctsub') # Defines an internal dep subdir('sub1') # Defines a per-target include path diff --git a/test cases/common/138 include order/sub4/meson.build b/test cases/common/138 include order/sub4/meson.build index ab4c4558d..c01edaa20 100644 --- a/test cases/common/138 include order/sub4/meson.build +++ b/test cases/common/138 include order/sub4/meson.build @@ -1,4 +1,4 @@ -e = executable('someexe', 'main.c', +e = executable('someexe', 'main.c', ctfile, c_args : ['-I' + sub3], include_directories : j, dependencies : dep)