From a7e2b3ad30f60ac9186a1b65db6f7dc2603deeec Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-0R560PH\\George" Date: Sat, 30 Apr 2022 08:14:16 -0700 Subject: [PATCH 1/2] Fixed library names for MinGW/MSYS2 --- code/CMakeLists.txt | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index cff4d2457..16b5ece4d 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1266,6 +1266,16 @@ if( MSVC ) set(LIBRARY_SUFFIX "${ASSIMP_LIBRARY_SUFFIX}-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library") endif() +if (MINGW) + set(LIBRARY_SUFFIX "-${ASSIMP_SOVERSION}" CACHE STRING "the suffix for the assimp MinGW shared library") + SET_TARGET_PROPERTIES( assimp PROPERTIES + ARCHIVE_OUTPUT_NAME assimp + ) + if (NOT BUILD_SHARED_LIBS) + TARGET_LINK_LIBRARIES ( assimp -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lwinpthread ) # winpthread is for libminizip. + endif () +endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore") target_compile_definitions(assimp PUBLIC WindowsStore) TARGET_LINK_LIBRARIES(assimp advapi32) @@ -1277,19 +1287,6 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES OUTPUT_NAME assimp${LIBRARY_SUFFIX} ) -if (MINGW) - if (BUILD_SHARED_LIBS) - set_target_properties(assimp PROPERTIES - SUFFIX "-${ASSIMP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - if (NOT DEFINED ${LIBRARY_SUFFIX}) #Added as a guard for subsequent runs, but seems to not work when cache is outdated - set(LIBRARY_SUFFIX "-${ASSIMP_SOVERSION}" CACHE STRING "the suffix for the assimp MinGW shared library") - endif() - else () - TARGET_LINK_LIBRARIES ( assimp -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lwinpthread ) # winpthread is for libminizip. - endif () -endif() - if (APPLE) if (ASSIMP_BUILD_FRAMEWORK) SET_TARGET_PROPERTIES( assimp PROPERTIES From 1d3d5c4bb6d855a6847d218ec151eb08889e0386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 1 May 2022 13:27:42 +0200 Subject: [PATCH 2/2] Rename TextureTypeToString() to aiTextureTypeToString() Closes: https://github.com/assimp/assimp/issues/4493 --- code/AssetLib/Assxml/AssxmlFileWriter.cpp | 2 +- code/Common/material.cpp | 2 +- code/Pbrt/PbrtExporter.cpp | 2 +- code/PostProcessing/ComputeUVMappingProcess.cpp | 2 +- code/PostProcessing/ValidateDataStructure.cpp | 2 +- include/assimp/material.h | 2 +- tools/assimp_cmd/Info.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/AssetLib/Assxml/AssxmlFileWriter.cpp b/code/AssetLib/Assxml/AssxmlFileWriter.cpp index 640890ea1..a443e3fe9 100644 --- a/code/AssetLib/Assxml/AssxmlFileWriter.cpp +++ b/code/AssetLib/Assxml/AssxmlFileWriter.cpp @@ -365,7 +365,7 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene, ioprintf(io, "\t\t\tmKey.data, sz, - ::TextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex); + ::aiTextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex); if (prop->mType == aiPTI_Float) { ioprintf(io, " size=\"%i\">\n\t\t\t\t", diff --git a/code/Common/material.cpp b/code/Common/material.cpp index a7541d4f1..ffc2f415b 100644 --- a/code/Common/material.cpp +++ b/code/Common/material.cpp @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include // ------------------------------------------------------------------------------- -const char *TextureTypeToString(aiTextureType in) { +const char *aiTextureTypeToString(aiTextureType in) { switch (in) { case aiTextureType_NONE: return "n/a"; diff --git a/code/Pbrt/PbrtExporter.cpp b/code/Pbrt/PbrtExporter.cpp index 25061f517..9590c4954 100644 --- a/code/Pbrt/PbrtExporter.cpp +++ b/code/Pbrt/PbrtExporter.cpp @@ -590,7 +590,7 @@ void PbrtExporter::WriteMaterial(int m) { for (int i = 1; i <= aiTextureType_UNKNOWN; i++) { int count = material->GetTextureCount(aiTextureType(i)); if (count > 0) - mOutput << TextureTypeToString(aiTextureType(i)) << ": " << count << " "; + mOutput << aiTextureTypeToString(aiTextureType(i)) << ": " << count << " "; } mOutput << "\n"; diff --git a/code/PostProcessing/ComputeUVMappingProcess.cpp b/code/PostProcessing/ComputeUVMappingProcess.cpp index c7456cc9d..ec8783041 100644 --- a/code/PostProcessing/ComputeUVMappingProcess.cpp +++ b/code/PostProcessing/ComputeUVMappingProcess.cpp @@ -415,7 +415,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene) if (!DefaultLogger::isNullLogger()) { ai_snprintf(buffer, 1024, "Found non-UV mapped texture (%s,%u). Mapping type: %s", - TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex, + aiTextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex, MappingTypeToString(mapping)); ASSIMP_LOG_INFO(buffer); diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index e99f6a6e3..ebcfbbf5a 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -521,7 +521,7 @@ void ValidateDSProcess::Validate(const aiAnimation *pAnimation) { // ------------------------------------------------------------------------------------------------ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial *pMaterial, aiTextureType type) { - const char *szType = TextureTypeToString(type); + const char *szType = aiTextureTypeToString(type); // **************************************************************************** // Search all keys of the material ... diff --git a/include/assimp/material.h b/include/assimp/material.h index 2ccd83763..0052888d1 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -335,7 +335,7 @@ enum aiTextureType { // ------------------------------------------------------------------------------- // Get a string for a given aiTextureType -ASSIMP_API const char *TextureTypeToString(enum aiTextureType in); +ASSIMP_API const char *aiTextureTypeToString(enum aiTextureType in); // --------------------------------------------------------------------------- /** @brief Defines all shading models supported by the library diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index 3e83b88bb..4703713c8 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -441,7 +441,7 @@ int Assimp_Info(const char *const *params, unsigned int num) { prop->mKey.data, prop->mIndex, prop->mDataLength, - TextureTypeToString(textype)); + aiTextureTypeToString(textype)); } } if (scene->mNumMaterials) {