Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorMike Crowe2022-10-01 22:28:30 +0100
committerGitHub2022-10-01 23:28:30 +0200
commit4db8b50aab9f91f31b2953455091e257942ec188 (patch)
treeea19247889d71e0d3c4374eda68c66bd4155dab5 /tools
parent4a7cefe60101c1e5ea7c7da33a1abe06fbc8e020 (diff)
downloadcatch3-4db8b50aab9f91f31b2953455091e257942ec188.tar.gz
Add support for building with Meson (#2530)
The Meson[1] build system makes it easier incorporate third-party libaries into a project if they also build using Meson. Let's add a minimal Meson build that's compatible with the CMake build, along with a GitHub workflow to check that it builds and that at least the simplest SelfTest runs. The handling of catch_user_config.hpp is inspired by BUILD.bazel and doesn't attempt to support any configuratons options. Such features could be added later. Meson strongly discourages using wildcards to specify sources, so the source and header lists are copied from CMakeLists.txt. Add a new test workflow to test the Meson builds. I was unable to get these tests to pass with Ubuntu 20.04, so they use Ubuntu 22.04. I'm neither a CMake nor a Meson expert, but the results seem to work for me. [1] https://mesonbuild.com/ Co-authored-by: Mike Crowe <mcrowe@brightsign.biz>
Diffstat (limited to 'tools')
-rw-r--r--tools/scripts/releaseCommon.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/scripts/releaseCommon.py b/tools/scripts/releaseCommon.py
index 20ef1b0c..30a07658 100644
--- a/tools/scripts/releaseCommon.py
+++ b/tools/scripts/releaseCommon.py
@@ -15,6 +15,7 @@ versionPath = os.path.join( rootPath, "catch_version.cpp" )
definePath = os.path.join(rootPath, 'catch_version_macros.hpp')
readmePath = os.path.join( catchPath, "README.md" )
cmakePath = os.path.join(catchPath, 'CMakeLists.txt')
+mesonPath = os.path.join(catchPath, 'meson.build')
class Version:
def __init__(self):
@@ -89,6 +90,16 @@ def updateCmakeFile(version):
file.write(replacementRegex.sub(replacement, line))
+def updateMesonFile(version):
+ with open(mesonPath, 'rb') as file:
+ lines = file.readlines()
+ replacementRegex = re.compile(b'''version\s*:\s*'(\\d+.\\d+.\\d+)', # CML version placeholder, don't delete''')
+ replacement = '''version : '{0}', # CML version placeholder, don't delete'''.format(version.getVersionString()).encode('ascii')
+ with open(mesonPath, 'wb') as file:
+ for line in lines:
+ file.write(replacementRegex.sub(replacement, line))
+
+
def updateVersionDefine(version):
# First member of the tuple is the compiled regex object, the second is replacement if it matches
replacementRegexes = [(re.compile(b'#define CATCH_VERSION_MAJOR \\d+'),'#define CATCH_VERSION_MAJOR {}'.format(version.majorVersion).encode('ascii')),
@@ -132,4 +143,5 @@ def performUpdates(version):
generateAmalgamatedFiles.generate_cpp()
updateCmakeFile(version)
+ updateMesonFile(version)
updateDocumentationVersionPlaceholders(version)