12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- diff --git a/CMakeLists.txt b/CMakeLists.txt
- index e0f12eb1e..b4b62d3c0 100644
- --- a/CMakeLists.txt
- +++ b/CMakeLists.txt
- @@ -73,7 +73,8 @@ if(PROJECT_IS_TOP_LEVEL)
- option(BOX2D_PROFILE "Enable profiling with Tracy" OFF)
- option(BOX2D_VALIDATE "Enable heavy validation" ON)
- option(BOX2D_UNIT_TESTS "Build the Box2D unit tests" ON)
- -
- + option(BOX2D_COMPILE_WARNING_AS_ERROR "Compile warnings as errors" OFF)
- +
- if(MSVC AND WIN32)
- # add_compile_options(/fsanitize=address)
- # set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/GS- /Gy /O2 /Oi /Ot")
- diff --git a/shared/CMakeLists.txt b/shared/CMakeLists.txt
- index 9a9e98082..f0c050116 100644
- --- a/shared/CMakeLists.txt
- +++ b/shared/CMakeLists.txt
- @@ -17,6 +17,10 @@ set_target_properties(shared PROPERTIES
- C_STANDARD 17
- )
-
- +if (BOX2D_COMPILE_WARNING_AS_ERROR)
- + set_target_properties(shared PROPERTIES COMPILE_WARNING_AS_ERROR ON)
- +endif()
- +
- target_include_directories(shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
- target_link_libraries(shared PRIVATE box2d)
-
- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
- index 5e08afae0..dbc41b129 100644
- --- a/src/CMakeLists.txt
- +++ b/src/CMakeLists.txt
- @@ -92,12 +92,15 @@ set_target_properties(box2d PROPERTIES
- C_STANDARD 17
- C_STANDARD_REQUIRED YES
- C_EXTENSIONS YES
- - COMPILE_WARNING_AS_ERROR ON
- VERSION ${PROJECT_VERSION}
- SOVERSION ${PROJECT_VERSION_MAJOR}
- DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}
- )
-
- +if (BOX2D_COMPILE_WARNING_AS_ERROR)
- + set_target_properties(box2d PROPERTIES COMPILE_WARNING_AS_ERROR ON)
- +endif()
- +
- if (BOX2D_PROFILE)
- target_compile_definitions(box2d PRIVATE BOX2D_PROFILE)
-
- @@ -160,15 +163,15 @@ elseif (MINGW)
- endif()
- elseif (APPLE)
- message(STATUS "Box2D on Apple")
- - target_compile_options(box2d PRIVATE -Wmissing-prototypes -Wall -Wextra -pedantic -Werror)
- + target_compile_options(box2d PRIVATE -Wmissing-prototypes -Wall -Wextra -pedantic)
- elseif (EMSCRIPTEN)
- message(STATUS "Box2D on Emscripten")
- - if (BOX2D_DISABLE_SIMD OFF)
- + if (NOT BOX2D_DISABLE_SIMD)
- target_compile_options(box2d PRIVATE -msimd128 -msse2)
- endif()
- elseif (UNIX)
- message(STATUS "Box2D using Unix")
- - target_compile_options(box2d PRIVATE -Wmissing-prototypes -Wall -Wextra -pedantic -Werror -Wno-unused-value)
- + target_compile_options(box2d PRIVATE -Wmissing-prototypes -Wall -Wextra -pedantic -Wno-unused-value)
- if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
- # raspberry pi
- # -mfpu=neon
- diff --git a/src/distance.c b/src/distance.c
- index 415ca80c2..1e1e5341c 100644
- --- a/src/distance.c
- +++ b/src/distance.c
- @@ -218,10 +218,6 @@ static void b2ComputeSimplexWitnessPoints( b2Vec2* a, b2Vec2* b, const b2Simplex
- {
- switch ( s->count )
- {
- - case 0:
- - B2_ASSERT( false );
- - break;
- -
- case 1:
- *a = s->v1.wA;
- *b = s->v1.wB;
- @@ -240,6 +236,8 @@ static void b2ComputeSimplexWitnessPoints( b2Vec2* a, b2Vec2* b, const b2Simplex
- break;
-
- default:
- + *a = b2Vec2_zero;
- + *b = b2Vec2_zero;
- B2_ASSERT( false );
- break;
- }
-
|