使用CMakeList(Ubuntu)/ 3D网格生成添加CGAL lib

时间:2017-07-06 14:34:36

标签: c++ git mesh cgal 3d-modelling

我正在尝试使用lib CGAL进行3D网格重建。我想测试website上可用的一些例子,但现在要正确地进行...

我做了什么:

  • git(版本4.10)

  • 下载源代码
  • 安装了依赖项(并非所有部分)

  • 运行cmake-gui ..在配置步骤后提供: enter image description here

但是,当我做以下内容包括:

#include <opencv2/opencv.hpp>
#include <CGAL/trace.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
//#include <CGAL/Polyhedron_3.h>
//#include <CGAL/IO/Polyhedron_iostream.h>
//#include <CGAL/Surface_mesh_default_triangulation_3.h>
//#include <CGAL/make_surface_mesh.h>
//#include <CGAL/Implicit_surface_3.h>
//#include <CGAL/IO/output_surface_facets_to_polyhedron.h>
//#include <CGAL/Poisson_reconstruction_function.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/property_map.h>
#include <CGAL/IO/read_xyz_points.h>
//#include <CGAL/compute_average_spacing.h>
//#include <CGAL/Polygon_mesh_processing/distance.h>

只有取消注释工作。

我做了什么检查:

  • 我的cmake

    find_package(CGAL REQUIRED) 消息( “=======================”) 消息( “$ {} CGAL_USE_FILE”) 消息( “$ {} CGAL_INCLUDE_DIRS”) 消息( “$ {} CGAL_LIBRARIES_DIR”) 消息( “=======================”)

    列表(APPEND INCLUDE_DIRS $ {CGAL_INCLUDE_DIRS}) 列表(附录图书馆$ {CGAL_LIBRARIES_DIR})

(列表部分是通过执行

为cmakelist中的所有模块提供对库的访问
FILE(GLOB APPFILES "app/*.cpp")
FOREACH(APPFILE ${APPFILES})
    GET_FILENAME_COMPONENT(APPNAME ${APPFILE} NAME_WE)
    ADD_EXECUTABLE(${APPNAME} ${APPFILE})
    TARGET_LINK_LIBRARIES(${APPNAME} ${LIBRARIES} )
ENDFOREACH()

) 显示:

=======================
/usr/local//lib/CGAL/UseCGAL.cmake
/usr/local//include
/usr/local//lib
=======================
  • 此外,当我正在运行cmake ..我得到了这个:

    警告:目标“testCGAL”请求链接到目录“/ usr / local // lib”。目标可能仅链接到库。 CMake正在放弃该项目。

    警告:目标“testCGAL”请求链接到目录“/ usr / local // lib”。目标可能仅链接到库。 CMake正在放弃该项目。

(testCGAL是测试导入的类的名称)。

我不明白为什么我的包含的评论部分不起作用。有人能说我为什么或能给我一些建议吗?

由于

PS:顺便说一句,我想从深度图(和相应的颜色)或彩色点云进行3D网格重建。此外,我想得到一个纹理网格。有人知道一个好的lib吗?

===============编辑============

最后,当我运行cmake ..并进行所有编译时,我收到以下错误消息:

[ 99%] Building CXX object CMakeFiles/testCGAL.dir/app/testCGAL.cpp.o
[100%] Linking CXX executable bin/testCGAL
CMakeFiles/testCGAL.dir/app/testCGAL.cpp.o: In function `CGAL::Interval_nt<false>::Test_runtime_rounding_modes::Test_runtime_rounding_modes()':
testCGAL.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0xd2): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
testCGAL.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0x180): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
CMakeFiles/testCGAL.dir/app/testCGAL.cpp.o: In function `CGAL::Interval_nt<true>::Test_runtime_rounding_modes::Test_runtime_rounding_modes()':
testCGAL.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0xd2): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
testCGAL.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0x180): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
collect2: error: ld returned 1 exit status
CMakeFiles/testCGAL.dir/build.make:352: recipe for target 'bin/testCGAL' failed
make[2]: *** [bin/testCGAL] Error 1
CMakeFiles/Makefile2:302: recipe for target 'CMakeFiles/testCGAL.dir/all' failed
make[1]: *** [CMakeFiles/testCGAL.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

0 个答案:

没有答案