Commit 0883910aec403a6fdf286b699f82012ca6a9554a

Authored by Jostein Bratlie
0 parents

Initial commit to the collision library stub template repository.

.clang-format 0 → 100644
  1 +++ a/.clang-format
  1 +---
  2 +Language: Cpp
  3 +# BasedOnStyle: LLVM
  4 +AccessModifierOffset: -4
  5 +AlignAfterOpenBracket: Align
  6 +AlignConsecutiveAssignments: true
  7 +AlignConsecutiveDeclarations: true
  8 +AlignEscapedNewlinesLeft: false
  9 +AlignOperands: true
  10 +AlignTrailingComments: true
  11 +AllowAllParametersOfDeclarationOnNextLine: true
  12 +AllowShortBlocksOnASingleLine: false
  13 +AllowShortCaseLabelsOnASingleLine: false
  14 +AllowShortFunctionsOnASingleLine: All
  15 +AllowShortIfStatementsOnASingleLine: true
  16 +AllowShortLoopsOnASingleLine: true
  17 +AlwaysBreakAfterDefinitionReturnType: None
  18 +AlwaysBreakAfterReturnType: None
  19 +AlwaysBreakBeforeMultilineStrings: false
  20 +AlwaysBreakTemplateDeclarations: true
  21 +BinPackArguments: true
  22 +BinPackParameters: true
  23 +BraceWrapping:
  24 + AfterClass: false
  25 + AfterControlStatement: false
  26 + AfterEnum: false
  27 + AfterFunction: true
  28 + AfterNamespace: true
  29 + AfterObjCDeclaration: false
  30 + AfterStruct: false
  31 + AfterUnion: false
  32 + BeforeCatch: true
  33 + BeforeElse: true
  34 + IndentBraces: false
  35 +BreakBeforeBinaryOperators: All
  36 +BreakBeforeBraces: Custom
  37 +BreakBeforeTernaryOperators: true
  38 +BreakConstructorInitializersBeforeComma: false
  39 +ColumnLimit: 80
  40 +#CommentPragmas: '^ IWYU pragma:'
  41 +ConstructorInitializerAllOnOneLineOrOnePerLine: false
  42 +ConstructorInitializerIndentWidth: 4
  43 +ContinuationIndentWidth: 4
  44 +Cpp11BracedListStyle: true
  45 +DerivePointerAlignment: false
  46 +DisableFormat: false
  47 +ExperimentalAutoDetectBinPacking: false
  48 +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
  49 +#IncludeCategories:
  50 +# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
  51 +# Priority: 2
  52 +# - Regex: '^(<|"(gtest|isl|json)/)'
  53 +# Priority: 3
  54 +# - Regex: '.*'
  55 +# Priority: 1
  56 +IndentCaseLabels: true
  57 +IndentWidth: 4
  58 +IndentWrappedFunctionNames: false
  59 +KeepEmptyLinesAtTheStartOfBlocks: true
  60 +MacroBlockBegin: ''
  61 +MacroBlockEnd: ''
  62 +MaxEmptyLinesToKeep: 3
  63 +NamespaceIndentation: All
  64 +ObjCBlockIndentWidth: 4
  65 +ObjCSpaceAfterProperty: false
  66 +ObjCSpaceBeforeProtocolList: true
  67 +PenaltyBreakBeforeFirstCallParameter: 19
  68 +PenaltyBreakComment: 300
  69 +PenaltyBreakFirstLessLess: 120
  70 +PenaltyBreakString: 1000
  71 +PenaltyExcessCharacter: 1000000
  72 +PenaltyReturnTypeOnItsOwnLine: 60
  73 +PointerAlignment: Left
  74 +ReflowComments: true
  75 +SortIncludes: false
  76 +SpaceAfterCStyleCast: false
  77 +SpaceBeforeAssignmentOperators: true
  78 +SpaceBeforeParens: Always
  79 +SpaceInEmptyParentheses: false
  80 +SpacesBeforeTrailingComments: 1
  81 +SpacesInAngles: false
  82 +SpacesInContainerLiterals: true
  83 +SpacesInCStyleCastParentheses: false
  84 +SpacesInParentheses: false
  85 +SpacesInSquareBrackets: false
  86 +Standard: Auto
  87 +TabWidth: 4
  88 +UseTab: Never
  89 +...
  90 +
... ...
.gitignore 0 → 100644
  1 +++ a/.gitignore
  1 +# Various temp file schemes
  2 +*~
  3 +*.save
  4 +*.back
  5 +*.backup
  6 +*.autosave
  7 +*.swp
  8 +
  9 +# Qt Creator files
  10 +*.user*
  11 +
  12 +# CMake in-source build
  13 +CMakeCache.txt
  14 +cmake_install.cmake
  15 +CMakeFiles/
  16 +*.o
  17 +*.a
  18 +*.lib
  19 +*.so
  20 +*.obj
  21 +*.moc
  22 +
  23 +# Build folders
  24 +build/
  25 +BUILD/
