diff --git a/CI/Windows.bat b/CI/Windows.bat index e482eeaf..62105f46 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -19,7 +19,6 @@ IF "%SHARED%" == "TRUE" ( IF "%BUILD_PLATFORM%" == "VS2015" ( set LIBPATH=E:\libs\VS2015 - set GTESTVERSION=gtest-1.7.0 set GENERATOR=Visual Studio 14%ARCH_VS% set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" @@ -37,7 +36,6 @@ IF "%BUILD_PLATFORM%" == "VS2015" ( IF "%BUILD_PLATFORM%" == "VS2017" ( set LIBPATH=E:\libs\VS2017 - set GTESTVERSION=gtest-1.7.0 set GENERATOR=Visual Studio 15%ARCH_VS% set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.com" @@ -51,7 +49,6 @@ IF "%BUILD_PLATFORM%" == "VS2017" ( IF "%BUILD_PLATFORM%" == "VS2019" ( set LIBPATH=E:\libs\VS2019 - set GTESTVERSION=gtest-1.11.0 set GENERATOR=Visual Studio 16 2019 set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.com" @@ -91,7 +88,6 @@ ECHO "Building with :" whoami ECHO "ARCHITECTURE : %ARCHITECTURE%" ECHO "BUILD_PLATFORM : %BUILD_PLATFORM%" -ECHO "GTESTVERSION : %GTESTVERSION%" ECHO "GENERATOR : %GENERATOR%" ECHO "VS_PATH : %VS_PATH%" ECHO "LIBPATH : %LIBPATH%" @@ -120,7 +116,7 @@ IF EXIST %QT_INSTALL_PATH%\ ( ) -"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_ROOT="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=%APPS% -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_WINDOWS_LIBS_DIR="e:\libs" -DOPENMESH_BUILD_SHARED=%SHARED% %CMAKE_CONFIGURATION% .. +"C:\Program Files\CMake\bin\cmake.exe" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=%APPS% -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_WINDOWS_LIBS_DIR="e:\libs" -DOPENMESH_BUILD_SHARED=%SHARED% %CMAKE_CONFIGURATION% .. %VS_PATH% /Build "Release" OpenMesh.sln /Project "ALL_BUILD" @@ -142,7 +138,7 @@ mkdir build-debug cd build-debug -"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_ROOT="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_SHARED=%SHARED% -DBUILD_APPS=%APPS% %CMAKE_CONFIGURATION% .. +"C:\Program Files\CMake\bin\cmake.exe" -G "%GENERATOR%" -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_SHARED=%SHARED% -DBUILD_APPS=%APPS% %CMAKE_CONFIGURATION% .. %VS_PATH% /Build "Debug" OpenMesh.sln /Project "ALL_BUILD" @@ -174,7 +170,7 @@ cd build-release del *.exe -"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_ROOT="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DBUILD_APPS=%APPS% -DCMAKE_BUILD_TYPE=Release %CMAKE_CONFIGURATION% .. +"C:\Program Files\CMake\bin\cmake.exe" -G "%GENERATOR%" -DBUILD_APPS=%APPS% -DCMAKE_BUILD_TYPE=Release %CMAKE_CONFIGURATION% .. %VS_PATH% /Build "Release" OpenMesh.sln /Project "PACKAGE" diff --git a/CI/ci-linux-prepare.sh b/CI/ci-linux-prepare.sh index b3120761..d628d1ea 100755 --- a/CI/ci-linux-prepare.sh +++ b/CI/ci-linux-prepare.sh @@ -7,14 +7,6 @@ OPTIONS="" MAKE_OPTIONS="" BUILDPATH="" -# set GTEST path -if [ -d "$HOME/sw/gtest-1.10.0" ]; then - OPTIONS="-DGTEST_ROOT=$HOME/sw/gtest-1.10.0" - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/sw/gtest-1.10.0/lib" -else - OPTIONS="-DGTEST_ROOT=/usr/src/gtest/" -fi - if [ "$COMPILER" == "gcc" ]; then echo "Building with GCC"; BUILDPATH="gcc" diff --git a/CI/ci-mac-prepare.sh b/CI/ci-mac-prepare.sh index 39cf1f35..10d11959 100755 --- a/CI/ci-mac-prepare.sh +++ b/CI/ci-mac-prepare.sh @@ -11,9 +11,6 @@ export PATH OPTIONS="" -# set GTEST path -OPTIONS="$OPTIONS -DGTEST_ROOT=~/sw/gtest-1.7.0/" - if [ "$LANGUAGE" == "cpp98" ]; then echo "Building with C++98"; BUILDPATH="cpp98" diff --git a/src/Unittests/CMakeLists.txt b/src/Unittests/CMakeLists.txt index fe8cfbeb..4090f50f 100644 --- a/src/Unittests/CMakeLists.txt +++ b/src/Unittests/CMakeLists.txt @@ -1,194 +1,186 @@ -include (VCICommon) +include(VCICommon) -set( UNITTEST_SRC -unittests.cc -unittests_add_face.cc -unittests_boundary.cc -unittests_centroid_calculations.cc -unittests_convert_meshes.cc -unittests_cpp_11_features.cc -unittests_decimater.cc -unittests_delete_face.cc -unittests_eigen3_type.cc -unittests_faceless_mesh.cc -unittests_mc_decimater.cc -unittests_mesh_cast.cc -unittests_mesh_dual.cc -unittests_mesh_type.cc -unittests_mixed_decimater.cc -unittests_normal_calculations.cc -unittests_polymesh_collapse.cc -unittests_polymesh_vec2i.cc -unittests_property.cc -unittests_propertymanager.cc -unittests_randomNumberGenerator.cc -unittests_read_write_OBJ.cc -unittests_read_write_OFF.cc -unittests_read_write_OM.cc -unittests_read_write_PLY.cc -unittests_read_write_STL.cc -unittests_set_positions_directly.cc -unittests_smart_handles.cc -unittests_smart_ranges.cc -unittests_smarttagger.cc -unittests_smoother.cc -unittests_split_copy.cc -unittests_split_edge_copy.cc -unittests_sr_binary.cc -unittests_stripifier.cc -unittests_subdivider_adaptive.cc -unittests_subdivider_uniform.cc -unittests_traits.cc -unittests_trimesh_circulator_current_halfedge_handle_replacement.cc -unittests_trimesh_circulator_edge_face.cc -unittests_trimesh_circulator_edge_halfedge.cc -unittests_trimesh_circulator_edge_vertex.cc -unittests_trimesh_circulator_face_edge.cc -unittests_trimesh_circulator_face_face.cc -unittests_trimesh_circulator_face_halfedge.cc -unittests_trimesh_circulator_face_vertex.cc -unittests_trimesh_circulator_halfedge_loop.cc -unittests_trimesh_circulator_vertex_edge.cc -unittests_trimesh_circulator_vertex_face.cc -unittests_trimesh_circulator_vertex_ihalfedge.cc -unittests_trimesh_circulator_vertex_ohalfedge.cc -unittests_trimesh_circulator_vertex_vertex.cc -unittests_trimesh_collapse.cc -unittests_trimesh_garbage_collection.cc -unittests_trimesh_iterators.cc -unittests_trimesh_navigation.cc -unittests_trimesh_others.cc -unittests_trimesh_ranges.cc -unittests_trimesh_split.cc -unittests_trimesh_vec2i.cc -unittests_tutorials.cc -unittests_vdpm.cc -unittests_vector_type.cc +set(UNITTEST_SRC + unittests.cc + unittests_add_face.cc + unittests_boundary.cc + unittests_centroid_calculations.cc + unittests_convert_meshes.cc + unittests_cpp_11_features.cc + unittests_decimater.cc + unittests_delete_face.cc + unittests_eigen3_type.cc + unittests_faceless_mesh.cc + unittests_mc_decimater.cc + unittests_mesh_cast.cc + unittests_mesh_dual.cc + unittests_mesh_type.cc + unittests_mixed_decimater.cc + unittests_normal_calculations.cc + unittests_polymesh_collapse.cc + unittests_polymesh_vec2i.cc + unittests_property.cc + unittests_propertymanager.cc + unittests_randomNumberGenerator.cc + unittests_read_write_OBJ.cc + unittests_read_write_OFF.cc + unittests_read_write_OM.cc + unittests_read_write_PLY.cc + unittests_read_write_STL.cc + unittests_set_positions_directly.cc + unittests_smart_handles.cc + unittests_smart_ranges.cc + unittests_smarttagger.cc + unittests_smoother.cc + unittests_split_copy.cc + unittests_split_edge_copy.cc + unittests_sr_binary.cc + unittests_stripifier.cc + unittests_subdivider_adaptive.cc + unittests_subdivider_uniform.cc + unittests_traits.cc + unittests_trimesh_circulator_current_halfedge_handle_replacement.cc + unittests_trimesh_circulator_edge_face.cc + unittests_trimesh_circulator_edge_halfedge.cc + unittests_trimesh_circulator_edge_vertex.cc + unittests_trimesh_circulator_face_edge.cc + unittests_trimesh_circulator_face_face.cc + unittests_trimesh_circulator_face_halfedge.cc + unittests_trimesh_circulator_face_vertex.cc + unittests_trimesh_circulator_halfedge_loop.cc + unittests_trimesh_circulator_vertex_edge.cc + unittests_trimesh_circulator_vertex_face.cc + unittests_trimesh_circulator_vertex_ihalfedge.cc + unittests_trimesh_circulator_vertex_ohalfedge.cc + unittests_trimesh_circulator_vertex_vertex.cc + unittests_trimesh_collapse.cc + unittests_trimesh_garbage_collection.cc + unittests_trimesh_iterators.cc + unittests_trimesh_navigation.cc + unittests_trimesh_others.cc + unittests_trimesh_ranges.cc + unittests_trimesh_split.cc + unittests_trimesh_vec2i.cc + unittests_tutorials.cc + unittests_vdpm.cc + unittests_vector_type.cc ) - - -if ( NOT DEFINED OPENMESH_BUILD_UNIT_TESTS) - set( OPENMESH_BUILD_UNIT_TESTS false CACHE BOOL "Enable or disable unit test builds in OpenMesh." ) +if (NOT DEFINED OPENMESH_BUILD_UNIT_TESTS) + set(OPENMESH_BUILD_UNIT_TESTS false CACHE BOOL "Enable or disable unit test builds in OpenMesh.") endif() -if ( OPENMESH_BUILD_UNIT_TESTS ) - # Search for gtest headers and libraries - find_package(GTest) +if (OPENMESH_BUILD_UNIT_TESTS) + # Fetch Gtest from github + include(FetchContent) + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # v1.14.0 + #FIND_PACKAGE_ARGS NAMES GTest + ) + # For Windows: Prevent overriding the parent project's compiler/linker settings + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(googletest) - if(GTEST_FOUND) + enable_testing() - enable_testing() - - find_package(Eigen3) + find_package(Eigen3) - # Set correct include paths so that the compiler can find the headers - include_directories(${GTEST_INCLUDE_DIRS} ) + # Set correct include paths so that the compiler can find the headers + include_directories(${GTEST_INCLUDE_DIRS}) + # Set additional link directories + link_directories(${GTEST_LIBRARY_DIR}) - # set additional link directories - link_directories(${GTEST_LIBRARY_DIR} ) + if (TARGET Eigen3::Eigen) + add_definitions(-DENABLE_EIGEN3_TEST) + link_libraries(Eigen3::Eigen) + else() + message(WARNING "Eigen3 not found! This will skip the Eigen3 Unittests. You can point cmake to Eigen3 by setting Eigen3_DIR to the cmake files of Eigen3") + endif() - - if (TARGET Eigen3::Eigen) - add_definitions( -DENABLE_EIGEN3_TEST ) - link_libraries(Eigen3::Eigen) - else() - message(WARNING "Eigen3 not found! This will skip the Eigen3 Unittests. You can point cmake to Eigen3 by setting Eigen3_DIR to the cmake files of Eigen3") + # Create new target named unittests_hexmeshing + # Create unittest executable + vci_add_executable(unittests ${UNITTEST_SRC}) + vci_add_executable(unittests_customvec ${UNITTEST_SRC}) + vci_add_executable(unittests_doublevec ${UNITTEST_SRC}) + target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS) + target_compile_definitions(unittests_doublevec PRIVATE TEST_DOUBLE_TRAITS) + + # For the unittest we don't want the install rpath as set by vci_add_executable + set_target_properties(unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0) + set_target_properties(unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0) + set_target_properties(unittests_doublevec PROPERTIES BUILD_WITH_INSTALL_RPATH 0) + + # Set output directory to ${BINARY_DIR}/Unittests + set(OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests") + set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) + set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) + set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) + foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${CONFIG} UPCONFIG) + set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) + set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) + set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) + endforeach () + + if (NOT WIN32) + # Link against all necessary libraries + target_link_libraries(unittests OpenMeshCore OpenMeshTools GTest::gtest GTest::gtest_main pthread) + target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools GTest::gtest GTest::gtest_main pthread) + target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools GTest::gtest GTest::gtest_main pthread) + else() + # Link against all necessary libraries + target_link_libraries(unittests OpenMeshCore OpenMeshTools GTest::gtest GTest::gtest_main) + target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools GTest::gtest GTest::gtest_main) + target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools GTest::gtest GTest::gtest_main) + + if (OPENMESH_BUILD_SHARED) + add_definitions(-DOPENMESHDLL) endif() + endif() - # Create new target named unittests_hexmeshing - # Create unittest executable - vci_add_executable(unittests ${UNITTEST_SRC}) - vci_add_executable(unittests_customvec ${UNITTEST_SRC}) - vci_add_executable(unittests_doublevec ${UNITTEST_SRC}) - target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS) - target_compile_definitions(unittests_doublevec PRIVATE TEST_DOUBLE_TRAITS) - - # For the unittest we don't want the install rpath as set by vci_add_executable - set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) - set_target_properties ( unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) - set_target_properties ( unittests_doublevec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) + if (NOT WIN32) + # Set compiler flags + set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") + set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") + set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") + else() + # Set compiler flags + set_target_properties(unittests PROPERTIES COMPILE_FLAGS "") + set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "") + set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "") + endif() - # Set output directory to ${BINARY_DIR}/Unittests - set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests") - set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) - set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) - set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) - foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES}) - string(TOUPPER ${CONFIG} UPCONFIG) - set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) - set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) - set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) - endforeach() + if (OPENMESH_BUILD_SHARED) + # Copy dlls to unittests + SET(OPENMESH_TARGETS "OpenMeshTools" "OpenMeshCore") - - if ( NOT WIN32) - # Link against all necessary libraries - target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) - target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) - target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) - - - - else() - # Link against all necessary libraries - if ( OPENMESH_BUILD_SHARED ) - add_definitions( -DOPENMESHDLL ) + foreach (TAR ${OPENMESH_TARGETS}) + add_custom_command(TARGET unittests POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "${CMAKE_BINARY_DIR}/Unittests/$" + COMMENT "Copying OpenMesh targets to unittests directory") + add_custom_command(TARGET unittests_customvec POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "${CMAKE_BINARY_DIR}/Unittests/$" + COMMENT "Copying OpenMesh targets to unittests directory") + add_custom_command(TARGET unittests_doublevec POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "${CMAKE_BINARY_DIR}/Unittests/$" + COMMENT "Copying OpenMesh targets to unittests directory") + endforeach (TAR) + endif() - endif() - target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) - target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) - target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) - endif() - + vci_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) + vci_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) + vci_copy_after_build(unittests_doublevec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) - - if ( NOT WIN32 ) - # Set compiler flags - set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") - set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") - set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") - else() - # Set compiler flags - set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" ) - set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "" ) - set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "" ) - endif() - - if ( OPENMESH_BUILD_SHARED ) - - #-------- copy dlls to unittests -------- - SET(OPENMESH_TARGETS "OpenMeshTools" "OpenMeshCore") - - foreach(TAR ${OPENMESH_TARGETS} ) - add_custom_command(TARGET unittests POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "$" - "${CMAKE_BINARY_DIR}/Unittests/$" - COMMENT "Copying OpenMesh targets to unittests directory") - add_custom_command(TARGET unittests_customvec POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "$" - "${CMAKE_BINARY_DIR}/Unittests/$" - COMMENT "Copying OpenMesh targets to unittests directory") - add_custom_command(TARGET unittests_doublevec POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "$" - "${CMAKE_BINARY_DIR}/Unittests/$" - COMMENT "Copying OpenMesh targets to unittests directory") - endforeach(TAR) - endif() - - vci_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) - vci_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) - vci_copy_after_build(unittests_doublevec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) - - add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests") - add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec") - add_test(NAME AllTestsIn_OpenMesh_tests_with_double_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_doublevec") - - else(GTEST_FOUND) - message(STATUS "Google testing framework was not found, unittests disabled.") - endif(GTEST_FOUND) + add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests") + add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec") + add_test(NAME AllTestsIn_OpenMesh_tests_with_double_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_doublevec") endif() diff --git a/src/Unittests/unittests_property.cc b/src/Unittests/unittests_property.cc index f9b0b45c..abb48151 100644 --- a/src/Unittests/unittests_property.cc +++ b/src/Unittests/unittests_property.cc @@ -749,7 +749,7 @@ TEST_F(OpenMeshProperties, PropertyIterators ) { TEST_F(OpenMeshProperties, MeshAssignment ) { mesh_.clear(); - mesh_.add_vertex(Mesh::Point()); + mesh_.add_vertex(Mesh::Point(0, 0, 0)); auto copy = mesh_; diff --git a/src/Unittests/unittests_set_positions_directly.cc b/src/Unittests/unittests_set_positions_directly.cc index d3656243..a5a2dfa1 100644 --- a/src/Unittests/unittests_set_positions_directly.cc +++ b/src/Unittests/unittests_set_positions_directly.cc @@ -49,15 +49,11 @@ TEST_F(OpenMeshDirectSettingProperties, SetVertexPositionsDirectly) { auto point_vector = mesh_.property(pos_pro).data_vector(); - int vertex_count = 0; - for( auto p : point_vector) { -// std::cerr << p[0] << " " << p[1] << " " << p[2] << std::endl; - ++vertex_count; - } + auto vertex_count = point_vector.size(); EXPECT_EQ(4u, mesh_.n_vertices() ) << "Wrong number of vertices"; - EXPECT_EQ(4, vertex_count) << "Wrong number of vertices when counting direct point property vector"; + EXPECT_EQ(4u, vertex_count) << "Wrong number of vertices when counting direct point property vector"; }