Skip to content

Commit

Permalink
add gtest, temp disable swig
Browse files Browse the repository at this point in the history
(cherry picked from commit 4008d163d77f503e6acbd7ddc1d87ac6d479c897)
  • Loading branch information
mrivi authored and bresch committed Oct 28, 2019
1 parent 9b4b24e commit fcea13e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
27 changes: 21 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(
-pedantic

-Wall
-Wextra
-Werror
Expand All @@ -102,7 +102,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# testing
include(CTest)
enable_testing()

if(BUILD_TESTING)
option(ECL_TESTS "Build ECL tests" ON)

Expand Down Expand Up @@ -196,17 +196,17 @@ endif()
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)

option(BUILD_DOXYGEN "Build doxygen documentation" OFF)

if (BUILD_DOXYGEN)
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)

# note the option ALL which allows to build the docs together with the application
add_custom_target(doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
Expand All @@ -216,9 +216,24 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
VERBATIM
USES_TERMINAL
)

else()
message(FATAL_ERROR "Doxygen needs to be installed to generate documentation")
endif()
endif()
endif()


enable_testing()
include_directories(${GTEST_INCLUDE_DIR})
add_subdirectory("/usr/src/gtest" ${CMAKE_BINARY_DIR}/gtest)

set(SRCS
test/main.cpp
test/test_example.cpp
)
add_executable(TestECL ${SRCS})

target_include_directories(TestECL PRIVATE ${GTEST_INCLUDE_DIRS})
target_link_libraries(TestECL gtest gtest_main)
add_test(NAME TestECL COMMAND TestECL)
12 changes: 6 additions & 6 deletions EKF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ set_target_properties(ecl_EKF PROPERTIES PUBLIC_HEADER "ekf.h")

target_compile_options(ecl_EKF PRIVATE -fno-associative-math)

if(EKF_PYTHON_TESTS)
add_subdirectory(swig)
endif()
#if(EKF_PYTHON_TESTS)
# add_subdirectory(swig)
#endif()

if(BUILD_TESTING)
add_subdirectory(tests)
endif()
#if(BUILD_TESTING)
# add_subdirectory(tests)
#endif()
7 changes: 7 additions & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <gtest/gtest.h>

int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
std::cout << "init test \n";
return RUN_ALL_TESTS();
}
7 changes: 7 additions & 0 deletions test/test_example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "gtest/gtest.h"

TEST(test_example, sample_test)
{
printf("blabla \n" );
EXPECT_EQ(1, 1);
}

0 comments on commit fcea13e

Please sign in to comment.