From 36dc4a1e3d9eef20d9b3c04742f47a03e110868c Mon Sep 17 00:00:00 2001 From: rkcf Date: Mon, 27 Feb 2023 14:33:54 -0600 Subject: [PATCH] Build: add google test framework Refs: #17 --- CMakeLists.txt | 17 +++++++++++++++++ Makefile | 10 ++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 402c8f7..f320013 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,3 +11,20 @@ add_library (generators src/generators.cpp) add_executable(wtpp src/wtpp.cpp) target_link_libraries(wtpp wave wavetable common generators) + +include(FetchContent) +FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/95d8c7ac4389b38b197bc7521dffb62508653eb5.zip +) + +FetchContent_MakeAvailable(googletest) + +enable_testing() + +add_executable(wtpp_test tests/wtpp_test.cpp) + +target_link_libraries(wtpp_test GTest::gtest_main) + +include(GoogleTest) +gtest_discover_tests(wtpp_test) diff --git a/Makefile b/Makefile index 4741b0d..05457f7 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,15 @@ PROJ = wtpp CC = /usr/bin/clang++ -CMAKE = /usr/bin/cmake GDB = /usr/bin/gdb -build: - $(CMAKE) --build build +build-release: + cmake --build build clean: - rm wtpp + rm build/wtpp + +test: build + cd build && ctest debug: $(CC) -g $(CFLAGS) $(OBJECTS)