... ...
CMakeLists.txt 0 → 100644
  1 +++ a/CMakeLists.txt
  1 +# Minimum CMake version required
  2 +cmake_minimum_required(VERSION 3.4)
  3 +
  4 +# Nice name for the IDEs
  5 +project(collision_library_stub VERSION 0.1 LANGUAGES CXX)
  6 +
  7 +# Specify compiler features
  8 +set(CMAKE_CXX_STANDARD 14)
  9 +
  10 +# Find GMlib
  11 +find_package(
  12 + GMlib 0.6.9 EXACT
  13 + PATHS ${GMLIB_DIR}
  14 + NO_DEFAULT_PATH
  15 +)
  16 +message( "GMlib_INCLUDE_DIRS: ${GMlib_INCLUDE_DIRS}" )
  17 +message( "GMlib_LINK_DIRS: ${GMlib_LINK_DIRS}" )
  18 +message( "GMlib_DEFINITIONS: ${GMlib_DEFINITIONS}" )
  19 +message( "GMlib_LIBRARIES: ${GMlib_LIBRARIES}" )
  20 +include_directories( ${GMlib_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS} )
  21 +link_directories( ${GMlib_LINK_DIRS} )
  22 +add_definitions(${GMlib_DEFINITIONS})
  23 +
  24 +message("COLLISION_INTERFACE_INCLUDE_DIR: ${COLLISION_INTERFACE_INCLUDE_DIR}")
  25 +if(NOT COLLISION_INTERFACE_INCLUDE_DIR)
  26 + message( FATAL_ERROR "COLLISION_INTERFACE_INCLUDE_DIR not set")
  27 +endif()
  28 +
  29 +
  30 +include_directories(${COLLISION_INTERFACE_INCLUDE_DIR})
  31 +
  32 +
  33 +set(HDRS include/collision_library.h)
  34 +
  35 +set(SRCS include/collision_library.cpp)
  36 +
  37 +add_library( ${CMAKE_PROJECT_NAME} ${HDRS} ${SRCS} )
  38 +
  39 +
  40 +option( UNITTESTS "Enable building of unittests" OFF )
  41 +if(UNITTESTS)
  42 +
  43 + # Add the interface to the include directories
  44 + include_directories(include)
  45 +
  46 + # GTest
  47 + find_package(GTest)
  48 + if(NOT GTEST_FOUND)
  49 + message(FATAL_ERROR "GTest NOT found: Unittests disabled")
  50 + message(FATAL_ERROR "GTest include dir: ${GTEST_INCLUDE_DIRS}")
  51 + endif(NOT GTEST_FOUND)
  52 +
  53 + include_directories(${GTEST_INCLUDE_DIRS})
  54 + message("GTest include dir: ${GTEST_INCLUDE_DIRS}")
  55 + enable_testing()
  56 +
  57 + # Tests
  58 + set(TESTS
  59 + hello_world
  60 + )
  61 +
  62 + # Create tetst
  63 + foreach(TEST ${TESTS})
  64 + add_executable( ${TEST} ${HDRS} unittests/${TEST}.cc )
  65 + target_link_libraries(${TEST}
  66 + ${CMAKE_PROJECT_NAME}
  67 + ${GMlib_LIBRARIES}
  68 + ${GLEW_LIBRARIES}
  69 + ${OPENGL_LIBRARIES}
  70 + ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
  71 + gtest_add_tests( ${TEST} "" AUTO )
  72 + endforeach(TEST)
  73 +
  74 +endif(UNITTESTS)
... ...
include/collision_library.cpp 0 → 100644
  1 +++ a/include/collision_library.cpp
  1 +#include "collision_library.h"
  2 +
  3 +
  4 +
  5 +namespace collision
  6 +{
  7 +
  8 +
  9 + CollisionState
  10 + detectCollision (const DynamicPhysObject<GMlib::PSphere<float>>& S0,
  11 + const DynamicPhysObject<GMlib::PSphere<float>>& S1,
  12 + seconds_type dt)
  13 + {
  14 + }
  15 +
  16 + CollisionState
  17 + detectCollision (const DynamicPhysObject<GMlib::PSphere<float>>& S,
  18 + const StaticPhysObject<GMlib::PPlane<float>>& P,
  19 + seconds_type dt)
  20 + {
  21 + }
  22 +
  23 +
  24 +
  25 + void
  26 + computeImpactResponse (DynamicPhysObject<GMlib::PSphere<float>>& S0,
  27 + DynamicPhysObject<GMlib::PSphere<float>>& S1,
  28 + seconds_type dt)
  29 + {
  30 + }
  31 +
  32 + void
  33 + computeImpactResponse (DynamicPhysObject<GMlib::PSphere<float>>& S,
  34 + StaticPhysObject<GMlib::PPlane<float>>& P,
  35 + seconds_type dt)
  36 + {
  37 + }
  38 +} // END namespace collision
  39 +
... ...
include/collision_library.h 0 → 100644
  1 +++ a/include/collision_library.h
  1 +#ifndef COLLISION_LIBRARY_H
  2 +#define COLLISION_LIBRARY_H
  3 +
  4 +// collision library interface
  5 +#include <collision_interface.h>
  6 +
  7 +
  8 +
  9 +namespace collision
  10 +{
  11 +
  12 +
  13 +} // END namespace collision
  14 +
  15 +
  16 +
  17 +#endif //COLLISION_LIBRARY_H
... ...
unittests/hello_world.cc 0 → 100644
  1 +++ a/unittests/hello_world.cc
  1 +// gtest
  2 +#include <gtest/gtest.h> // googletest header file
  3 +
  4 +// collib
  5 +#include <collision_library.h>
  6 +using namespace collision;
  7 +
  8 +// gmlib
  9 +#include <gmParametricsModule>
  10 +using namespace GMlib;
  11 +
  12 +// stl
  13 +#include <memory>
  14 +#include <chrono>
  15 +#include <iostream>
  16 +using namespace std::chrono_literals;
  17 +
  18 +
  19 +TEST(MyUniqueTestCategory, MyCategory_UniqueTestName_WhichPasses) {
  20 +
  21 + EXPECT_TRUE(true);
  22 +}
  23 +
  24 +TEST(MyUniqueTestCategory, MyCategory_UniqueTestName_WhichFails) {
  25 +
  26 + EXPECT_FALSE(true);
  27 +}
... ...