HEKTO
HEKTO

Reputation: 4191

Problem with building the CGAL 5.0 demo GraphicsView

I've installed the CGAL 5.0 on my Ubuntu 18.04.3 box (into my home directory) and tried to build some visualization demos - no success. For example the demo directory <my CGAL root>/demo/GraphicsView contains the following CMakeLists.txt file:

# 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()

The command cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=<my CGAL root> . generates the output below:

-- 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.
...

The <my CGAL root>/include/CGAL/Qt directory exists and contains a lot of headers - so, the message "<CGAL/Qt/*.h> headers cannot be configured" looks very suspicious.

What can I try to overcome this problem?

UPDATE #1. This is a problem with CGAL 5.0 only, and only if it's built with the option CGAL_HEADER_ONLY=OFF. The culprit is most probably inside CGAL 5.0 *.cmake files.

UPDATE #2. I used my script (below) to build and install the 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}

Upvotes: 1

Views: 580

Answers (1)

lrineau
lrineau

Reputation: 6294

(Thanks for your patience in reporting the bug.)

There is indeed a logic error in CGAL-5.0, when installed in non-header-only mode. I will issue a fix soon. And a new release CGAL-5.0.1.

Can you please try with this patch?

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        )

The patch applies to CGAL-5.0/ with patch -p2. Once the patch is applied, please reinstall CGAL.

Update: here is the pull-request, in Github: https://github.com/CGAL/cgal/pull/4459

Upvotes: 1

Related Questions