我已经在Ubuntu 18.04.3盒中(已安装到主目录中)安装了CGAL 5.0,并尝试构建一些可视化演示-没有成功。例如,演示目录<my CGAL root>/demo/GraphicsView
包含以下CMakeLists.txt
文件:
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.15)
project (GraphicsView_Demo)
if(NOT POLICY CMP0070 AND POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
find_package(CGAL COMPONENTS Qt5)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable ( min min.cpp ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
add_to_cached_list( CGAL_EXECUTABLE_TARGETS min )
target_link_libraries( min PRIVATE
CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui )
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
cgal_add_compilation_test(min)
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()
命令cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=<my CGAL root> .
在下面生成输出:
-- Found Boost: /usr/include (found version "1.65.1")
-- Found Boost: /usr/include (found suitable version "1.65.1", minimum required is "1.48")
-- Boost include dirs: /usr/include
-- Boost libraries:
-- libCGAL_Qt5 is missing the dependencies: <CGAL/Qt/*.h> headers cannot be configured.
-- NOTICE: The CGAL_Qt5 library was not configured.
-- NOTICE: This demo requires CGAL and Qt5, and will not be compiled.
...
<my CGAL root>/include/CGAL/Qt
目录存在并且包含许多标题-因此,消息“ <CGAL/Qt/*.h>
标题无法配置”看起来非常可疑。
我该如何克服这个问题?
UPDATE#1。这是CGAL 5.0 only和only的问题,如果它是使用选项CGAL_HEADER_ONLY=OFF
构建的。罪魁祸首很可能是在CGAL 5.0 *.cmake
文件中。
UPDATE#2。我使用下面的脚本来构建和安装CGAL 5.0。
PKG_NAME=CGAL
PKG_VER=5.0
PKG_FULL_NAME=${PKG_NAME}-${PKG_VER}
sudo apt install libgmp-dev
sudo apt install libmpfr-dev
sudo apt install qt5-default
sudo apt install qtscript5-dev
DST_DIR=${HOME}/apps/CGAL/CGAL-5.0
ZIP_DIR=${HOME}/soft
cd /tmp
tar xJvf ${ZIP_DIR}/${PKG_FULL_NAME}.tar.xz
cd ${PKG_FULL_NAME}
mkdir -p build && pushd build
cmake -DCMAKE_INSTALL_PREFIX=${DST_DIR} -DCMAKE_BUILD_TYPE=Release -DCGAL_HEADER_ONLY=OFF ..
make
make install
popd
cp -pr demo ${DST_DIR}
cp -pr examples ${DST_DIR}
cd ..
rm -fr ${PKG_FULL_NAME}
您可以尝试使用此补丁吗?
diff --git a/Installation/cmake/modules/CGALConfig_install.cmake.in b/Installation/cmake/modules/CGALConfig_install.cmake.in
index 873fa8c6a9e..cb51524dcfa 100644
--- a/Installation/cmake/modules/CGALConfig_install.cmake.in
+++ b/Installation/cmake/modules/CGALConfig_install.cmake.in
@@ -55,7 +55,7 @@ set(CGAL_ImageIO_USE_ZLIB "@CGAL_ImageIO_USE_ZLIB@" )
set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")
set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
-set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CGAL_INCLUDE_DIRS}/CGAL/" CACHE INTERNAL "Directory containing the GraphicsView package")
+set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CGAL_INSTALL_PREFIX}" CACHE INTERNAL "Directory containing the GraphicsView package")
if ( CGAL_FIND_REQUIRED )
set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE )
此补丁适用于带有patch -p2
的CGAL-5.0 /。应用补丁后,请重新安装CGAL。
更新:这是Github中的请求请求:https://github.com/CGAL/cgal/pull/4459