diff --git a/3rdparty/boringssl/boringssl.cmake b/3rdparty/boringssl/boringssl.cmake index 5f9aeea9e33..5048b76648f 100644 --- a/3rdparty/boringssl/boringssl.cmake +++ b/3rdparty/boringssl/boringssl.cmake @@ -48,7 +48,9 @@ ExternalProject_Add( CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + /$<$:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}ssl${CMAKE_STATIC_LIBRARY_SUFFIX} + /$<$:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}crypto${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_boringssl SOURCE_DIR) diff --git a/3rdparty/curl/curl.cmake b/3rdparty/curl/curl.cmake index b927a89e3bb..cacdb3c3856 100644 --- a/3rdparty/curl/curl.cmake +++ b/3rdparty/curl/curl.cmake @@ -80,7 +80,9 @@ else() CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_curl SOURCE_DIR) diff --git a/3rdparty/ipp/ipp.cmake b/3rdparty/ipp/ipp.cmake index ffc9b320512..deaed2ab179 100755 --- a/3rdparty/ipp/ipp.cmake +++ b/3rdparty/ipp/ipp.cmake @@ -35,6 +35,20 @@ else() set(IPP_SUBPATH "") endif() +# Threading layer libs must be linked first. +# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html +# Library dependency order: +# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html +if (WIN32) + set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt) +else() + set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore) +endif() + +foreach(item IN LISTS IPP_LIBRARIES) + list(APPEND IPP_BUILD_BYPRODUCTS /${IPP_SUBPATH}lib/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) +endforeach() + ExternalProject_Add(ext_ipp PREFIX ipp URL ${IPP_URL} @@ -45,16 +59,10 @@ ExternalProject_Add(ext_ipp CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - ) + BUILD_BYPRODUCTS + ${IPP_BUILD_BYPRODUCTS} +) + ExternalProject_Get_Property(ext_ipp SOURCE_DIR) set(IPP_INCLUDE_DIR "${SOURCE_DIR}/${IPP_SUBPATH}include/") -# Threading layer libs must be linked first. -# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html -# Library dependency order: -# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html -if (WIN32) - set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt) -else() - set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore) -endif() set(IPP_LIB_DIR "${SOURCE_DIR}/${IPP_SUBPATH}lib") \ No newline at end of file diff --git a/3rdparty/uvatlas/uvatlas.cmake b/3rdparty/uvatlas/uvatlas.cmake index 51831059941..63642f80e3d 100644 --- a/3rdparty/uvatlas/uvatlas.cmake +++ b/3rdparty/uvatlas/uvatlas.cmake @@ -52,7 +52,7 @@ ExternalProject_Add( -Ddirectxmath_DIR= DEPENDS ext_directxheaders ext_directxmath BUILD_BYPRODUCTS - /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}uvatlas${CMAKE_STATIC_LIBRARY_SUFFIX} + /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}UVAtlas${CMAKE_STATIC_LIBRARY_SUFFIX} ) diff --git a/3rdparty/vtk/vtk_build.cmake b/3rdparty/vtk/vtk_build.cmake index 271d3789667..f9217f2301e 100644 --- a/3rdparty/vtk/vtk_build.cmake +++ b/3rdparty/vtk/vtk_build.cmake @@ -26,13 +26,13 @@ set(VTK_LIBRARIES vtksys-${VTK_VERSION}${VTK_LIB_SUFFIX} ) -foreach(item IN LISTS VTK_LIBRARIES) - list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) -endforeach() - if(BUILD_VTK_FROM_SOURCE) + foreach(item IN LISTS VTK_LIBRARIES) + list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endforeach() + ExternalProject_Add( ext_vtk PREFIX vtk @@ -294,6 +294,10 @@ if(BUILD_VTK_FROM_SOURCE) else() #### download prebuilt vtk + foreach(item IN LISTS VTK_LIBRARIES) + list(APPEND VTK_BUILD_BYPRODUCTS /lib/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endforeach() + if(LINUX_AARCH64) message(FATAL "No precompiled vtk for platform. Enable BUILD_VTK_FROM_SOURCE") elseif(APPLE_AARCH64) @@ -334,7 +338,8 @@ else() #### download prebuilt vtk CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + ${VTK_BUILD_BYPRODUCTS} ) ExternalProject_Get_Property(ext_vtk SOURCE_DIR) diff --git a/cpp/open3d/io/TriangleMeshIO.h b/cpp/open3d/io/TriangleMeshIO.h index 3ee4cb0f492..32ec2aa751a 100644 --- a/cpp/open3d/io/TriangleMeshIO.h +++ b/cpp/open3d/io/TriangleMeshIO.h @@ -31,6 +31,7 @@ struct ReadTriangleMeshOptions { /// `aiProcessPreset_TargetRealtime_Fast, /// aiProcess_RemoveRedundantMaterials, aiProcess_OptimizeMeshes, /// aiProcess_PreTransformVertices`. + /// https://github.com/assimp/assimp/blob/master/include/assimp/postprocess.h /// /// Note that identical vertices will always be joined regardless of whether /// post-processing is enabled or not, which changes the number of vertices diff --git a/cpp/open3d/io/file_format/FileASSIMP.cpp b/cpp/open3d/io/file_format/FileASSIMP.cpp index 92a2fda8077..15bc3ffd26a 100644 --- a/cpp/open3d/io/file_format/FileASSIMP.cpp +++ b/cpp/open3d/io/file_format/FileASSIMP.cpp @@ -36,13 +36,16 @@ FileGeometry ReadFileGeometryTypeFBX(const std::string& path) { return FileGeometry(CONTAINS_TRIANGLES | CONTAINS_POINTS); } +// Ref: +// https://github.com/assimp/assimp/blob/master/include/assimp/postprocess.h const unsigned int kPostProcessFlags_compulsory = - aiProcess_JoinIdenticalVertices; + aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | + aiProcess_PreTransformVertices; const unsigned int kPostProcessFlags_fast = - aiProcessPreset_TargetRealtime_Fast | - aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | - aiProcess_PreTransformVertices; + kPostProcessFlags_compulsory | aiProcess_GenNormals | + aiProcess_Triangulate | aiProcess_GenUVCoords | + aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes; struct TextureImages { std::shared_ptr albedo; @@ -65,7 +68,7 @@ void LoadTextures(const std::string& filename, std::string base_path = utility::filesystem::GetFileParentDirectory(filename); - auto texture_loader = [&base_path, &scene, &mat]( + auto texture_loader = [&base_path, &scene, &mat, &filename]( aiTextureType type, std::shared_ptr& img) { if (mat->GetTextureCount(type) > 0) { @@ -94,7 +97,10 @@ void LoadTextures(const std::string& filename, } } else { utility::LogWarning( - "This format of image is not supported."); + "Unsupported texture format for texture {} for " + "file {}: Only jpg and " + "png textures are supported.", + path.C_Str(), filename); } } // Else, build the path to it. @@ -170,7 +176,8 @@ bool ReadTriangleMeshUsingASSIMP( const auto* scene = importer.ReadFile(filename.c_str(), post_process_flags); if (!scene) { - utility::LogWarning("Unable to load file {} with ASSIMP", filename); + utility::LogWarning("Unable to load file {} with ASSIMP: {}", filename, + importer.GetErrorString()); return false; } @@ -326,7 +333,8 @@ bool ReadModelUsingAssimp(const std::string& filename, const auto* scene = importer.ReadFile(filename.c_str(), kPostProcessFlags_fast); if (!scene) { - utility::LogWarning("Unable to load file {} with ASSIMP", filename); + utility::LogWarning("Unable to load file {} with ASSIMP: {}", filename, + importer.GetErrorString()); return false; } diff --git a/cpp/open3d/t/io/file_format/FileASSIMP.cpp b/cpp/open3d/t/io/file_format/FileASSIMP.cpp index 514d59fca1b..da23953fe79 100644 --- a/cpp/open3d/t/io/file_format/FileASSIMP.cpp +++ b/cpp/open3d/t/io/file_format/FileASSIMP.cpp @@ -35,14 +35,16 @@ namespace t { namespace io { // Split all polygons with more than 3 edges into triangles. +// Ref: +// https://github.com/assimp/assimp/blob/master/include/assimp/postprocess.h const unsigned int kPostProcessFlags_compulsory = aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | - aiProcess_SortByPType; + aiProcess_SortByPType | aiProcess_PreTransformVertices; const unsigned int kPostProcessFlags_fast = - aiProcessPreset_TargetRealtime_Fast | - aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | - aiProcess_PreTransformVertices; + kPostProcessFlags_compulsory | aiProcess_GenNormals | + aiProcess_GenUVCoords | aiProcess_RemoveRedundantMaterials | + aiProcess_OptimizeMeshes; bool ReadTriangleMeshUsingASSIMP( const std::string& filename, @@ -58,7 +60,8 @@ bool ReadTriangleMeshUsingASSIMP( const auto* scene = importer.ReadFile(filename.c_str(), post_process_flags); if (!scene) { - utility::LogWarning("Unable to load file {} with ASSIMP", filename); + utility::LogWarning("Unable to load file {} with ASSIMP: {}", filename, + importer.GetErrorString()); return false; } @@ -219,7 +222,7 @@ bool WriteTriangleMeshUsingASSIMP(const std::string& filename, // Sanity checks... if (write_ascii) { utility::LogWarning( - "TriangleMesh can't be saved in ASCII fromat as .glb"); + "TriangleMesh can't be saved in ASCII format as .glb"); return false; } if (compressed) { @@ -470,7 +473,9 @@ bool WriteTriangleMeshUsingASSIMP(const std::string& filename, // Export if (exporter.Export(ai_scene.get(), "glb2", filename.c_str()) == AI_FAILURE) { - utility::LogWarning("Got error: {}", exporter.GetErrorString()); + utility::LogWarning( + "Got error: ({}) while writing TriangleMesh to file {}.", + exporter.GetErrorString(), filename); return false; }