From c10f87f1e60c19a04c4feabae3964c25837e9a9a Mon Sep 17 00:00:00 2001 From: Michael Brockus Date: Wed, 3 Jul 2019 21:03:39 -0700 Subject: [PATCH] Fixed issues regarding the example Meson project. --- examples/example_4/meson.build | 3 +++ examples/example_4/readme.txt | 5 +++-- examples/example_4/src/meson.build | 20 +++++++++++++------ examples/example_4/subprojects/unity.wrap | 4 ++++ examples/example_4/test/TestProductionCode.c | 5 ----- .../example_4/test/test_runners/meson.build | 4 ++-- examples/meson.build | 14 ------------- meson.build | 7 +------ meson_options.txt | 17 ---------------- 9 files changed, 27 insertions(+), 52 deletions(-) create mode 100755 examples/example_4/subprojects/unity.wrap delete mode 100644 examples/meson.build delete mode 100755 meson_options.txt diff --git a/examples/example_4/meson.build b/examples/example_4/meson.build index 5e34a33..21d1001 100644 --- a/examples/example_4/meson.build +++ b/examples/example_4/meson.build @@ -10,6 +10,9 @@ ################################################################################### +project('example-4') + +unity_dep = dependency('unity', fallback : ['unity', 'unity_dep']) example_dir = include_directories('.', join_paths('.', 'src')) diff --git a/examples/example_4/readme.txt b/examples/example_4/readme.txt index 790a6fb..c8f45a8 100644 --- a/examples/example_4/readme.txt +++ b/examples/example_4/readme.txt @@ -2,7 +2,7 @@ Example 4 ========= Close to the simplest possible example of Unity, using only basic features. -to build this example run meson setup . +to build this example run "meson setup ". Meson uses the Ninja build system to actually build the code. To start the build, simply type the following command. @@ -11,4 +11,5 @@ build, simply type the following command. Meson provides native support for running tests. The command to do that is simple. -"meson test -C ". \ No newline at end of file +"meson test -C ". + \ No newline at end of file diff --git a/examples/example_4/src/meson.build b/examples/example_4/src/meson.build index 77c3919..5f7e5da 100644 --- a/examples/example_4/src/meson.build +++ b/examples/example_4/src/meson.build @@ -11,13 +11,21 @@ -example_src = files('ProductionCode.c', 'ProductionCode2.c') +a_lib = library( + 'production-code-1', + 'ProductionCode.c', + include_directories: example_dir) + +b_lib = library( + 'production-code-2', + 'ProductionCode2.c', + include_directories: example_dir) + -example_lib = library(meson.project_name(), - sources: example_src, +a_dep = declare_dependency( + link_with: a_lib, include_directories: example_dir) -example_dep = declare_dependency( - version: meson.project_version(), - link_with: example_lib, +b_dep = declare_dependency( + link_with: b_lib, include_directories: example_dir) \ No newline at end of file diff --git a/examples/example_4/subprojects/unity.wrap b/examples/example_4/subprojects/unity.wrap new file mode 100755 index 0000000..bc5b386 --- /dev/null +++ b/examples/example_4/subprojects/unity.wrap @@ -0,0 +1,4 @@ +[wrap-git] +directory = unity +url = https://github.com/squidfarts/Unity.git +revision = head diff --git a/examples/example_4/test/TestProductionCode.c b/examples/example_4/test/TestProductionCode.c index b6c00ae..526a84e 100644 --- a/examples/example_4/test/TestProductionCode.c +++ b/examples/example_4/test/TestProductionCode.c @@ -17,11 +17,6 @@ void tearDown(void) { } -void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); -void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); -void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); -void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); -void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) { diff --git a/examples/example_4/test/test_runners/meson.build b/examples/example_4/test/test_runners/meson.build index edf35bb..005ca67 100644 --- a/examples/example_4/test/test_runners/meson.build +++ b/examples/example_4/test/test_runners/meson.build @@ -20,5 +20,5 @@ test_src_2 = [ join_paths('..' ,'TestProductionCode2.c') ] -test('Test production code one', executable('test-1', test_src_1, dependencies: [ example_dep, unity_dep ])) -test('Test production code two', executable('test-2', test_src_2, dependencies: [ example_dep, unity_dep ])) \ No newline at end of file +test('Test production code one', executable('test-1', test_src_1, dependencies: [ a_dep, unity_dep ])) +test('Test production code two', executable('test-2', test_src_2, dependencies: [ b_dep, unity_dep ])) \ No newline at end of file diff --git a/examples/meson.build b/examples/meson.build deleted file mode 100644 index df0e7fe..0000000 --- a/examples/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -################################################################################### -# # -# NAME: examples/meson.build # -# # -# AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams. # -# WRITTEN BY: Michael Brockus. # -# # -# License: MIT # -# # -################################################################################### - - - -subdir('example_4') \ No newline at end of file diff --git a/meson.build b/meson.build index 68f081b..7b9732a 100644 --- a/meson.build +++ b/meson.build @@ -77,9 +77,4 @@ subdir('src') unity_dep = declare_dependency( version: meson.project_version(), link_with: unity_lib, - include_directories: unity_dir) - - -if get_option('with_examples').enabled() - subdir('examples') -endif \ No newline at end of file + include_directories: unity_dir) \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt deleted file mode 100755 index 89f43a0..0000000 --- a/meson_options.txt +++ /dev/null @@ -1,17 +0,0 @@ -################################################################################### -# # -# NAME: meson_options.txt # -# # -# AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams. # -# WRITTEN BY: Michael Brockus. # -# # -# License: MIT # -# # -################################################################################### - - - -option('with_examples', - type: 'feature', value : 'disabled', - description: 'Enable Unity for unit testing.' -) \ No newline at end of file -- GitLab