diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-03-15 11:37:36 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-03-15 11:43:05 +0100 |
commit | 49076d719cf28886ad66fc13cbba8d3d94afb332 (patch) | |
tree | 7691fd0a3a2437b14977aab83d1cf2fd7e9204b5 | |
parent | 647bd2839e83267bf92fc5909f1b86e630bf395f (diff) | |
download | meson-49076d719cf28886ad66fc13cbba8d3d94afb332.zip meson-49076d719cf28886ad66fc13cbba8d3d94afb332.tar.gz meson-49076d719cf28886ad66fc13cbba8d3d94afb332.tar.bz2 |
kconfig: improvements for builddir config file
Document best practices for per-builddir config file, and add a test covering
loading a config file from the build directory.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | docs/markdown/Kconfig-module.md | 8 | ||||
-rw-r--r-- | test cases/kconfig/4 load_config builddir/config | 2 | ||||
-rw-r--r-- | test cases/kconfig/4 load_config builddir/meson.build | 14 |
3 files changed, 24 insertions, 0 deletions
diff --git a/docs/markdown/Kconfig-module.md b/docs/markdown/Kconfig-module.md index b13f7ec..c361b5b 100644 --- a/docs/markdown/Kconfig-module.md +++ b/docs/markdown/Kconfig-module.md @@ -38,6 +38,14 @@ This function loads a kconfig output file and returns a dictionary object. file. Therefore, true boolean values will be represented as the string "y" and integer values will have to be converted with `.to_int()`. +Kconfig frontends usually have ".config" as the default name for the +configuration file. However, placing the configuration file in the source +directory limits the user to one configuration per source directory. +In order to allow separate configurations for each build directory, as is +the Meson standard, `meson.build` should not hardcode ".config" as the +argument to `kconfig.load()`, and should instead make the argument to +`kconfig.load()` a [project build option](Build-options.md). + * The first (and only) argument is the path to the configuration file to load (usually ".config"). diff --git a/test cases/kconfig/4 load_config builddir/config b/test cases/kconfig/4 load_config builddir/config new file mode 100644 index 0000000..0599d46 --- /dev/null +++ b/test cases/kconfig/4 load_config builddir/config @@ -0,0 +1,2 @@ +CONFIG_IS_SET=y +# CONFIG_NOT_IS_SET is not set diff --git a/test cases/kconfig/4 load_config builddir/meson.build b/test cases/kconfig/4 load_config builddir/meson.build new file mode 100644 index 0000000..93136ba --- /dev/null +++ b/test cases/kconfig/4 load_config builddir/meson.build @@ -0,0 +1,14 @@ +project('kconfig builddir test') + +k = import('unstable-kconfig') + +configure_file(input: 'config', output: 'out-config', copy: true) +conf = k.load(meson.build_root() / 'out-config') + +if not conf.has_key('CONFIG_IS_SET') + error('Expected CONFIG_IS_SET to be set, but it wasn\'t') +endif + +if conf.has_key('CONFIG_NOT_IS_SET') + error('Expected CONFIG_NOT_IS_SET not be set, but it was') +endif |