Skip to content

Commit

Permalink
cpputest: fixed wrap (mesonbuild#1398)
Browse files Browse the repository at this point in the history
* Updated wrap files for cpputest-4.0

* Renamed meson.options to meson_options.txt

* Added build options for cpputest

* Added extensions to deps in releases.json and fixed build options

* Merged extensions into main CppUTest dep + fixed CI config

* Removed CppUTestExt from releases.json as it's now a single dependency

* Typo fixes

* Renamed options + added simple platform autodetection

* Removed unnecessary "build_on" from ci_config

* Added clang-cl to autodetection

* Moved clang-cl to VisualCpp
  • Loading branch information
SteelPh0enix authored and polesapart committed Feb 9, 2024
1 parent 82e9b28 commit 9ba2f03
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 67 deletions.
6 changes: 6 additions & 0 deletions ci_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
"cpp_std=c++14"
]
},
"cpputest": {
"build_options": [
"cpputest:enable_cpputest_extensions=true",
"cpputest:default_library=static"
]
},
"cppzmq": {
"alpine_packages": [
"zeromq-dev"
Expand Down
1 change: 1 addition & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@
"cpputest"
],
"versions": [
"4.0-3",
"4.0-2",
"4.0-1"
]
Expand Down
26 changes: 13 additions & 13 deletions subprojects/packagefiles/cpputest/meson.build
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
project('cpputest', 'cpp',
version : '4.0',
license : 'BSD-3')
project('cpputest', 'cpp',
license: 'BSD-3',
version: '4.0',
)

cpputest_dirs = include_directories('include')
cpputest_includes = include_directories('include')
subdir('src')

cpputest_dep = declare_dependency(
link_with : cpputest_lib,
version : meson.project_version(),
include_directories : cpputest_dirs)
cpputest_libs = [cpputest_lib]

if get_option('extinctions')
cpputest_dep = declare_dependency(
link_with : cpputest_ext_lib,
version : meson.project_version(),
include_directories : cpputest_dirs)
if get_option('enable_cpputest_extensions')
cpputest_libs += cpputest_ext_lib
endif

cpputest_dep = declare_dependency(
link_with : cpputest_libs,
version : meson.project_version(),
include_directories : cpputest_includes)
20 changes: 16 additions & 4 deletions subprojects/packagefiles/cpputest/meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
option('extinctions',
type : 'boolean',
value : true,
description : 'Use the CppUTest extension library'
option(
'enable_cpputest_extensions',
type: 'boolean',
value: false,
description: 'Build and provide CppUTest extensions'
)

option(
'cpputest_platform',
type: 'combo',
choices: ['autodetect', 'armcc', 'C2000', 'Dos', 'Gcc', 'GccNoStdC', 'Iar', 'Keil', 'none', 'Symbian', 'VisualCpp'],
value: 'autodetect',
description: 'Which UtestPlatform.cpp file should be used for the build.\n' +
'"autodetect" tries to provide one that\'s compatible with your C++ compiler.\n' +
'Currently it supports only GCC, Clang and MSVC.\n' +
'"none" allows You to provide your own.'
)
52 changes: 29 additions & 23 deletions subprojects/packagefiles/cpputest/src/CppUTest/meson.build
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
cpputest_src = files(
'CommandLineArguments.cpp',
'CommandLineTestRunner.cpp',
'JUnitTestOutput.cpp',
'MemoryLeakDetector.cpp',
'MemoryLeakWarningPlugin.cpp',
'SimpleMutex.cpp',
'SimpleString.cpp',
'SimpleStringInternalCache.cpp',
'TeamCityTestOutput.cpp',
'TestFailure.cpp',
'TestFilter.cpp',
'TestHarness_c.cpp',
'TestMemoryAllocator.cpp',
'TestOutput.cpp',
'TestPlugin.cpp',
'TestRegistry.cpp',
'TestResult.cpp',
'TestTestingFixture.cpp',
'Utest.cpp'
cpputest_sources = files(
'CommandLineArguments.cpp',
'CommandLineTestRunner.cpp',
'JUnitTestOutput.cpp',
'MemoryLeakDetector.cpp',
'MemoryLeakWarningPlugin.cpp',
'SimpleMutex.cpp',
'SimpleString.cpp',
'SimpleStringInternalCache.cpp',
'TeamCityTestOutput.cpp',
'TestFailure.cpp',
'TestFilter.cpp',
'TestHarness_c.cpp',
'TestMemoryAllocator.cpp',
'TestOutput.cpp',
'TestPlugin.cpp',
'TestRegistry.cpp',
'TestResult.cpp',
'TestTestingFixture.cpp',
'Utest.cpp',
)

cpputest_lib = static_library('CppUTest',
cpputest_src,
include_directories : cpputest_dirs)
if get_option('cpputest_platform') != 'none'
cpputest_sources += platform_source_file
endif

cpputest_lib = library(
'CppUTest',
cpputest_sources,
include_directories: cpputest_includes
)
44 changes: 23 additions & 21 deletions subprojects/packagefiles/cpputest/src/CppUTestExt/meson.build
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
cpputest_ext_src = files(
'CodeMemoryReportFormatter.cpp',
'GTest.cpp',
'IEEE754ExceptionsPlugin.cpp',
'MemoryReportAllocator.cpp',
'MemoryReporterPlugin.cpp',
'MemoryReportFormatter.cpp',
'MockActualCall.cpp',
'MockExpectedCall.cpp',
'MockExpectedCallsList.cpp',
'MockFailure.cpp',
'MockNamedValue.cpp',
'MockSupport_c.cpp',
'MockSupport.cpp',
'MockSupportPlugin.cpp',
'OrderedTest.cpp'
)

cpputest_ext_lib = static_library('CppUTestExt',
cpputest_ext_src,
include_directories : cpputest_dirs)
cpputest_ext_sources = files(
'CodeMemoryReportFormatter.cpp',
'GTest.cpp',
'IEEE754ExceptionsPlugin.cpp',
'MemoryReportAllocator.cpp',
'MemoryReporterPlugin.cpp',
'MemoryReportFormatter.cpp',
'MockActualCall.cpp',
'MockExpectedCall.cpp',
'MockExpectedCallsList.cpp',
'MockFailure.cpp',
'MockNamedValue.cpp',
'MockSupport.cpp',
'MockSupport_c.cpp',
'MockSupportPlugin.cpp',
'OrderedTest.cpp',
)

cpputest_ext_lib = library(
'CppUTest',
cpputest_ext_sources,
include_directories: cpputest_includes
)
17 changes: 17 additions & 0 deletions subprojects/packagefiles/cpputest/src/Platforms/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cpputest_platform = get_option('cpputest_platform')

if cpputest_platform != 'none'
if cpputest_platform == 'autodetect'
compiler_id = meson.get_compiler('cpp').get_id()
if compiler_id == 'gcc' or compiler_id == 'clang'
cpputest_platform = 'Gcc'
elif compiler_id == 'msvc' or compiler_id == 'clang-cl'
cpputest_platform = 'VisualCpp'
else
error(f'Unknown compiler ID @compiler_id@, cannot autodetect the platform.\n' +
'Define the platform manually or provide your own implementation.')
endif
endif

platform_source_file = files(cpputest_platform / 'UtestPlatform.cpp')
endif
12 changes: 6 additions & 6 deletions subprojects/packagefiles/cpputest/src/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if get_option('extinctions')
cpputest_ext_src = []
subdir('CppUTestExt')
endif

cpputest_src = []
# platform should be first, as cpputest depends on it's output
subdir('Platforms')
subdir('CppUTest')

if get_option('enable_cpputest_extensions')
subdir('CppUTestExt')
endif

0 comments on commit 9ba2f03

Please sign in to comment.