Skip to content

Commit 414ddac

Browse files
committed
- bugfixes
1 parent 70c493c commit 414ddac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+387
-328
lines changed

CMake/Common.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ set(CMAKE_MINSIZEREL_POSTFIX "_ms")
1010

1111
if (WIN32)
1212
set(CMAKE_USE_RELATIVE_PATHS "1")
13-
# Set compiler flags for "release"
14-
set(CMAKE_CXX_FLAGS_RELEASE "/MD /EHsc /Ox /Ob2 /Oi /Ot /GL /D NDEBUG /openmp" CACHE STRING "Flags used by the compiler during release builds." FORCE)
15-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /EHsc" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
16-
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG")
17-
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG")
18-
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG")
13+
# Set compiler flags
14+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP")
15+
set(CMAKE_CXX_FLAGS_RELEASE "/MD /MP /Ox /Ob2 /Oi /Ot /D NDEBUG /openmp")
16+
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO")
17+
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO")
18+
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO")
1919
endif (WIN32)
2020

2121
if (UNIX)

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@ else()
1616
subdirs(extern/AntTweakBar extern/glew Demos PositionBasedDynamics)
1717
endif()
1818

19+
install(DIRECTORY ./Common
20+
DESTINATION include
21+
FILES_MATCHING PATTERN "*.h")
1922

23+
install(DIRECTORY ./data
24+
DESTINATION include
25+
FILES_MATCHING PATTERN "*.glsl")
2026

Common/Common.h

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
#define COMMON_H
33

44
#include <Eigen/Dense>
5+
#include "float.h"
56

67
#define USE_DOUBLE
8+
#define MIN_PARALLEL_SIZE 64
79

810
#ifdef USE_DOUBLE
911
typedef double Real;
@@ -44,6 +46,7 @@ namespace PBD
4446

4547
#if EIGEN_ALIGN
4648
#define PDB_MAKE_ALIGNED_OPERATOR_NEW EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49+
#define REPORT_MEMORY_LEAKS
4750

4851
#if defined(WIN32) || defined(_WIN32) || defined(WIN64)
4952
#ifdef _DEBUG
@@ -57,19 +60,42 @@ namespace PBD
5760
void *operator new[](size_t size, int const block_use, char const* file_name, int const line_number) { \
5861
return operator new(size, block_use, file_name, line_number); \
5962
}\
60-
void operator delete(void* block, int const block_use, char const* file_name, int const line_number) noexcept { \
63+
void operator delete(void* block, int const block_use, char const* file_name, int const line_number) { \
6164
\
6265
return _aligned_free_dbg(block); \
6366
} \
64-
void operator delete[](void* block, int const block_use, char const* file_name, int const line_number) noexcept { \
67+
void operator delete[](void* block, int const block_use, char const* file_name, int const line_number) { \
6568
return operator delete(block, block_use, file_name, line_number); \
6669
}
67-
6870
#endif
6971
#endif
7072
#else
71-
#define PDB_MAKE_ALIGNED_OPERATOR_NEW
73+
#define PBD_MAKE_ALIGNED_OPERATOR_NEW
74+
75+
#if defined(WIN32) || defined(_WIN32) || defined(WIN64)
76+
// Enable memory leak detection
77+
#ifdef _DEBUG
78+
#define _CRTDBG_MAP_ALLOC
79+
#include <stdlib.h>
80+
#include <crtdbg.h>
81+
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
82+
#define REPORT_MEMORY_LEAKS _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
83+
#else
84+
#define REPORT_MEMORY_LEAKS
85+
#endif
86+
#else
87+
#define REPORT_MEMORY_LEAKS
88+
#endif
89+
7290
#endif
7391
}
7492

7593
#endif
94+
95+
#if defined(WIN32) || defined(_WIN32) || defined(WIN64)
96+
#define FORCE_INLINE __forceinline
97+
#else
98+
#define FORCE_INLINE __attribute__((always_inline))
99+
#endif
100+
101+

Demos/BarDemo/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation)
2-
set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation)
1+
set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation Utils)
2+
set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation Utils)
33

