- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个带有一些 C++ 测试代码的 git 存储库,我想使用 Googletest写一些测试。我使用 git submodule
将其作为上述存储库的一部分获取。我想用 meson作为构建引擎。到目前为止,还不错。
但是,我无法理解如何让介子构建并将我的测试与 googletest 子模块链接起来……我应该使用包装吗?外部依赖?什么?
请注意 meson supports dependencies on packaged versions of gtest/gmock但这不是我想要的,因为 gtest/gmock 的开发人员反对它。另外,我想要前沿技术,因为我疯了⸮
此外,我不认为忍者在这里发挥作用,但我提到我使用它以防万一。
最佳答案
我尝试使用 the wrap for gtest与
gtest_proj = subproject('gtest')
gtest_dep = gtest_proj.get_variable('gtest_dep')
gmock_dep = gtest_proj.get_variable('gmock_dep')
在 meson.build
中。这会构建一个 googletest 的本地副本,然后可以像这样使用它:
tests_src = [
'tests/gtest-all.cpp',
'tests/test_MyClass.cpp',
]
e = executable(
'gtest-all',
tests_src,
dependencies : [
gtest_dep,
gmock_dep],
link_with : libshield,
)
test('gtest tests', e)
请注意,libshield
是根据我的(玩具)代码创建的共享库,因此我可以链接到它。
关于linux - 如何使用介子设置 googletest?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57473395/
我尝试对介子进行单元测试,并且得到: ϰ ninja [4/4] Linking target test/crypto/crypto_tests. FAILED: test/crypto/crypt
我正在尝试编译 Pulse Effects项目,我在运行 meson build 后遇到了这个问题: Dependency gstreamer-1.0 found: NO (tried pkgconf
我的 Meson项目我有一个位于“不寻常”位置的依赖项: /opt/MyDependence/lib/libmyLib.so /opt/MyDependence/include/myLib.hpp 我
我是一名优秀的程序员,十分优秀!