From 090592ed7daea335c826f8d869e5ae2db7e20cb0 Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Mon, 16 Jul 2018 21:49:48 +0200 Subject: [PATCH] Test and source in different dirs --- folder1/folder1.h | 2 +- folder1/meson.build | 10 +++++----- {folder1 => folder1_test}/folder1_test.cpp | 0 folder1_test/meson.build | 2 ++ folder2/meson.build | 10 +++++----- {folder2 => folder2_test}/folder2_test.cpp | 0 folder2_test/meson.build | 3 +++ meson.build | 2 ++ 8 files changed, 18 insertions(+), 11 deletions(-) rename {folder1 => folder1_test}/folder1_test.cpp (100%) create mode 100644 folder1_test/meson.build rename {folder2 => folder2_test}/folder2_test.cpp (100%) create mode 100644 folder2_test/meson.build diff --git a/folder1/folder1.h b/folder1/folder1.h index ae3e5bd..ec372ac 100644 --- a/folder1/folder1.h +++ b/folder1/folder1.h @@ -4,4 +4,4 @@ int function1(); int function2(); -#endif // FOLDER1_H \ No newline at end of file +#endif // FOLDER1_H diff --git a/folder1/meson.build b/folder1/meson.build index cd5280e..fb58566 100644 --- a/folder1/meson.build +++ b/folder1/meson.build @@ -1,5 +1,5 @@ -folder1_inc = include_directories('') -folder1_lib = static_library('folder1', 'folder1.c') -folder1_dep = declare_dependency(link_with : folder1_lib, include_directories : folder1_inc) -folder1_tst = executable('test1', 'folder1_test.cpp', dependencies : [gtest, folder1_dep]) -test('test 1', folder1_tst) +folder1_inc = include_directories('.') + +folder1_lib = static_library('folder1', 'folder1.c', include_directories : folder1_inc) + +folder1_dep = declare_dependency(link_with: folder1_lib, include_directories : folder1_inc) diff --git a/folder1/folder1_test.cpp b/folder1_test/folder1_test.cpp similarity index 100% rename from folder1/folder1_test.cpp rename to folder1_test/folder1_test.cpp diff --git a/folder1_test/meson.build b/folder1_test/meson.build new file mode 100644 index 0000000..2dc1dd8 --- /dev/null +++ b/folder1_test/meson.build @@ -0,0 +1,2 @@ +folder1_tst = executable('test1', 'folder1_test.cpp', dependencies : [gtest, folder1_dep]) +test('test 1', folder1_tst) diff --git a/folder2/meson.build b/folder2/meson.build index fb87cd2..0059eec 100644 --- a/folder2/meson.build +++ b/folder2/meson.build @@ -1,5 +1,5 @@ -folder2_inc = include_directories('') -folder2_lib = static_library('folder2', 'folder2.c') -folder2_dep = declare_dependency(link_with : folder2_lib, include_directories : folder2_inc, dependencies : folder1_dep) -folder2_tst = executable('test2', 'folder2_test.cpp', dependencies : [gtest, folder2_dep]) -test('test 2', folder2_tst) +folder2_inc = include_directories('.') + +folder2_lib = static_library('folder2', 'folder2.c', include_directories : folder2_inc) + +folder2_dep = declare_dependency(link_with: folder2_lib, include_directories : folder2_inc, dependencies : folder1_dep) diff --git a/folder2/folder2_test.cpp b/folder2_test/folder2_test.cpp similarity index 100% rename from folder2/folder2_test.cpp rename to folder2_test/folder2_test.cpp diff --git a/folder2_test/meson.build b/folder2_test/meson.build new file mode 100644 index 0000000..b09c6ba --- /dev/null +++ b/folder2_test/meson.build @@ -0,0 +1,3 @@ +folder2_tst = executable('test2', 'folder2_test.cpp', + dependencies : [gtest, folder2_dep]) +test('test 2', folder2_tst) diff --git a/meson.build b/meson.build index 1ca8186..1dc9707 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,7 @@ project('meson_test','cpp', 'c') gtest = dependency('gtest', main : true, required : false) subdir('folder1') +subdir('folder1_test') subdir('folder2') +subdir('folder2_test') -- 2.43.0