Skip to content

Commit c767d2d

Browse files
committed
Create Zephyr external module
This update googletest to use it as Zephyr OS external module. This allows downloading, configure and building googltest using Zephyr west build system, without any user manipulation. Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
1 parent 99ae632 commit c767d2d

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

modules/googletest/CMakeLists.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
zephyr_library()
2+
3+
# Disable use of pthreads in GoogleTest
4+
set(gtest_disable_pthreads ON CACHE BOOL "Build GoogleTest without Pthread")
5+
6+
zephyr_include_directories_ifdef(CONFIG_GTEST ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/)
7+
zephyr_include_directories_ifdef(CONFIG_GTEST ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/include/)
8+
zephyr_library_sources_ifdef(CONFIG_GTEST
9+
${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/src/gtest-all.cc
10+
)
11+
target_sources_ifdef(CONFIG_GTEST app PRIVATE
12+
${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/src/gtest_main.cc
13+
)
14+
15+
zephyr_include_directories_ifdef(CONFIG_GMOCK ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googlemock/)
16+
zephyr_include_directories_ifdef(CONFIG_GMOCK ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googlemock/include/)
17+
zephyr_library_sources_ifdef(CONFIG_GMOCK ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googlemock/src/gmock-all.cc)

modules/googletest/Kconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
config GTEST
2+
bool "GoogleTest test framework"
3+
select TEST
4+
select CPP
5+
select REQUIRES_FULL_LIBCPP
6+
select FPU
7+
8+
config GMOCK
9+
bool "GoogleMock mocking framework"
10+
select GTEST

zephyr/module.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: googletest
2+
build:
3+
cmake-ext: true
4+
kconfig-ext: true
5+
settings:
6+
module_ext_root: .

0 commit comments

Comments
 (0)