Ubuntu 下编译CloudCompare

CloudCompare作为一个查看和编辑3D数据的开源软件,在ubuntu下编译不算太麻烦,但是坑也是有的,记录一下所踩的坑。

  • 环境: Ubuntu 16.04 64 位

官网 http://www.cloudcompare.org/

https://github.com/cloudcompare/cloudcompare

在官网上有Ubuntu 的安装方法

snap install cloudcompare

原文如下:

Now thanks to Alberto Mardegan (and Romain Janvier), there is a "universal" snap package for Linux.
On Ubuntu, starting from version 16.04 it's as simple as typing "snap install cloudcompare".
On other distributions, you may need to install snap first (please refer to the corresponding documentation if necessary).
Snaps are published in 3 channels: "stable", "beta", and "edge".
The "stable" and the "beta" channel deliver the latest stable and beta versions of CloudCompare while "edge" delivers nightly builds and may eat your laundry. You can switch at any time between these three channels by launching "sudo snap refresh --" in your terminal.

github也有源码编译的方法,比较简单。

git clone --recursive https://github.com/cloudcompare/trunk.git
cd trunk
mkdir build
cd build
cmake ..
make -j8
sudo make install

但是这样得到的cloudcompare ,不能打开pcd文件。所以需要重现编译源码。
cmake ..之后

ccmake  ..

开启 INSTALL_QPCL_PLUGIN选项
再编译安装

Ubuntu上的PCL库容易报/usr/bin/ld: cannot find -lvtkproj4 collect2错误 ,解决办法是加上
cloudcompare/plugins/qPCL/CMakeLists.txt中增加一行

list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")

完整如下

cmake_minimum_required(VERSION 3.0)
option( INSTALL_QPCL_PLUGIN "Check to install qPCL plugin" OFF )

# CloudCompare 'PCL' bridge plugin
if (INSTALL_QPCL_PLUGIN)
    #requires PCL
    find_package(PCL REQUIRED)

    list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
    #PCL bridge library
    add_subdirectory(PclUtils)

    #CloudCompare 'qPCLIO' I/O plugin (to load PCD files)
    add_subdirectory(PclIO)

    project( QPCL_PLUGIN )

    #documentation
    add_subdirectory(doc)

    include_directories( ${QPCL_PLUGIN_UTILS_LIB_SOURCE_DIR}/filters )
    include_directories( ${QPCL_PLUGIN_UTILS_LIB_BINARY_DIR} )
    include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../ ) #the plugin dir
    include_directories( ${PCL_INCLUDE_DIRS} )

    include( ../CMakePluginTpl.cmake )
    target_link_libraries(${PROJECT_NAME} QPCL_PLUGIN_UTILS_LIB)

    link_directories( ${PCL_LIBRARY_DIRS} )
    add_definitions( ${PCL_DEFINITIONS} )

    #import PCL dlls (if any, WIN32 only)
    include( ExportPCLDlls.cmake )
    list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
    export_PCL_dlls( ${CLOUDCOMPARE_DEST_FOLDER} )
endif()


cloudcompare/plugins/qPCL/PclUtils/CMakeLists.txt
cloudcompare/plugins/qPCL/PclIO/CMakeLists.txt里也增加这一行

你可能感兴趣的:(C++/C)