【问题标题】:Include the CGAL shared libraries to deploy a CGAL program包括 CGAL 共享库以部署 CGAL 程序
【发布时间】:2019-06-11 14:11:38
【问题描述】:

我正在使用 CGAL 构建一个 C++ 程序,并且我正在编写 CMake 安装规则来部署所述程序,以便我可以 CPack 结果并且最终用户不必安装 CGAL 或其任何依赖项即可使用它。为了做到这一点,我需要包含每个共享库(Windows 上的 DLL 等),但我找不到可以让我这样做的 CMake 变量。我在 CGAL 回购中四处搜索,但没有运气。我尝试使用${CGAL_LIBRARIES},但那些没有给出路径,而且${CGAL_LIBRARIES_DIRS} 似乎不是一个东西。

我当前的 CMakeLists 是基于专用 CGAL 脚本生成的:

# Created by the script cgal_create_CMakeLists
# This is the CMake script for compiling a set of CGAL applications.

project( MeshCleaner )

cmake_minimum_required(VERSION 2.8.11)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

# CGAL and its components
find_package( CGAL QUIET COMPONENTS  )

if ( NOT CGAL_FOUND )

  message(STATUS "This project requires the CGAL library, and will not be compiled.")
  return()  

endif()


# Boost and its components
find_package( Boost REQUIRED )

if ( NOT Boost_FOUND )

  message(STATUS "This project requires the Boost library, and will not be compiled.")

  return()  

endif()

# include for local directory
include_directories( BEFORE include )

# include for local package


# Creating entries for target: meshCleaner
# ############################

add_executable( ${PROJECT_NAME}  main.cpp )

add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${PROJECT_NAME} )

# Link the executable to CGAL and third-party libraries
target_link_libraries(${PROJECT_NAME}   ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )

install(TARGETS ${PROJECT_NAME} DESTINATION . COMPONENT Libraries)

message(${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})

if(WIN32)
    set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
    include(InstallRequiredSystemLibraries)
endif()

include(${PROJECT_NAME}CPack)

【问题讨论】:

    标签: dll deployment cmake shared-libraries cgal


    【解决方案1】:

    “修复”该问题的最简单方法是将 CGAL 用作仅标头。请检查手册。这里是the direct link to the installation manual of CGAL-4.14, section "Header-only with CMake Configuration".

    【讨论】:

    • 我已经看到了,但这对我来说不太可能,因为它会在 Windows 上引起问题(我使用 CMake 的重点是跨平台兼容性)。
    • 让我知道您在 Windows 上遇到的问题。它应该运行良好,并且经过测试。并告诉我们您使用的是哪个 CGAL 版本。
    • 我只是指您发布的链接中的第 7.3.4 节。我宁愿不遇到这些,我也不想改变我的项目,因为它的工作原理与安装的 CGAL 版本一样。真的没有办法让 CMake 变量直接指向 DLL/SO 列表吗?作为参考,来自 Nvidia 共享示例源的 FindOptiX.cmake 文件这样做:github.com/nvpro-samples/shared_sources/blob/master/cmake/…
    • 您应该阅读第 7.3.4 节。你真的关心CGAL::get_default_random() 为你的整个应用程序返回一个全局单例吗?
    猜你喜欢
    • 1970-01-01
    • 2020-05-23
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多