44
if(WIN32)
55
set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES})
@@ -20,15 +20,6 @@ add_executable(BarDemo
2020

2121
${VIS_FILES}
2222
${PROJECT_PATH}/Common/Common.h
23-
${PROJECT_PATH}/Demos/Common/Config.h
24-
${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp
25-
${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h
26-
${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp
27-
${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h
28-
${PROJECT_PATH}/Demos/Utils/Utilities.cpp
29-
${PROJECT_PATH}/Demos/Utils/Utilities.h
30-
${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp
31-
${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h
3223

3324
CMakeLists.txt
3425
)

Demos/BarDemo/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "Demos/Common/Config.h"
1+
#include "Common/Common.h"
22
#include "Demos/Visualization/MiniGL.h"
33
#include "Demos/Visualization/Selection.h"
44
#include "GL/glut.h"
@@ -11,7 +11,7 @@
1111
#include "Demos/Utils/Utilities.h"
1212

1313
// Enable memory leak detection
14-
#ifdef _DEBUG
14+
#if defined(_DEBUG) && !defined(EIGEN_ALIGN)
1515
#define new DEBUG_NEW
1616
#endif
1717

Demos/CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
include(Visualization/CMakeLists.txt)
22
add_definitions(-DPBD_DATA_PATH="../data")
33

4-
subdirs(Simulation BarDemo ClothDemo PositionBasedElasticRodsDemo DistanceFieldDemos FluidDemo RigidBodyDemos CouplingDemos GenericConstraintsDemos SceneLoaderDemo)
4+
# search all demos
5+
file (
6+
GLOB _demo_dirs
7+
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
8+
"${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt"
9+
)
510

11+
foreach (_demo_dir ${_demo_dirs})
12+
get_filename_component (_demo_name ${_demo_dir} PATH)
13+
option(Build_${_demo_name} "Build ${_demo_name}" ON)
14+
if (Build_${_demo_name})
15+
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/${_demo_name})
16+
endif (Build_${_demo_name})
17+
endforeach ()
18+
19+
install(DIRECTORY ./Common
20+
DESTINATION include/Demos
21+
FILES_MATCHING PATTERN "*.h")
22+
23+
install(DIRECTORY ./Visualization
24+
DESTINATION include/Demos
25+
FILES_MATCHING PATTERN "*.h")

Demos/ClothDemo/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation)
2-
set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation)
1+
set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation Utils)
2+
set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation Utils)
33

44
if(WIN32)
55
set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES})
@@ -20,15 +20,6 @@ add_executable(ClothDemo
2020

2121
${VIS_FILES}
2222
${PROJECT_PATH}/Common/Common.h
23-
${PROJECT_PATH}/Demos/Common/Config.h
24-
${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp
25-
${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h
26-
${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp
27-
${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h
28-
${PROJECT_PATH}/Demos/Utils/Utilities.cpp
29-
${PROJECT_PATH}/Demos/Utils/Utilities.h
30-
${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp
31-
${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h
3223

3324
CMakeLists.txt
3425
)

Demos/ClothDemo/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "Demos/Common/Config.h"
1+
#include "Common/Common.h"
22
#include "Demos/Visualization/MiniGL.h"
33
#include "Demos/Visualization/Selection.h"
44
#include "GL/glut.h"
@@ -11,7 +11,7 @@
1111
#include "Demos/Utils/Utilities.h"
1212

1313
// Enable memory leak detection
14-
#ifdef _DEBUG
14+
#if defined(_DEBUG) && !defined(EIGEN_ALIGN)
1515
#define new DEBUG_NEW
1616
#endif
1717

Demos/CouplingDemos/CMakeLists.txt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation)
2-
set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation)
1+
set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation Utils)
2+
set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation Utils)
33

44
if(WIN32)
55
set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES})
@@ -20,17 +20,6 @@ add_executable(RigidBodyClothCouplingDemo
2020

2121
${VIS_FILES}
2222
${PROJECT_PATH}/Common/Common.h
23-
${PROJECT_PATH}/Demos/Common/Config.h
24-
${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp
25-
${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h
26-
${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp
27-
${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h
28-
${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp
29-
${PROJECT_PATH}/Demos/Utils/OBJLoader.h
30-
${PROJECT_PATH}/Demos/Utils/Utilities.cpp
31-
${PROJECT_PATH}/Demos/Utils/Utilities.h
32-
${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp
33-
${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h
3423

3524
CMakeLists.txt
3625
)

Demos/CouplingDemos/RigidBodyClothCouplingDemo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "Demos/Common/Config.h"
1+
#include "Common/Common.h"
22
#include "Demos/Visualization/MiniGL.h"
33
#include "Demos/Visualization/Selection.h"
44
#include "GL/glut.h"
@@ -16,7 +16,7 @@
1616
#include "math.h"
1717

1818
// Enable memory leak detection
19-
#ifdef _DEBUG
19+
#if defined(_DEBUG) && !defined(EIGEN_ALIGN)
2020
#define new DEBUG_NEW
2121
#endif
2222

0 commit comments

Comments
 (0)