Przeglądaj źródła

Add check for wall switch from cmake

Kim Kulling 3 lat temu
rodzic
commit
b3c7bdbdd6

+ 7 - 10
code/AssetLib/FBX/FBXConverter.cpp

@@ -305,19 +305,16 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
         }
     }
 
-    if (nodes.size()) {
-        parent->mChildren = new aiNode *[nodes.size()]();
-        parent->mNumChildren = static_cast<unsigned int>(nodes.size());
-
-        for (unsigned int i = 0; i < nodes.size(); ++i)
-        {
-            parent->mChildren[i] = nodes[i].mOwnership.release();
-        }
-        nodes.clear();
-    } else {
+    if (nodes.empty()) {
         parent->mNumChildren = 0;
         parent->mChildren = nullptr;
     }
+
+    parent->mChildren = new aiNode *[nodes.size()]();
+    parent->mNumChildren = static_cast<unsigned int>(nodes.size());
+    for (unsigned int i = 0; i < nodes.size(); ++i) {
+        parent->mChildren[i] = nodes[i].mOwnership.release();
+    }
 }
 
 void FBXConverter::ConvertLights(const Model &model, const std::string &orig_name) {

+ 8 - 0
test/CMakeLists.txt

@@ -263,6 +263,14 @@ IF(MSVC)
     add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 ENDIF()
 
+IF (ASSIMP_WARNINGS_AS_ERRORS)
+  IF (MSVC)
+    TARGET_COMPILE_OPTIONS(unit PRIVATE /W4 /WX)
+  ELSE()
+    TARGET_COMPILE_OPTIONS(unit PRIVATE -Wall -Werror)
+  ENDIF()
+ENDIF()
+
 target_link_libraries( unit assimp ${platform_libs} )
 
 add_subdirectory(headercheck)

+ 8 - 2
tools/assimp_cmd/CMakeLists.txt

@@ -2,8 +2,6 @@
 # ----------------------------------------------------------------------
 #
 # Copyright (c) 2006-2022, assimp team
-
-
 # All rights reserved.
 #
 # Redistribution and use of this software in source and binary forms,
@@ -62,6 +60,14 @@ ADD_EXECUTABLE( assimp_cmd
   ${ASSIMP_CMD_RC}
 )
 
+IF (ASSIMP_WARNINGS_AS_ERRORS)
+  IF (MSVC)
+    TARGET_COMPILE_OPTIONS(assimp_cmd PRIVATE /W4 /WX)
+  ELSE()
+    TARGET_COMPILE_OPTIONS(assimp_cmd PRIVATE -Wall -Werror)
+  ENDIF()
+ENDIF()
+
 TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_cmd)
 
 SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

+ 8 - 0
tools/assimp_view/CMakeLists.txt

@@ -95,6 +95,14 @@ IF ( MSVC )
   REMOVE_DEFINITIONS( -DUNICODE -D_UNICODE )
 ENDIF ()
 
+IF (ASSIMP_WARNINGS_AS_ERRORS)
+  IF (MSVC)
+    TARGET_COMPILE_OPTIONS(assimp_viewer PRIVATE /W4 /WX)
+  ELSE()
+    TARGET_COMPILE_OPTIONS(assimp_viewer PRIVATE -Wall -Werror)
+  ENDIF()
+ENDIF()
+
 # Link the executable to the assimp + dx libs.
 TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32 winmm )