Merge remote-tracking branch 'official/master' into contrib

pull/261/head
Léo Terziman 2014-04-28 09:11:40 +02:00
commit 2047cf6764
3 changed files with 37 additions and 19 deletions

View File

@ -53,17 +53,12 @@ SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH
SET(ASSIMP_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfitx for lib, samples and tools")
# Allow the user to build a static library
option ( BUILD_SHARED_LIB "Build a shared version of the library" ON )
option ( BUILD_SHARED_LIBS "Build a shared version of the library" ON )
# Generate a pkg-config .pc for the Assimp library.
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
# cmake configuration files
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
# Only generate this target if no higher-level project already has
IF (NOT TARGET uninstall)
# add make uninstall capability
@ -95,6 +90,10 @@ ELSE ( ASSIMP_ENABLE_BOOST_WORKAROUND )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
ENDIF ( ASSIMP_ENABLE_BOOST_WORKAROUND )
# cmake configuration files
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
SET ( ASSIMP_NO_EXPORT OFF CACHE BOOL
"Disable Assimp's export functionality."

View File

@ -47,18 +47,16 @@ endif (CMAKE_BUILD_TYPE EQUAL "DEBUG")
# the boost version assimp was compiled with
set( ASSIMP_Boost_VERSION "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@")
if( WIN32 )
# search for the boost version assimp was compiled with
set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost ${ASSIMP_Boost_VERSION} EXACT COMPONENTS thread date_time)
if(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
set( ASSIMP_INCLUDE_DIRS "${ASSIMP_INCLUDE_DIRS}" ${Boost_INCLUDE_DIRS})
else(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
message(WARNING "Failed to find Boost ${ASSIMP_Boost_VERSION} necessary for assimp")
endif(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
endif( WIN32 )
# search for the boost version assimp was compiled with
set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost ${ASSIMP_Boost_VERSION} EXACT COMPONENTS thread date_time)
if(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
set( ASSIMP_INCLUDE_DIRS "${ASSIMP_INCLUDE_DIRS}" ${Boost_INCLUDE_DIRS})
else(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
message(WARNING "Failed to find Boost ${ASSIMP_Boost_VERSION} necessary for assimp")
endif(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
# for compatibility wiht pkg-config
set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}")

View File

@ -808,6 +808,27 @@ const char* TextureTypeToString(aiTextureType in)
}
// -----------------------------------------------------------------------------------
// Some chuncks of text will need to be encoded for XML
// http://stackoverflow.com/questions/5665231/most-efficient-way-to-escape-xml-html-in-c-string#5665377
static std::string encodeXML(const std::string& data) {
std::string buffer;
buffer.reserve(data.size());
for(size_t pos = 0; pos != data.size(); ++pos) {
switch(data[pos]) {
case '&': buffer.append("&"); break;
case '\"': buffer.append("""); break;
case '\'': buffer.append("'"); break;
case '<': buffer.append("&lt;"); break;
case '>': buffer.append("&gt;"); break;
default: buffer.append(&data[pos], 1); break;
}
}
return buffer;
}
// -----------------------------------------------------------------------------------
// Write a text model dump
void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd, bool shortened)
@ -1014,7 +1035,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
}
}
else if (prop->mType == aiPTI_String) {
fprintf(out,">\n\t\t\t\"%s\"",prop->mData+4 /* skip length */);
fprintf(out,">\n\t\t\t\t\"%s\"",encodeXML(prop->mData+4).c_str() /* skip length */);
}
fprintf(out,"\n\t\t\t</MatProperty>\n");
}