图形工具:在 Linux 中编译并连接到本地 CGAL 库? (没有须藤)

Graph-tool: compile and connect to local CGAL library, in Linux? (no sudo)

[Ubuntu]

我在本地编译了CGAL:

/path/to/cgal/
    /lib/
        libCGAL_Core.so     libCGAL_Core.so.13.0.2  
        libCGAL_ImageIO.so.13      libCGAL.so     libCGAL.so.13.0.2
        libCGAL_Core.so.13  libCGAL_ImageIO.so      
        libCGAL_ImageIO.so.13.0.2  libCGAL.so.13
    /include/
        /CGAL/
            version.h compiler_config.h

而且我已经设法满足除 cgal 之外的所有图形工具要求(至少检查了 cgal 的所有要求):

./configure --with-boost=/path/to/boost --with-cgal=/path/to/cgal

然后我获得了所有成功,直到收到以下错误消息:

checking for __gmpz_init in -lgmp... yes
checking for __gmpz_init in -lgmp... (cached) yes
checking whether CGAL is available in /path/to/cgal... no
configure: error: CGAL library not found.

// the harshest part is that it seems to be searching in the correct
// directory.  

我试过在 cgal 构建目录中指定不同的点。我使用的 cgal 编译命令是(来自构建目录):

cmake path/to/cgal_src_dir -DCMAKE_BUILD_TYPE=Release;

接下来,我尝试添加包括:

./configure --with-boost=$boost --with-cgal=path/to/cgal CPPFLAGS="-I path/to/cgal/include -I $HOME/.local/include" LDFLAGS="-L path/to/cgal/lib -L $HOME/.local/lib -Wl,-rpath=$HOME/.local/lib"

我承认我不理解 -Wl,-rpath= 部分,我从图形工具安装指南中复制了它。 .local/lib 文件夹包含其他组件的文件,例如 gmp、expat、sparsehash 等。

这不是准确的答案,但按照 OP 的要求将有助于完成安装,所以请不要盲目投票。

要创建 libcgal 的 debian 软件包,请打开您的 CMakeList.txt 并在文件末尾添加:

#--------------------------------------------------------------------
# Create debian files
#--------------------------------------------------------------------
if (UNIX AND NOT APPLE)
    SET(CPACK_GENERATOR "DEB")
    SET(CPACK_PACKAGE_NAME  "libcgal-all")
    SET(CPACK_PACKAGE_VERSION  "${CGAL_VERSION}")
    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY  "C++ library for computational geometry (development files)\n CGAL (Computational Geometry Algorithms Library) makes the most important of the solutions and methods developed in computational geometry available to users in industry and academia in a C++ library. The goal is to provide easy access to useful, reliable geometric algorithms.\n .\n This package contains the header files and static libraries for libCGAL.so, libCGAL_Core.so, and libCGAL_ImageIO.so. The  header files and static libraries for libCGAL_Qt4.so can be found in the package libcgal-qt4-dev.")
    SET(CPACK_PACKAGE_CONTACT "bordeo")
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS  "libboost-dev, libboost-thread-dev, libboost-system-dev, libboost-program-options-dev, libgmp10-dev, libmpfr-dev, zlib1g-dev")
    SET(CPACK_DEBIAN_PACKAGE_REPLACES "libcgal10, libcgal-dev")
    INCLUDE(CPack)
endif()

如果您没有任何依赖项,请删除整行 SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libcln6, libcln-dev, libreadline6, libreadline6-dev, flex, bison"),并 更改其他看起来合适的行

现在转到终端并在 cgal 目录中发出以下命令

mkdir build
cd build
cmake-gui ..
# set CMAKE_INSTALL_PREFIX to `~/.local
cmake ..
make -j4
cpack ..

您会发现您的 debian 已构建。将 debian 解压或安装到 ~/.local.

完成后,转到图形工具目录并像

一样开始构建
./configure --prefix="/wherever"  --with-boost=/path/to/boost --with-cgal=~/.local
make -j4
make install

希望这能解决您的问题。