diff --git a/modules/googletest/CMakeLists.txt b/modules/googletest/CMakeLists.txt new file mode 100644 index 00000000..c6028874 --- /dev/null +++ b/modules/googletest/CMakeLists.txt @@ -0,0 +1,17 @@ +zephyr_library() + +# Disable use of pthreads in GoogleTest +set(gtest_disable_pthreads ON CACHE BOOL "Build GoogleTest without Pthread") + +zephyr_include_directories_ifdef(CONFIG_GTEST ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/) +zephyr_include_directories_ifdef(CONFIG_GTEST ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/include/) +zephyr_library_sources_ifdef(CONFIG_GTEST + ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/src/gtest-all.cc +) +target_sources_ifdef(CONFIG_GTEST app PRIVATE + ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googletest/src/gtest_main.cc +) + +zephyr_include_directories_ifdef(CONFIG_GMOCK ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googlemock/) +zephyr_include_directories_ifdef(CONFIG_GMOCK ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googlemock/include/) +zephyr_library_sources_ifdef(CONFIG_GMOCK ${ZEPHYR_GOOGLETEST_MODULE_DIR}/googlemock/src/gmock-all.cc) diff --git a/modules/googletest/Kconfig b/modules/googletest/Kconfig new file mode 100644 index 00000000..f2d30e27 --- /dev/null +++ b/modules/googletest/Kconfig @@ -0,0 +1,18 @@ +config GTEST + bool "GoogleTest test framework" + select TEST + select CPP + select REQUIRES_FULL_LIBCPP + select FPU + +config GMOCK + bool "GoogleMock mocking framework" + select GTEST + +choice STD_CPP + default STD_CPP14 if GTEST +endchoice + +choice LIBC_IMPLEMENTATION + default NEWLIB_LIBC if GTEST +endchoice diff --git a/modules/modules.cmake b/modules/modules.cmake new file mode 100644 index 00000000..0b79068d --- /dev/null +++ b/modules/modules.cmake @@ -0,0 +1,2 @@ +set(ZEPHYR_GOOGLETEST_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR}/googletest) +set(ZEPHYR_GOOGLETEST_KCONFIG ${CMAKE_CURRENT_LIST_DIR}/googletest/Kconfig) diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 00000000..2415d80f --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,6 @@ +name: googletest +build: + cmake-ext: true + kconfig-ext: true + settings: + module_ext_root: .