From db223d24129454efab07bfd1a484245b141cb66e Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Tue, 17 Jul 2018 20:18:05 +0200 Subject: [PATCH] Glob subdirs (problem w dependencies) --- folder1/meson.build | 2 +- folder2/meson.build | 2 +- meson.build | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/folder1/meson.build b/folder1/meson.build index 55eec19..b3f16d5 100644 --- a/folder1/meson.build +++ b/folder1/meson.build @@ -1,4 +1,4 @@ -folder1_src = ['folder1.c'] +folder1_src = files(['folder1.c']) folder1_inc = include_directories('.') folder1_dep = declare_dependency(sources: folder1_src, include_directories : folder1_inc) diff --git a/folder2/meson.build b/folder2/meson.build index 223a3c8..2358cdb 100644 --- a/folder2/meson.build +++ b/folder2/meson.build @@ -1,4 +1,4 @@ -folder2_src = ['folder2.c'] +folder2_src = files(['folder2.c']) folder2_inc = include_directories('.') folder2_dep = declare_dependency(sources: folder2_src, include_directories : folder2_inc, diff --git a/meson.build b/meson.build index dd5e46d..b3cb050 100644 --- a/meson.build +++ b/meson.build @@ -1,11 +1,9 @@ project('meson_test','cpp', 'c') gtest = dependency('gtest', main : true, required : false) - if not gtest.found() gtest_sub = subproject('gtest') - gtest_src = [gtest_sub.get_variable('gtest_libsources'), - gtest_sub.get_variable('gtest_mainsources')] + gtest_src = [gtest_sub.get_variable('gtest_libsources'), gtest_sub.get_variable('gtest_mainsources')] gtest_inc = gtest_sub.get_variable('gtest_incdir') gtest_lib = static_library('gtest', sources: gtest_src, include_directories: gtest_inc) @@ -14,8 +12,13 @@ if not gtest.found() dependencies: dependency('threads')) endif -subdir('folder1') -subdir('folder1_test') -subdir('folder2') -subdir('folder2_test') +py3 = import('python3').find_python() +ret = run_command(py3, '-c', 'import glob\ndirs = glob.glob("**/meson.build")\nfor d in sorted(dirs): print(d[:-12])') +dirs = [] +if ret.returncode() == 0 + dirs += ret.stdout().split() +endif +foreach d : dirs + subdir(d) +endforeach -- 2.43.0