]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3732] Use gtest wrap
authorAndrei Pavel <andrei@isc.org>
Thu, 10 Apr 2025 17:59:43 +0000 (20:59 +0300)
committerAndrei Pavel <andrei@isc.org>
Thu, 10 Apr 2025 18:02:57 +0000 (21:02 +0300)
meson.build
subprojects/.gitignore [new file with mode: 0644]
subprojects/gtest.wrap [new file with mode: 0644]

index 03ba8f86c3a10a827fef3efd470661a69544e9fe..4560cf5765cacb0368b628458602883f67a9048a 100644 (file)
@@ -244,10 +244,15 @@ if netconf_opt.enabled() and NETCONF_DEP.get_variable(
     error('Dependency not found: NETCONF.')
 endif
 
-GTEST_DEP = dependency(
-    'gtest',
-    required: TESTS_OPT.enabled() or FUZZ_OPT.enabled(),
-)
+# GTEST_DEP = dependency(
+#     'gtest',
+#     required: TESTS_OPT.enabled() or FUZZ_OPT.enabled(),
+# )
+GTEST_DEP = disabler()
+if TESTS_OPT.enabled() or FUZZ_OPT.enabled()
+    gtest_proj = subproject('gtest')
+    GTEST_DEP = gtest_proj.get_variable('gtest_dep')
+endif
 
 # Crypto
 if crypto_opt == 'botan'
@@ -469,12 +474,15 @@ endif
 conf_data.set('HAVE_AFL', have_afl)
 
 if GTEST_DEP.found()
-    result = cpp.run(
-        fs.read('compiler-checks/have-create-unified-diff.cc'),
-        name: 'HAVE_CREATE_UNIFIED_DIFF',
-        dependencies: [GTEST_DEP],
-    )
-    conf_data.set('HAVE_CREATE_UNIFIED_DIFF', result.returncode() == 0)
+    # Wrap dependencies cannot be used in compiler checks: https://github.com/mesonbuild/meson/issues/11575
+    # We can safely assume that googletest 1.15.2 has CreateUnifiedDiff though.
+    # result = cpp.run(
+    #     fs.read('compiler-checks/have-create-unified-diff.cc'),
+    #     name: 'HAVE_CREATE_UNIFIED_DIFF',
+    #     dependencies: [GTEST_DEP],
+    # )
+    # conf_data.set('HAVE_CREATE_UNIFIED_DIFF', result.returncode() == 0)
+    conf_data.set('HAVE_CREATE_UNIFIED_DIFF', true)
 endif
 
 if KRB5_DEP.found()
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644 (file)
index 0000000..a5a694b
--- /dev/null
@@ -0,0 +1,2 @@
+/googletest-1.15.2
+/packagecache
diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap
new file mode 100644 (file)
index 0000000..ba73d96
--- /dev/null
@@ -0,0 +1,16 @@
+[wrap-file]
+directory = googletest-1.15.2
+source_url = https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz
+source_filename = gtest-1.15.2.tar.gz
+source_hash = 7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926
+patch_filename = gtest_1.15.2-4_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.15.2-4/get_patch
+patch_hash = a5151324b97e6a98fa7a0e8095523e6d5c4bb3431210d6ac4ad9800c345acf40
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.15.2-4/gtest-1.15.2.tar.gz
+wrapdb_version = 1.15.2-4
+
+[provide]
+gtest = gtest_dep
+gtest_main = gtest_main_dep
+gmock = gmock_dep
+gmock_main = gmock_main_dep