mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="" ..
填寫你的VS版本,例如我是vs2022(17),open3d_install_directory使用當(dāng)前路徑".",最終我的命令為:
10年積累的網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有皇姑免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="." ..
cmake --build . --config Release --target ALL_BUILD
cmake --build . --config Release --target INSTALL
編譯中的bug
下載超時(shí)問題,ispc、pybind11、open3d_sphinx_theme等報(bào)錯(cuò)信息類似:
error : downloading 'https://github.com/xxx/'
這個(gè)庫的下載路徑不存在,所以我們需要去GitHub下載boringssl-master.zip
fatal: unable to access 'https://github.com/microsoft/DirectXMath.git/': Failed to connect to github.com port 443 aft
er 21085 ms: Timed out
博主的 curl 下載并編譯好后,會自動下載裝好。上述方法不行試試,github下載了DirectX-Headers-mains和DirectXMath-main,并解壓到build\uvatlas\src\ext_directxheaders和build\uvatlas\src\ext_directxmath
驗(yàn)證編譯是否成功隨便打開build\bin\examples\Release\下的例程,例如:Draw.exe
PS:3d庫都是縫合怪
新建一個(gè)C++項(xiàng)目
插入如下代碼:
#include#include "open3d/Open3D.h"
using namespace open3d;
int main(){// 從github上下載pcd文件,也可以自己找一個(gè)pcd文件
auto demo_crop_data = data::DemoCropPointCloud();
auto cloud_ptr = std::make_shared();
if (io::ReadPointCloud(demo_crop_data.GetPointCloudPath(),*cloud_ptr)) {utility::LogInfo("Successfully read {}",demo_crop_data.GetPointCloudPath());
} else {utility::LogWarning("Failed to read {}",demo_crop_data.GetPointCloudPath());
return 1;
}
cloud_ptr->NormalizeNormals();
visualization::DrawGeometries({cloud_ptr },"PointCloud",1600,900);
}
靜態(tài)庫整合由于上面鏈接的靜態(tài)庫太多,故使用visual studio工具lib.exe(官方文檔)進(jìn)行合并,簡化調(diào)用流程。由于lib.exe的合并的函數(shù)限制,把上面的的靜態(tài)鏈接庫按照體積分兩份。
Lib.exe簡單使用輸入cmd命令lib.exe /out:xmv1.lib Open3D.lib assimp-vc143-mt.lib 等
可以用python處理之前的鏈接路徑,最后得到所有鏈接路徑(絕對路徑)。還沒看懂的可以去看看這篇博客。
最后多個(gè)靜態(tài)鏈接合并成xmv1.lib和xmv.lib
簡化后的調(diào)用流程添加頭文件,包含build下的include、include\open3d\3rdparty
D:\3rdparty\Open3D-master\build\include
D:\3rdparty\Open3D-master\build\include\open3d\3rdparty
引用鏈接庫
#pragma comment(lib, "xmv.lib")
#pragma comment(lib, "xmv1.lib")
添加預(yù)處理器
%(PreprocessorDefinitions)
WIN32
_WINDOWS
_CRT_SECURE_NO_WARNINGS
NDEBUG
OPEN3D_CXX_STANDARD="14"
OPEN3D_CXX_COMPILER_ID="MSVC"
OPEN3D_CXX_COMPILER_VERSION="19.34.31933.0"
OPEN3D_CUDA_COMPILER_ID=""
OPEN3D_CUDA_COMPILER_VERSION=""
ZMQ_STATIC
BUILD_ISPC_MODULE
BUILD_GUI
BUILD_WEBRTC
WITH_IPPICV
_GLIBCXX_USE_CXX11_ABI=0
WINDOWS
_CRT_SECURE_NO_DEPRECATE
_CRT_NONSTDC_NO_DEPRECATE
_SCL_SECURE_NO_WARNINGS
NOMINMAX
_USE_MATH_DEFINES
_ENABLE_EXTENDED_ALIGNED_STORAGE
__TBB_LIB_NAME=tbb_static
OPEN3D_STATIC
GLEW_STATIC
FMT_HEADER_ONLY=0
FMT_USE_WINDOWS_H=0
FMT_STRING_ALIAS=1
TINYGLTF_IMPLEMENTATION
STB_IMAGE_IMPLEMENTATION
STB_IMAGE_WRITE_IMPLEMENTATION
TINYOBJLOADER_IMPLEMENTATION
MKL_ILP64
CMAKE_INTDIR="Release"
調(diào)用代碼
#include#pragma comment(lib, "xmv.lib")
#pragma comment(lib, "xmv1.lib")
#include "open3d/Open3D.h"
using namespace open3d;
int main()
{auto demo_crop_data = data::DemoCropPointCloud();
auto cloud_ptr = std::make_shared();
if (io::ReadPointCloud(demo_crop_data.GetPointCloudPath(),*cloud_ptr)) {utility::LogInfo("Successfully read {}",demo_crop_data.GetPointCloudPath());
} else {utility::LogWarning("Failed to read {}",demo_crop_data.GetPointCloudPath());
return 1;
}
auto redWoodRGBD = data::SampleRedwoodRGBDImages();
auto image_ptr = std::make_shared();
if (io::ReadImage(redWoodRGBD.GetColorPaths()[0],*image_ptr)) {utility::LogInfo("Successfully read {}",redWoodRGBD.GetColorPaths()[0]);
} else {utility::LogWarning("Failed to read {}",redWoodRGBD.GetColorPaths()[0]);
return 1;
}
}
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級服務(wù)器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