Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpputest: fixed wrap #1398

Merged
merged 11 commits into from
Feb 9, 2024
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' or compiler_id == 'clang-cl'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be treated as GCC or VisualCpp?

Copy link
Contributor Author

@SteelPh0enix SteelPh0enix Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it passes here so I'm not sure if it's just a funky compatibility layer, or intended behaviour.
I'll throw it to VisualCpp and let's see what happens

Copy link
Contributor Author

@SteelPh0enix SteelPh0enix Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After quick read, yeah, this should definitely be treated as VisualCpp

cpputest_platform = 'Gcc'
elif compiler_id == 'msvc'
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