diff --git a/Installation/cmake/modules/FindCGALBasicViewer.cmake b/Installation/cmake/modules/FindCGALBasicViewer.cmake deleted file mode 100644 index c2570caea23..00000000000 --- a/Installation/cmake/modules/FindCGALBasicViewer.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# This file must be included in your CMakeLists.txt to use the basic viewer -# You need to link the libraries in your executable by using -# TARGET_LINK_LIBRARIES( myexec ${BASIC_VIEWER_LIBRARIES}) - -if ( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND) - message(STATUS "NOTICE: Libraries for basic viewer not found " - "(CGAL, Qt5, QGLViewer).") -endif( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND) - -include( ${CGAL_USE_FILE} ) -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -FIND_PACKAGE(Qt5 REQUIRED COMPONENTS OpenGL Xml) -find_package(QGLViewer REQUIRED) -find_package(OpenGL REQUIRED) - -add_definitions(${QT_DEFINITIONS}) -add_definitions(-DQT_NO_KEYWORDS) - -set (BASIC_VIEWER_LIBRARIES ${QT_LIBRARIES} ) - -set(BASIC_VIEWER_MODULES Xml OpenGL) - -ADD_DEFINITIONS("-DCGAL_USE_BASIC_VIEWER") -message(STATUS "Libraries for lcc_viewer found. You need to link them " - "in your executable by using " - "TARGET_LINK_LIBRARIES( myexec \${BASIC_VIEWER_LIBRARIES})") - -set(USE_BASIC_VIEWER true) diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index 70c0eccfa66..27a2586ea20 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -9,13 +9,8 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() -# If you want to visualize a linear cell complex, you can use the following viewer -# based on qt. Just uncomment the following line, plus the line find_package(CGALBasicViewer) below find_package(CGAL COMPONENTS Qt5) -# If you don't want to visualize, use the following line (otherwise comment it) -# find_package(CGAL QUIET) - # For Gprof. # ADD_DEFINITIONS("-pg") # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") @@ -25,7 +20,6 @@ find_package(CGAL COMPONENTS Qt5) if ( CGAL_FOUND ) include(${CGAL_USE_FILE}) - find_package(CGALBasicViewer) include( CGAL_CreateSingleSourceCGALProgram ) include_directories(BEFORE ../../include) @@ -42,10 +36,22 @@ if ( CGAL_FOUND ) create_single_source_cgal_program("linear_cell_complex_3_operations.cpp") create_single_source_cgal_program("display_linear_cell_complex.cpp") -if (USE_BASIC_VIEWER) - target_link_libraries(display_linear_cell_complex ${BASIC_VIEWER_LIBRARIES}) - qt5_use_modules(display_linear_cell_complex ${BASIC_VIEWER_MODULES}) -endif(USE_BASIC_VIEWER) + if(CGAL_Qt5_FOUND) + find_package(Qt5 REQUIRED COMPONENTS OpenGL Xml) + find_package(QGLViewer REQUIRED) + find_package(OpenGL REQUIRED) + add_definitions(${QT_DEFINITIONS}) + add_definitions(-DQT_NO_KEYWORDS) + include_directories( ${QGLVIEWER_INCLUDE_DIR} ) + add_definitions(${QGLVIEWER_DEFINITIONS}) + + target_link_libraries(display_linear_cell_complex CGAL::CGAL_Qt5 + ${QT_LIBRARIES} + ${QGLVIEWER_LIBRARIES} + ${OPENGL_gl_LIBRARY}) + target_compile_definitions(display_linear_cell_complex PRIVATE CGAL_USE_BASIC_VIEWER) + endif() + else() message(STATUS "This program requires the CGAL library, " diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_viewer_qt.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_viewer_qt.h index 934709d65f8..ca3eeb2d13b 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_viewer_qt.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_viewer_qt.h @@ -210,6 +210,12 @@ void draw(const LCC& alcc, app.exec(); } +template +void draw(const LCC& alcc, + const char* title="LCC Viewer", + bool nofill=false) +{ return draw(alcc, title, nofill); } + } // End namespace CGAL #else // CGAL_USE_BASIC_VIEWER @@ -219,9 +225,18 @@ namespace CGAL template void draw(const LCC&, - const char*="LCC Viewer", + const char* ="LCC Viewer", bool=false, - const ColorFunctor&=ColorFunctor()) + const ColorFunctor& =ColorFunctor()) +{ + std::cerr<<"Impossible to draw a Linear_cell_complex because CGAL_USE_BASIC_VIEWER is not defined." + < +void draw(const LCC&, + const char* ="LCC Viewer", + bool=false) { std::cerr<<"Impossible to draw a Linear_cell_complex because CGAL_USE_BASIC_VIEWER is not defined." < -void draw(const LCC& alcc, - const char* title="LCC Viewer", - bool nofill=false) -{ return draw(alcc, title, nofill); } - -} // End namespace CGAL - #endif // CGAL_LCC_VIEWER_QT_H