diff options
-rw-r--r-- | docs/markdown/Windows-module.md | 5 | ||||
-rw-r--r-- | docs/markdown/snippets/windows-resources-dependencies.md | 4 | ||||
-rw-r--r-- | mesonbuild/modules/windows.py | 4 | ||||
-rwxr-xr-x | run_unittests.py | 10 | ||||
-rw-r--r-- | test cases/windows/5 resources/res/meson.build | 1 |
5 files changed, 22 insertions, 2 deletions
diff --git a/docs/markdown/Windows-module.md b/docs/markdown/Windows-module.md index 1d4b9bf..ba1e34e 100644 --- a/docs/markdown/Windows-module.md +++ b/docs/markdown/Windows-module.md @@ -12,6 +12,9 @@ arguments. Returns an opaque object that you put in the list of sources for the target you want to have the resources in. This method has the following keyword argument. - - `args` lists extra arguments to pass to the resource compiler +- `args` lists extra arguments to pass to the resource compiler +- `depend_files` lists resource files that the resource script depends on + (e.g. bitmap, cursor, font, html, icon, message table, binary data or manifest + files referenced by the resource script) (*since 0.47.0*) - `include_directories` which does the same thing as it does on target declarations: specifies header search directories diff --git a/docs/markdown/snippets/windows-resources-dependencies.md b/docs/markdown/snippets/windows-resources-dependencies.md new file mode 100644 index 0000000..f446ea5 --- /dev/null +++ b/docs/markdown/snippets/windows-resources-dependencies.md @@ -0,0 +1,4 @@ +## Windows resource files dependencies + +The `compile_resources()` function of the `windows` module now takes +the `depend_files:` keyword. diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index ac5b8b3..adb73d7 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -30,11 +30,12 @@ class WindowsModule(ExtensionModule): return compilers[l] raise MesonException('Resource compilation requires a C or C++ compiler.') - @permittedKwargs({'args', 'include_directories'}) + @permittedKwargs({'args', 'include_directories', 'depend_files'}) def compile_resources(self, state, args, kwargs): comp = self.detect_compiler(state.compilers) extra_args = mesonlib.stringlistify(kwargs.get('args', [])) + wrc_deps = extract_as_list(kwargs, 'depend_files', pop = True) inc_dirs = extract_as_list(kwargs, 'include_directories', pop = True) for incd in inc_dirs: if not isinstance(incd.held_object, (str, build.IncludeDirs)): @@ -83,6 +84,7 @@ class WindowsModule(ExtensionModule): 'output': '@BASENAME@.' + suffix, 'input': [src], 'command': [rescomp] + res_args, + 'depend_files': wrc_deps, } if isinstance(src, (str, mesonlib.File)): diff --git a/run_unittests.py b/run_unittests.py index d6b2619..a359e3c 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2392,6 +2392,16 @@ class WindowsTests(BasePlatformTests): for l in cc.ignore_libs: self.assertEqual(cc.find_library(l, env, []), []) + def test_rc_depends_files(self): + testdir = os.path.join(self.platform_test_dir, '5 resources') + self.init(testdir) + self.build() + # Immediately rebuilding should not do anything + self.assertBuildIsNoop() + # Changing mtime of sample.ico should rebuild everything + self.utime(os.path.join(testdir, 'res', 'sample.ico')) + self.assertRebuiltTarget('prog') + class LinuxlikeTests(BasePlatformTests): ''' diff --git a/test cases/windows/5 resources/res/meson.build b/test cases/windows/5 resources/res/meson.build index 184854e..6d501a2 100644 --- a/test cases/windows/5 resources/res/meson.build +++ b/test cases/windows/5 resources/res/meson.build @@ -1,4 +1,5 @@ win = import('windows') res = win.compile_resources('myres.rc', + depend_files: 'sample.ico', include_directories : inc) |