Browse Source

Merge pull request #2716 from 1vanK/master

Simplify Bullet/CMakeLists.txt
1vanK 5 years ago
parent
commit
4d4030e3ca

+ 1 - 1
Docs/GettingStarted.dox

@@ -111,7 +111,7 @@ A number of build options can be defined when invoking the build scripts or when
 |URHO3D_64BIT         |*|Enable 64-bit build, the default is set based on the native ABI of the chosen compiler toolchain|
 |URHO3D_ANGELSCRIPT   |1|Enable AngelScript scripting support|
 |URHO3D_LUA           |1|Enable Lua scripting support|
-|URHO3D_LUAJIT        |0|Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)|
+|URHO3D_LUAJIT        |1|Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)|
 |URHO3D_LUAJIT_AMALG  |*|Enable LuaJIT amalgamated build (LuaJIT only); default to true when LuaJIT is enabled|
 |URHO3D_SAFE_LUA      |0|Enable Lua C++ wrapper safety checks (Lua/LuaJIT only)|
 |URHO3D_LUA_RAW_SCRIPT_LOADER  |0|Prefer loading raw script files from the file system before falling back on Urho3D resource cache. Useful for debugging (e.g. breakpoints), but less performant (Lua/LuaJIT only)|

+ 10 - 18
Source/ThirdParty/Bullet/CMakeLists.txt

@@ -23,27 +23,19 @@
 # Define target name
 set (TARGET_NAME Bullet)
 
-# Workaround for MinGW 6.1.0 and above where it throws ICE (internal compilation error) when -O3 is used
-if (MINGW AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.1.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.1.0))  # 6.1.0 is the last known bad version
-    string (REPLACE -O3 -O2 CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+# Define preprocessor macros
+if (BT_USE_DOUBLE_PRECISION)
+    add_definitions (-DBT_USE_DOUBLE_PRECISION)
+endif ()
+if (BT_THREADSAFE)
+    add_definitions (-DBT_THREADSAFE=1)
+endif ()
+if (BT_USE_OPENMP)
+    add_definitions (-DBT_USE_OPENMP=1)
 endif ()
 
 # Define source files
-file (GLOB CPP_FILES src/BulletCollision/BroadphaseCollision/*.cpp
-    src/BulletCollision/CollisionDispatch/*.cpp src/BulletCollision/CollisionShapes/*.cpp
-    src/BulletCollision/Gimpact/*.cpp src/BulletCollision/NarrowPhaseCollision/*.cpp
-    src/BulletDynamics/Character/*.cpp src/BulletDynamics/ConstraintSolver/*.cpp
-    src/BulletDynamics/Dynamics/*.cpp src/BulletDynamics/Featherstone/*.cpp
-    src/BulletDynamics/MLCPSolvers/*.cpp src/BulletDynamics/Vehicle/*.cpp src/BulletSoftBody/*.cpp
-    src/LinearMath/*.cpp)
-file (GLOB H_FILES *.h src/BulletCollision/BroadphaseCollision/*.h
-    src/BulletCollision/CollisionDispatch/*.h src/BulletCollision/CollisionShapes/*.h
-    src/BulletCollision/Gimpact/*.h src/BulletCollision/NarrowPhaseCollision/*.h
-    src/BulletDynamics/Character/*.h src/BulletDynamics/ConstraintSolver/*.h
-    src/BulletDynamics/Dynamics/*.h src/BulletDynamics/Featherstone/*.h
-    src/BulletDynamics/MLCPSolvers/*.h src/BulletDynamics/Vehicle/*.h src/BulletSoftBody/*.h
-    src/LinearMath/*.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
+define_source_files (RECURSE GLOB_CPP_PATTERNS src/*.cpp GLOB_H_PATTERNS src/*.h src/*.hpp)
 
 # Define dependency libs
 set (INCLUDE_DIRS src)

+ 19 - 15
Source/Urho3D/Graphics/CustomGeometry.cpp

@@ -208,7 +208,8 @@ Vector<Vector3> CustomGeometry::GetCircleShape(float radius, size_t iterations,
 {
     float stepSize = (endTheta - startTheta) / (float)iterations;
     Vector<Vector3> shapeList;
-    for (int i = 0; i < iterations; i++) {
+    for (int i = 0; i < iterations; i++)
+    {
         float curTheta1 = startTheta + ((float)i * stepSize);
         float curTheta2 = startTheta + ((float)(i+1) * stepSize);
         float curX1 = radius * cos(curTheta1);
@@ -219,14 +220,14 @@ Vector<Vector3> CustomGeometry::GetCircleShape(float radius, size_t iterations,
         shapeList.Push(Urho3D::Vector3(curX1, 0, curY1));
         shapeList.Push(Urho3D::Vector3(curX2, 0, curY2));
 
-        if (i >= iterations - 1) {
-            float curTheta =0;
-            if (Abs(endTheta - startTheta) < (2*M_PI)) {
+        if (i >= iterations - 1)
+        {
+            float curTheta = 0;
+            if (Abs(endTheta - startTheta) < (2*M_PI))
                 curTheta = endTheta;
-            }
             float curX = radius * cos(curTheta);
             float curY = radius * sin(curTheta);
-            shapeList.Push(Urho3D::Vector3(curX, 0, curY));
+            shapeList.Push(Vector3(curX, 0, curY));
         }
     }
     return shapeList;
@@ -249,11 +250,13 @@ void CustomGeometry::MakeCircle(float radius, size_t iterations, float startThet
 void CustomGeometry::MakeCircleGraph(const Vector<Pair<float, Urho3D::SharedPtr<Urho3D::Material> > >& parts,
     int radius, int iterations)
 {
-    if (parts.Size() > 0) {
+    if (parts.Size() > 0)
+    {
         float totalWeight = 0;
         SetNumGeometries(parts.Size());
         auto it = parts.Begin();
-        while (it != parts.End()) {
+        while (it != parts.End())
+        {
             const auto current = (*it);
             totalWeight += current.first_;
             it++;
@@ -263,13 +266,13 @@ void CustomGeometry::MakeCircleGraph(const Vector<Pair<float, Urho3D::SharedPtr<
         float currentStartTheta = 0;
         float currentEndTheta = 0;
         int count = 0;
-        while (it != parts.End()) {
+        while (it != parts.End())
+        {
             const auto current = (*it);
             currentEndTheta = ((current.first_ / totalWeight)*(2 * M_PI)) + currentStartTheta;
             MakeCircle(radius, (iterations / parts.Size()), currentStartTheta, currentEndTheta,false,count);
-            if (current.second_.NotNull()) {
+            if (current.second_.NotNull())
                 SetMaterial(count, current.second_);
-            }
             it++;
             count++;
             currentStartTheta = currentEndTheta;
@@ -284,13 +287,14 @@ void CustomGeometry::MakeShape(const Vector<Vector3>& pointList , bool connectTa
     BeginGeometry(0, Urho3D::PrimitiveType::LINE_STRIP);
     Vector3 current;
     Vector3 next;
-    for (size_t i = 0; i < pointList.Size(); i++) {
-        if ((connectTail && i >= pointList.Size() - 1) || i < pointList.Size() - 1) {
+    for (size_t i = 0; i < pointList.Size(); i++)
+    {
+        if ((connectTail && i >= pointList.Size() - 1) || i < pointList.Size() - 1)
+        {
             current = pointList[i];
             next = pointList[0];
-            if (i < pointList.Size() - 1) {
+            if (i < pointList.Size() - 1)
                 next = pointList[i + 1];
-            }
             DefineVertex(current);
             DefineVertex(next);
         }