瀏覽代碼

Hunter fixes for stb_image

Rahul Sheth 4 年之前
父節點
當前提交
1b37b74f9e
共有 6 個文件被更改,包括 21 次插入9 次删除
  1. 2 3
      CMakeLists.txt
  2. 1 1
      code/AssetLib/M3D/M3DWrapper.h
  3. 16 3
      code/CMakeLists.txt
  4. 1 1
      code/Common/Assimp.cpp
  5. 1 1
      code/Pbrt/PbrtExporter.cpp
  6. 0 0
      contrib/stb/stb_image.h

+ 2 - 3
CMakeLists.txt

@@ -46,8 +46,8 @@ option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
 IF(ASSIMP_HUNTER_ENABLED)
 IF(ASSIMP_HUNTER_ENABLED)
   include("cmake/HunterGate.cmake")
   include("cmake/HunterGate.cmake")
   HunterGate(
   HunterGate(
-    URL "https://github.com/cpp-pm/hunter/archive/v0.23.293.tar.gz"
-    SHA1 "e8e5470652db77149d9b38656db2a6c0b7642693"
+    URL "https://github.com/cpp-pm/hunter/archive/v0.23.311.tar.gz"
+    SHA1 "1a82b9b73055879181cb1466b2ab5d48ee8ae410"
   )
   )
 
 
   add_definitions(-DASSIMP_USE_HUNTER)
   add_definitions(-DASSIMP_USE_HUNTER)
@@ -227,7 +227,6 @@ INCLUDE_DIRECTORIES( BEFORE
   include
   include
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_BINARY_DIR}/include
   ${CMAKE_CURRENT_BINARY_DIR}/include
-  contrib/
 )
 )
 
 
 LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
 LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )

+ 1 - 1
code/AssetLib/M3D/M3DWrapper.h

@@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 // Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy.
 // Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy.
 #define STBI_ONLY_PNG
 #define STBI_ONLY_PNG
-#include <contrib/stb_image/stb_image.h>
+#include <stb/stb_image.h>
 
 
 #include "m3d.h"
 #include "m3d.h"
 
 

+ 16 - 3
code/CMakeLists.txt

@@ -873,6 +873,7 @@ ELSE()
     ../contrib/pugixml/src/pugiconfig.hpp
     ../contrib/pugixml/src/pugiconfig.hpp
     ../contrib/pugixml/src/pugixml.hpp
     ../contrib/pugixml/src/pugixml.hpp
   )
   )
+  INCLUDE_DIRECTORIES("../contrib/pugixml/src")
   SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
   SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
 ENDIF()
 ENDIF()
 
 
@@ -1034,8 +1035,6 @@ IF(ASSIMP_HUNTER_ENABLED)
   find_package(RapidJSON CONFIG REQUIRED)
   find_package(RapidJSON CONFIG REQUIRED)
 ELSE()
 ELSE()
   INCLUDE_DIRECTORIES("../contrib/rapidjson/include")
   INCLUDE_DIRECTORIES("../contrib/rapidjson/include")
-  INCLUDE_DIRECTORIES( "../contrib" )
-  INCLUDE_DIRECTORIES("../contrib/pugixml/src")
   ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1)
   ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1)
   option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON )
   option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON )
   if(ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR)
   if(ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR)
@@ -1043,6 +1042,18 @@ ELSE()
   endif()
   endif()
 ENDIF()
 ENDIF()
 
 
+# stb
+IF(ASSIMP_HUNTER_ENABLED)
+  hunter_add_package(stb)
+  find_package(stb CONFIG REQUIRED)
+ELSE()
+  SET( stb_SRCS
+    ../contrib/stb/stb_image.h
+  )
+  INCLUDE_DIRECTORIES("../contrib")
+  SOURCE_GROUP( Contrib\\stb FILES ${stb_SRCS})
+ENDIF()
+
 # VC2010 fixes
 # VC2010 fixes
 if(MSVC10)
 if(MSVC10)
   option( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF )
   option( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF )
@@ -1101,6 +1112,7 @@ SET( assimp_src
   ${open3dgc_SRCS}
   ${open3dgc_SRCS}
   ${ziplib_SRCS}
   ${ziplib_SRCS}
   ${Pugixml_SRCS}
   ${Pugixml_SRCS}
+  ${stb_SRCS}
   # Necessary to show the headers in the project when using the VC++ generator:
   # Necessary to show the headers in the project when using the VC++ generator:
 
 
   ${PUBLIC_HEADERS}
   ${PUBLIC_HEADERS}
@@ -1158,8 +1170,9 @@ IF(ASSIMP_HUNTER_ENABLED)
       utf8cpp
       utf8cpp
       zip::zip
       zip::zip
       pugixml
       pugixml
+      stb::stb
   )
   )
-  
+
   if (ASSIMP_BUILD_DRACO)
   if (ASSIMP_BUILD_DRACO)
     target_link_libraries(assimp PUBLIC ${draco_LIBRARIES})
     target_link_libraries(assimp PUBLIC ${draco_LIBRARIES})
   endif()
   endif()

+ 1 - 1
code/Common/Assimp.cpp

@@ -1277,7 +1277,7 @@ ASSIMP_API void aiQuaternionInterpolate(
 #   endif
 #   endif
 
 
 #   define STB_IMAGE_IMPLEMENTATION
 #   define STB_IMAGE_IMPLEMENTATION
-#   include "stb_image/stb_image.h"
+#   include "stb/stb_image.h"
 
 
 #   if _MSC_VER
 #   if _MSC_VER
 #       pragma warning(pop)
 #       pragma warning(pop)

+ 1 - 1
code/Pbrt/PbrtExporter.cpp

@@ -83,7 +83,7 @@ Other:
 #include <sstream>
 #include <sstream>
 #include <string>
 #include <string>
 
 
-#include "../contrib/stb_image/stb_image.h"
+#include "stb/stb_image.h"
 
 
 using namespace Assimp;
 using namespace Assimp;
 
 

+ 0 - 0
contrib/stb_image/stb_image.h → contrib/stb/stb_image.h