构建 CGAL 5.0 演示 GraphicsView 的问题
Problem with building the CGAL 5.0 demo GraphicsView
我已经在 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
目录存在并且包含很多 headers - 所以,消息 "<CGAL/Qt/*.h>
headers 无法配置"= 37=] 看起来很可疑。
我可以尝试什么来克服这个问题?
更新#1。这是 CGAL 5.0 仅 和 仅 的问题如果它是使用 CGAL_HEADER_ONLY=OFF
选项构建的。罪魁祸首很可能在 CGAL 5.0 *.cmake
文件中。
更新 #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}
(感谢您耐心报告错误。)
在non-header-only模式下安装时,CGAL-5.0确实存在逻辑错误。我会尽快发布修复程序。以及新版本 CGAL-5.0.1.
你能试试这个补丁吗?
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。
更新:这里是 pull-request,在 Github 中:https://github.com/CGAL/cgal/pull/4459
我已经在 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
目录存在并且包含很多 headers - 所以,消息 "<CGAL/Qt/*.h>
headers 无法配置"= 37=] 看起来很可疑。
我可以尝试什么来克服这个问题?
更新#1。这是 CGAL 5.0 仅 和 仅 的问题如果它是使用 CGAL_HEADER_ONLY=OFF
选项构建的。罪魁祸首很可能在 CGAL 5.0 *.cmake
文件中。
更新 #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}
(感谢您耐心报告错误。)
在non-header-only模式下安装时,CGAL-5.0确实存在逻辑错误。我会尽快发布修复程序。以及新版本 CGAL-5.0.1.
你能试试这个补丁吗?
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。
更新:这里是 pull-request,在 Github 中:https://github.com/CGAL/cgal/pull/4459