Skip to content

Commit

Permalink
Replace cppunit with the googletest framework
Browse files Browse the repository at this point in the history
The GTest framework has a more active support base, and natively
supports CMake. Introduce it as an external dependency (using CMake's
ExternalProject_Add), replacing cppunit and porting the associated unit
tests.
  • Loading branch information
jdduke committed Sep 7, 2014
1 parent a51a0b3 commit 66e608a
Show file tree
Hide file tree
Showing 272 changed files with 909 additions and 81,850 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
before_install:
- sudo apt-get install cmake libcppunit-dev python3
- sudo apt-get install cmake python3

env:
- TRAVIS_NO_EXPORT=YES
Expand Down
64 changes: 64 additions & 0 deletions cmake-modules/AddGTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
find_package(Threads REQUIRED)
include(ExternalProject)

if(MSYS OR MINGW)
set(DISABLE_PTHREADS ON)
else()
set(DISABLE_PTHREADS OFF)
endif()

if (MSVC)
set(RELEASE_LIB_DIR ReleaseLibs)
set(DEBUG_LIB_DIR DebugLibs)
else()
set(RELEASE_LIB_DIR "")
set(DEBUG_LIB_DIR "")
endif()

set(GTEST_CMAKE_ARGS
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-Dgtest_force_shared_crt=ON"
"-Dgtest_disable_pthreads:BOOL=${DISABLE_PTHREADS}")
set(GTEST_RELEASE_LIB_DIR "")
set(GTEST_DEBUGLIB_DIR "")
if (MSVC)
set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS}
"-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=${DEBUG_LIB_DIR}"
"-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=${RELEASE_LIB_DIR}")
set(GTEST_LIB_DIR)
endif()

set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gtest")

ExternalProject_Add(gtest
GIT_REPOSITORY https://chromium.googlesource.com/external/googletest
TIMEOUT 10
PREFIX "${GTEST_PREFIX}"
CMAKE_ARGS "${GTEST_CMAKE_ARGS}"
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
# Disable install
INSTALL_COMMAND ""
)

set(LIB_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}")
set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build")
set(GTEST_DEBUG_LIBRARIES
"${GTEST_LOCATION}/${DEBUG_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}")
SET(GTEST_RELEASE_LIBRARIES
"${GTEST_LOCATION}/${RELEASE_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}")

if(MSVC_VERSION EQUAL 1700)
add_definitions(-D_VARIADIC_MAX=10)
endif()

ExternalProject_Get_Property(gtest source_dir)
include_directories(${source_dir}/include)
include_directories(${source_dir}/gtest/include)

ExternalProject_Get_Property(gtest binary_dir)
link_directories(${binary_dir})
3 changes: 3 additions & 0 deletions code/AssbinExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# include "../contrib/zlib/zlib.h"
#endif

#include <time.h>


#ifndef ASSIMP_BUILD_NO_EXPORT
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER

Expand Down
2 changes: 2 additions & 0 deletions code/AssxmlExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# include "../contrib/zlib/zlib.h"
#endif

#include <time.h>

#ifndef ASSIMP_BUILD_NO_EXPORT
#ifndef ASSIMP_BUILD_NO_ASSXML_EXPORTER

Expand Down
2 changes: 0 additions & 2 deletions code/JoinVerticesProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp
{

class JoinVerticesTest;

// ---------------------------------------------------------------------------
/** The JoinVerticesProcess unites identical vertices in all imported meshes.
* By default the importer returns meshes where each face addressed its own
Expand Down
8 changes: 3 additions & 5 deletions code/ScenePreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ void ScenePreprocessor::ProcessMesh (aiMesh* mesh)
{
// If aiMesh::mNumUVComponents is *not* set assign the default value of 2
for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
if (!mesh->mTextureCoords[i])
if (!mesh->mTextureCoords[i]) {
mesh->mNumUVComponents[i] = 0;

else {
if( !mesh->mNumUVComponents[i])
} else {
if (!mesh->mNumUVComponents[i])
mesh->mNumUVComponents[i] = 2;

aiVector3D* p = mesh->mTextureCoords[i], *end = p+mesh->mNumVertices;
Expand All @@ -112,7 +111,6 @@ void ScenePreprocessor::ProcessMesh (aiMesh* mesh)
p->z = p->y = 0.f;
}
else if (3 == mesh->mNumUVComponents[i]) {

// Really 3D coordinates? Check whether the third coordinate is != 0 for at least one element
for (; p != end; ++p) {
if (p->z != 0)
Expand Down
6 changes: 0 additions & 6 deletions contrib/cppunit-1.12.1/AUTHORS

This file was deleted.

6 changes: 0 additions & 6 deletions contrib/cppunit-1.12.1/BUGS

This file was deleted.

Loading

0 comments on commit 66e608a

Please sign in to comment.