diff --git a/.gitignore b/.gitignore index cf6ea13ac18..7aa0d0711d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1094,6 +1094,9 @@ cgal_test_with_cmake.log # File created by the Semantic Bovinator (an Emacs package) semantic.cache +# Python cache files +*.pyc + # Files produced by a Qt compilation/execution .qglviewer.xml *.moc diff --git a/AABB_tree/demo/AABB_tree/CMakeLists.txt b/AABB_tree/demo/AABB_tree/CMakeLists.txt index d17a40894f3..77b7c395440 100644 --- a/AABB_tree/demo/AABB_tree/CMakeLists.txt +++ b/AABB_tree/demo/AABB_tree/CMakeLists.txt @@ -27,15 +27,12 @@ find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg) include( ${CGAL_USE_FILE} ) -# Find OpenGL -find_package(OpenGL) - # Find QGLViewer if(Qt5_FOUND) find_package(QGLViewer) endif(Qt5_FOUND) -if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND) include_directories ( ${QGLVIEWER_INCLUDE_DIR} ) @@ -59,20 +56,19 @@ if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FO "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" ) add_executable ( AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules(AABB_demo Gui OpenGL Xml Script Svg ) # Link with Qt libraries - target_link_libraries( AABB_demo ${QT_LIBRARIES} ) - - # Link with CGAL - target_link_libraries( AABB_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) - - # Link with libQGLViewer, OpenGL - target_link_libraries( AABB_demo ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + target_link_libraries( AABB_demo PRIVATE + Qt5::OpenGL Qt5::Gui + CGAL::CGAL + CGAL::CGAL_Qt5 + ${QGLVIEWER_LIBRARIES}) add_to_cached_list( CGAL_EXECUTABLE_TARGETS AABB_demo ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(AABB_demo) -else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND) set(AABB_MISSING_DEPS "") @@ -88,14 +84,10 @@ else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}") endif() - if(NOT OPENGL_FOUND) - set(AABB_MISSING_DEPS "OpenGL, ${AABB_MISSING_DEPS}") - endif() - if(NOT QGLVIEWER_FOUND) set(AABB_MISSING_DEPS "QGLViewer, ${AABB_MISSING_DEPS}") endif() message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.") -endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND) diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index 19b07ee9b6f..09277853f80 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -595,6 +595,7 @@ void Scene::draw(QGLViewer* viewer) initGL(); if(!are_buffers_initialized) initialize_buffers(); + gl->glEnable(GL_DEPTH_TEST); QColor color; QMatrix4x4 fMatrix; fMatrix.setToIdentity(); @@ -663,7 +664,7 @@ void Scene::draw(QGLViewer* viewer) //cutting_segments fMatrix.setToIdentity(); - ::glLineWidth(2.0f); + gl->glLineWidth(2.0f); vao[3].bind(); attrib_buffers(viewer); rendering_program.bind(); @@ -671,7 +672,7 @@ void Scene::draw(QGLViewer* viewer) rendering_program.setUniformValue(colorLocation, color); rendering_program.setUniformValue(fLocation, fMatrix); gl->glDrawArrays(GL_LINES, 0, static_cast(pos_cut_segments.size()/3)); - ::glLineWidth(1.0f); + gl->glLineWidth(1.0f); rendering_program.release(); vao[3].release(); //grid @@ -690,8 +691,8 @@ void Scene::draw(QGLViewer* viewer) //cutting_plane // for(int i=0; i< 16 ; i++) // fMatrix.data()[i] = m_frame->matrix()[i]; - ::glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - ::glEnable(GL_BLEND); + gl->glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + gl->glEnable(GL_BLEND); vao[4].bind(); attrib_buffers(viewer); rendering_program.bind(); @@ -699,7 +700,7 @@ void Scene::draw(QGLViewer* viewer) rendering_program.setUniformValue(colorLocation, color); rendering_program.setUniformValue(fLocation, fMatrix); gl->glDrawArrays(GL_TRIANGLES, 0, static_cast(pos_plane.size()/3)); - ::glDisable(GL_BLEND); + gl->glDisable(GL_BLEND); rendering_program.release(); vao[4].release(); diff --git a/AABB_tree/demo/AABB_tree/Viewer.cpp b/AABB_tree/demo/AABB_tree/Viewer.cpp index 2f411def1df..56de4c959eb 100644 --- a/AABB_tree/demo/AABB_tree/Viewer.cpp +++ b/AABB_tree/demo/AABB_tree/Viewer.cpp @@ -18,7 +18,6 @@ void Viewer::setScene(Scene* pScene) void Viewer::draw() { - glEnable(GL_DEPTH_TEST); QGLViewer::draw(); if(m_pScene != NULL) { diff --git a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt index abab6b42775..366cc0cb9c2 100644 --- a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt @@ -1,22 +1,21 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - - project( Algebraic_kernel_d_Examples ) -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.1) -find_package(CGAL QUIET COMPONENTS Core MPFI) +find_package(CGAL QUIET COMPONENTS Core) if ( CGAL_FOUND ) - include( ${CGAL_USE_FILE} ) + find_package(MPFI QUIET) +endif() + +if( CGAL_FOUND AND MPFI_FOUND) + + include( ${MPFI_USE_FILE} ) include( CGAL_CreateSingleSourceCGALProgram ) include( CGAL_VersionUtils ) - include_directories (BEFORE ../../include) - create_single_source_cgal_program( "Compare_1.cpp" ) create_single_source_cgal_program( "Construct_algebraic_real_1.cpp" ) create_single_source_cgal_program( "Isolate_1.cpp" ) @@ -25,7 +24,6 @@ if ( CGAL_FOUND ) else() - message(STATUS "This program requires the CGAL library, and will not be compiled.") + message(STATUS "This program requires the CGAL library and MPFI, and will not be compiled.") endif() - diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt index 4c1f780b71e..5d1ddbaa0e5 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt @@ -1,13 +1,10 @@ -# Created by the script cgal_create_CMakeLists -# This is the CMake script for compiling a set of CGAL applications. - project( Algebraic_kernel_d_Tests ) -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.1) # CGAL and its components -find_package( CGAL QUIET COMPONENTS Core RS3) +find_package( CGAL QUIET COMPONENTS Core) if ( NOT CGAL_FOUND ) @@ -19,6 +16,15 @@ endif() # include helper file include( ${CGAL_USE_FILE} ) +find_package(RS3 QUIET) + +if(MPFI_FOUND) + include( ${MPFI_USE_FILE} ) +endif() +if(RS3_FOUND) + include( ${RS3_USE_FILE} ) +endif() + include( CGAL_CreateSingleSourceCGALProgram ) # Boost and its components diff --git a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt index b15bdba99c7..3e4a711fc77 100644 --- a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt @@ -21,10 +21,9 @@ include(${CGAL_USE_FILE}) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) -find_package(OpenGL) find_package(QGLViewer) -if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) +if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND ) add_definitions(-DQT_NO_KEYWORDS) @@ -40,15 +39,18 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_ qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Alpha_shape_3.qrc ) add_executable ( Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules(Alpha_shape_3 Xml Script OpenGL Svg) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shape_3 ) - target_link_libraries( Alpha_shape_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) - target_link_libraries( Alpha_shape_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ) - target_link_libraries( Alpha_shape_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + target_link_libraries( Alpha_shape_3 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 + Qt5::OpenGL Qt5::Gui + ${QGLVIEWER_LIBRARIES} ) + + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Alpha_shape_3) else() - message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.") + message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, and Qt5, and will not be compiled.") endif() diff --git a/Alpha_shapes_3/demo/Alpha_shapes_3/Viewer.cpp b/Alpha_shapes_3/demo/Alpha_shapes_3/Viewer.cpp index a5a0dd2f222..69d8df641a2 100644 --- a/Alpha_shapes_3/demo/Alpha_shapes_3/Viewer.cpp +++ b/Alpha_shapes_3/demo/Alpha_shapes_3/Viewer.cpp @@ -335,7 +335,7 @@ Viewer::draw() rendering_program_points.bind(); color.setRgbF(1.0f, 0.0f, 0.0f); glPointSize(5); - ::glEnable(GL_POINT_SMOOTH); + glEnable(GL_POINT_SMOOTH); rendering_program_points.setUniformValue(colorLocation_points, color); glDrawArrays(GL_POINTS, 0, static_cast(pos_points.size()/3)); rendering_program_points.release(); diff --git a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt index 2991c82c7c3..8542a68811b 100644 --- a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt +++ b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt @@ -8,12 +8,14 @@ cmake_minimum_required(VERSION 2.8.11) -find_package(CGAL QUIET COMPONENTS Core GMP MPFR) +find_package(CGAL QUIET COMPONENTS Core) if ( CGAL_FOUND) include( ${CGAL_USE_FILE} ) endif() +find_package(GMP QUIET) + if ( CGAL_FOUND AND GMP_FOUND ) include( CGAL_VersionUtils ) @@ -30,6 +32,8 @@ if ( CGAL_FOUND AND GMP_FOUND ) find_package( MPFI ) if( MPFI_FOUND ) + include( ${MPFI_USE_FILE} ) + # for the testsuite, the version of MPFI shipped with RS is used; this # version needs GMP>=4.2, so we require this dependency only here and # not in FindMPFI.cmake diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt index fc73f917578..e74250bee26 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt @@ -11,7 +11,7 @@ endif() find_package(CGAL COMPONENTS Core Qt5 ) include( ${CGAL_USE_FILE} ) -find_package( Qt5 QUIET COMPONENTS Script Widgets ) +find_package( Qt5 QUIET COMPONENTS Gui ) if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND CGAL_Core_FOUND) include_directories( ./ ) @@ -68,15 +68,15 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND CGAL_Core_FOUND) ${arrangement_2_uis} ${CGAL_Qt5_RESOURCE_FILES} ) - qt5_use_modules(arrangement_2 Widgets Script) - target_link_libraries( arrangement_2 - ${CGAL_LIBRARIES} - ${CGAL_3RD_PARTY_LIBRARIES} - ${QT_LIBRARIES} + target_link_libraries( arrangement_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Core + Qt5::Gui ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS arrangement_2 ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(arrangement_2) else() message(STATUS "NOTICE: This demo requires CGAL, CGAL-Core and Qt5, and will not be compiled.") diff --git a/BGL/examples/BGL_OpenMesh/CMakeLists.txt b/BGL/examples/BGL_OpenMesh/CMakeLists.txt index b30cfbffd2c..97f02a51da8 100644 --- a/BGL/examples/BGL_OpenMesh/CMakeLists.txt +++ b/BGL/examples/BGL_OpenMesh/CMakeLists.txt @@ -54,7 +54,7 @@ include_directories( BEFORE ../../include ) include( CGAL_CreateSingleSourceCGALProgram ) if(OpenMesh_FOUND) -create_single_source_cgal_program( "TriMesh.cpp" ) - target_link_libraries( TriMesh ${OPENMESH_LIBRARIES} ) + create_single_source_cgal_program( "TriMesh.cpp" ) + target_link_libraries( TriMesh PRIVATE ${OPENMESH_LIBRARIES} ) endif() diff --git a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt index 5fab077f346..5c73daedb41 100644 --- a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt +++ b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt @@ -69,6 +69,6 @@ create_single_source_cgal_program( "copy_polyhedron.cpp" ) if(OpenMesh_FOUND) - target_link_libraries( copy_polyhedron ${OPENMESH_LIBRARIES} ) + target_link_libraries( copy_polyhedron PRIVATE ${OPENMESH_LIBRARIES} ) endif() diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index bb99beeddef..9479d6a3f57 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -51,7 +51,7 @@ include( CGAL_CreateSingleSourceCGALProgram ) if(OpenMesh_FOUND) create_single_source_cgal_program( "graph_concept_OpenMesh.cpp" ) - target_link_libraries( graph_concept_OpenMesh ${OPENMESH_LIBRARIES} ) + target_link_libraries( graph_concept_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} ) endif() create_single_source_cgal_program( "next.cpp" ) @@ -101,10 +101,10 @@ create_single_source_cgal_program( "test_graph_traits.cpp" ) create_single_source_cgal_program( "test_Properties.cpp" ) if(OpenMesh_FOUND) - target_link_libraries( test_clear ${OPENMESH_LIBRARIES}) - target_link_libraries( test_Euler_operations ${OPENMESH_LIBRARIES}) - target_link_libraries( test_Face_filtered_graph ${OPENMESH_LIBRARIES}) - target_link_libraries( test_graph_traits ${OPENMESH_LIBRARIES} ) - target_link_libraries( test_Properties ${OPENMESH_LIBRARIES}) + target_link_libraries( test_clear PRIVATE ${OPENMESH_LIBRARIES}) + target_link_libraries( test_Euler_operations PRIVATE ${OPENMESH_LIBRARIES}) + target_link_libraries( test_Face_filtered_graph PRIVATE ${OPENMESH_LIBRARIES}) + target_link_libraries( test_graph_traits PRIVATE ${OPENMESH_LIBRARIES} ) + target_link_libraries( test_Properties PRIVATE ${OPENMESH_LIBRARIES}) + target_link_libraries( test_bgl_read_write PRIVATE ${OPENMESH_LIBRARIES}) endif() - diff --git a/CGALConfig.cmake b/CGALConfig.cmake new file mode 100644 index 00000000000..819331d263c --- /dev/null +++ b/CGALConfig.cmake @@ -0,0 +1,6 @@ +# +# This file points to the CGALConfig.cmake for a pure header-only +# CGAL installation. +# + +include(${CMAKE_CURRENT_LIST_DIR}/Installation/lib/cmake/CGAL/CGALConfig.cmake) diff --git a/CGAL_Core/include/CGAL/CORE/ExprRep.h b/CGAL_Core/include/CGAL/CORE/ExprRep.h index 3517709f5d0..c74c4fd7374 100644 --- a/CGAL_Core/include/CGAL/CORE/ExprRep.h +++ b/CGAL_Core/include/CGAL/CORE/ExprRep.h @@ -160,12 +160,12 @@ struct NodeInfo { // Members: private: int refCount, // public: NodeInfo* nodeInfo, // filteredFp ffVal. -class ExprRep { +class CGAL_CORE_EXPORT ExprRep { public: /// \name Constructor and Destructor //@{ /// default constructor - CGAL_CORE_EXPORT ExprRep(); + ExprRep(); /// virtual destructor for this base class virtual ~ExprRep() { if (nodeInfo != NULL) // This check is only for optimization. @@ -197,8 +197,8 @@ public: /// \name Helper Functions //@{ /// Get the approximate value - CGAL_CORE_EXPORT const Real & getAppValue(const extLong& relPrec = get_static_defRelPrec(), - const extLong& absPrec = get_static_defAbsPrec()); + const Real & getAppValue(const extLong& relPrec = get_static_defRelPrec(), + const extLong& absPrec = get_static_defAbsPrec()); /// Get the sign. int getSign(); int getExactSign(); @@ -433,23 +433,23 @@ public: /// compute the sign, uMSB, lMSB, etc. virtual void computeExactFlags() = 0; /// compute the minimal root bound - CGAL_CORE_EXPORT extLong computeBound(); + extLong computeBound(); /// driver function to approximate - CGAL_CORE_EXPORT void approx(const extLong& relPrec, const extLong& absPrec); + void approx(const extLong& relPrec, const extLong& absPrec); /// compute an approximate value satifying the specified precisions virtual void computeApproxValue(const extLong&, const extLong&) = 0; /// Test whether the current approx. value satisfies [relPrec, absPrec] - CGAL_CORE_EXPORT bool withinKnownPrecision(const extLong&, const extLong&); + bool withinKnownPrecision(const extLong&, const extLong&); //@} /// \name Misc Functions //@{ /// reduce current node - CGAL_CORE_EXPORT void reduceToBigRat(const BigRat&); + void reduceToBigRat(const BigRat&); /// reduce current node - CGAL_CORE_EXPORT void reduceTo(const ExprRep*); + void reduceTo(const ExprRep*); /// reduce current node to zero - CGAL_CORE_EXPORT void reduceToZero(); + void reduceToZero(); /// return operator string virtual const std::string op() const { return "UNKNOWN"; @@ -459,7 +459,7 @@ public: /// \name Degree Bound Functions //@{ /// compute "d_e" based on # of sqrts - CGAL_CORE_EXPORT extLong degreeBound(); + extLong degreeBound(); /// count actually computes the degree bound of current node. virtual extLong count() = 0; /// reset the flag "visited" @@ -473,7 +473,7 @@ public: /// \class ConstRep /// \brief constant node -class ConstRep : public ExprRep { +class CGAL_CORE_EXPORT ConstRep : public ExprRep { public: /// \name Constructors and Destructor //@{ @@ -486,20 +486,20 @@ public: /// \name Debug Functions //@{ /// print debug information in list mode - CGAL_CORE_EXPORT void debugList(int level, int depthLimit) const; + void debugList(int level, int depthLimit) const; /// print debug information in tree mode - CGAL_CORE_EXPORT void debugTree(int level, int indent, int depthLimit) const; + void debugTree(int level, int indent, int depthLimit) const; //@} protected: /// initialize nodeInfo - CGAL_CORE_EXPORT virtual void initNodeInfo(); + virtual void initNodeInfo(); /// return operator in string const std::string op() const { return "C"; } /// count returns the degree of current node //extLong count() { return d_e(); } - CGAL_CORE_EXPORT extLong count(); + extLong count(); /// clear visited flag void clearFlag() { visited() = false; diff --git a/CGAL_Core/src/CGAL_Core/CMakeLists.txt b/CGAL_Core/src/CGAL_Core/CMakeLists.txt index 3f4adc37b31..0ce25c586ca 100644 --- a/CGAL_Core/src/CGAL_Core/CMakeLists.txt +++ b/CGAL_Core/src/CGAL_Core/CMakeLists.txt @@ -1,33 +1,18 @@ +include(CGAL_SetupCGAL_CoreDependencies) + message("Configuring libCGAL_Core") +if(CGAL_Core_FOUND) -use_essential_libs() + collect_cgal_library(CGAL_Core "") -if (NOT MSVC) - # See the release notes of CGAL-4.10: CGAL_Core now requires - # Boost.Thread, with all compilers but MSVC. - find_package( Boost 1.48 REQUIRED thread system ) - cache_set(CGAL_Core_3RD_PARTY_LIBRARIES ${CGAL_Core_3RD_PARTY_LIBRARIES} ${Boost_LIBRARIES} ) -endif(NOT MSVC) + if(CGAL_HEADER_ONLY) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() -include_directories (SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS}) + CGAL_setup_CGAL_Core_dependencies(CGAL_Core ${keyword}) -add_definitions(${CGAL_3RD_PARTY_DEFINITIONS}) - -link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} ) - -collect_cgal_library(CGAL_Core "") - -if(NOT CGAL_HEADER_ONLY) - # CGAL_Core does not depend on CGAL in either DEBUG or RELEASE, but we - # still link it. - target_link_libraries( CGAL_Core CGAL ${CGAL_3RD_PARTY_LIBRARIES} ) - target_link_libraries( CGAL_Core ${CGAL_Core_3RD_PARTY_LIBRARIES} ) - - add_dependencies( CGAL_Core CGAL ) -else() - target_link_libraries( CGAL_Core INTERFACE ${CGAL_3RD_PARTY_LIBRARIES} ) - target_link_libraries( CGAL_Core INTERFACE ${CGAL_Core_3RD_PARTY_LIBRARIES} ) + message("libCGAL_Core is configured") endif() -message("libCGAL_Core is configured") - diff --git a/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt b/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt index 87ec974ca81..f9c2a7eeac9 100644 --- a/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt +++ b/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt @@ -1,52 +1,22 @@ message("Configuring libCGAL_ImageIO") -find_package( ZLIB ) - -if(ZLIB_FOUND) - get_dependency_version(ZLIB) - cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ) - cache_set(CGAL_ImageIO_3RD_PARTY_LIBRARIES ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ${ZLIB_LIBRARY} ) - cache_set(CGAL_ImageIO_3RD_PARTY_DEFINITIONS "-DCGAL_USE_ZLIB") - cache_set(CGAL_ImageIO_USE_ZLIB "ON") -endif(ZLIB_FOUND) - -set( CGAL_ImageIO_BASENAME CGAL_ImageIO) - -if(COMMAND add_config_flag) - set( CGAL_HAS_IMAGEIO TRUE ) - add_config_flag( CGAL_HAS_IMAGEIO ) -endif() - -use_essential_libs() - -if (CGAL_HEADER_ONLY) - cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) -else() - include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ) - link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} ) - add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_ImageIO_3RD_PARTY_DEFINITIONS} ) -endif() - collect_cgal_library( CGAL_ImageIO "") -if (NOT CGAL_HEADER_ONLY) +include(CGAL_SetupCGAL_ImageIODependencies) - add_dependencies( CGAL_ImageIO CGAL ) +if(CGAL_HEADER_ONLY) + set(keyword "INTERFACE") +endif() - # CGAL_ImageIO only depends on CGAL in DEBUG, but we still link it - # in both build types. - target_link_libraries( CGAL_ImageIO CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ) +CGAL_setup_CGAL_ImageIO_dependencies(CGAL_ImageIO ${keyword}) -else() - - target_link_libraries( CGAL_ImageIO INTERFACE ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ) - target_include_directories( CGAL_ImageIO INTERFACE ${CGAL_3RD_PARTY_LIBRARIES_DIRS}) +if(COMMAND add_config_flag) + set( CGAL_HAS_IMAGEIO TRUE ) + add_config_flag( CGAL_HAS_IMAGEIO ) +endif() +if(ZLIB_FOUND) + get_dependency_version(ZLIB) endif() message("libCGAL_ImageIO is configured") - -if(NOT ZLIB_FOUND) - message( STATUS "NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.") -endif() - diff --git a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt index d737ffa2aff..26a9442a90e 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt @@ -125,22 +125,28 @@ if ( CGAL_FOUND ) message(STATUS "Set Ipelets install dir: ${IPELET_INSTALL_DIR}") endif() + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + foreach(IPELET ${CGAL_IPELETS}) add_library(CGAL_${IPELET} MODULE ${IPELET}.cpp) add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGAL_${IPELET}) - target_link_libraries(CGAL_${IPELET} ${IPE_LIBRARIES}) + target_link_libraries(CGAL_${IPELET} PRIVATE CGAL::CGAL ${IPE_LIBRARIES}) if ( IPELET_INSTALL_DIR ) install(TARGETS CGAL_${IPELET} DESTINATION ${IPELET_INSTALL_DIR}) if (WITH_IPE_7) install(FILES ./lua/libCGAL_${IPELET}.lua DESTINATION ${IPELET_INSTALL_DIR}) #only for ipe 7 endif() endif () + cgal_add_compilation_test(CGAL_${IPELET}) endforeach(IPELET) + target_link_libraries(CGAL_cone_spanners PRIVATE CGAL::CGAL_Core) #example in doc not installed add_library(simple_triangulation MODULE simple_triangulation.cpp) add_to_cached_list(CGAL_EXECUTABLE_TARGETS simple_triangulation) target_link_libraries(simple_triangulation ${IPE_LIBRARIES}) + cgal_add_compilation_test(simple_triangulation) + else() message(STATUS "NOTICE: This program requires the Ipe include files and library, and will not be compiled.") endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c702f30227..88cfc9acacc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 2.8.11) set( CGAL_BRANCH_BUILD ON CACHE INTERNAL "Create CGAL from a Git branch" FORCE) include(${CMAKE_SOURCE_DIR}/Installation/cmake/modules/CGAL_SCM.cmake) +CGAL_detect_git(${CMAKE_SOURCE_DIR}) # add option for duplicate file detection option( CGAL_REPORT_DUPLICATE_FILES "Switch on to start (naive) detection of duplicate source- and headerfiles in packages" OFF) diff --git a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt index 6614a2fe820..1e974c06be3 100644 --- a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt @@ -11,10 +11,9 @@ include(${CGAL_USE_FILE}) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL) -find_package(OpenGL) find_package(QGLViewer) -if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) +if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND ) include_directories (${QGLVIEWER_INCLUDE_DIR}) @@ -22,16 +21,20 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_ add_executable (Circular_kernel_3 Circular_kernel_3.cpp Viewer.cpp ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules( Circular_kernel_3 Xml Script OpenGL) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_3 ) - target_link_libraries( Circular_kernel_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) - target_link_libraries( Circular_kernel_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ) - target_link_libraries( Circular_kernel_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + target_link_libraries( Circular_kernel_3 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 + Qt5::OpenGL Qt5::Gui ${QGLVIEWER_LIBRARIES} ) + + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Circular_kernel_3) + + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Circular_kernel_3) else() - message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.") + message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, and Qt5, and will not be compiled.") endif() diff --git a/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp b/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp index 0036038b6de..1b252a05eb1 100644 --- a/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp +++ b/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp @@ -860,10 +860,10 @@ void Viewer::init() compile_shaders(); compute_elements(); initialize_buffers(); - ::glEnable(GL_BLEND); + glEnable(GL_BLEND); - ::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_POINT_SMOOTH); glEnable(GL_LINE_SMOOTH); diff --git a/Classification/examples/Classification/CMakeLists.txt b/Classification/examples/Classification/CMakeLists.txt index 58170a221f0..80a80c42062 100644 --- a/Classification/examples/Classification/CMakeLists.txt +++ b/Classification/examples/Classification/CMakeLists.txt @@ -32,11 +32,6 @@ if ( NOT Boost_FOUND ) endif() find_package( TBB ) -if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) -endif() - find_package(OpenCV QUIET) @@ -54,13 +49,16 @@ include( CGAL_CreateSingleSourceCGALProgram ) set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) create_single_source_cgal_program( "example_classification.cpp" CXX_FEATURES ${needed_cxx_features} ) +if(TBB_FOUND) + CGAL_target_use_TBB(example_classification) +endif() create_single_source_cgal_program( "example_generation_and_training.cpp" CXX_FEATURES ${needed_cxx_features} ) create_single_source_cgal_program( "example_feature.cpp" CXX_FEATURES ${needed_cxx_features} ) if( OpenCV_FOUND ) include_directories( ${OpenCV_INCLUDE_DIRS} ) create_single_source_cgal_program( "example_random_forest.cpp" CXX_FEATURES ${needed_cxx_features} ) - target_link_libraries( example_random_forest ${OpenCV_LIBS} ) + target_link_libraries( example_random_forest PRIVATE ${OpenCV_LIBS} ) else() message(STATUS "OpenCV not found, random forest example won't be compiled.") endif() diff --git a/Classification/test/Classification/CMakeLists.txt b/Classification/test/Classification/CMakeLists.txt index 7d085c187a2..30b903bf36c 100644 --- a/Classification/test/Classification/CMakeLists.txt +++ b/Classification/test/Classification/CMakeLists.txt @@ -38,10 +38,6 @@ if ( NOT Boost_FOUND ) endif() find_package( TBB ) -if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) -endif() # include for local directory include_directories( BEFORE include ) @@ -60,3 +56,6 @@ include( CGAL_CreateSingleSourceCGALProgram ) set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) create_single_source_cgal_program( "test_classification_point_set.cpp" CXX_FEATURES ${needed_cxx_features} ) +if(TBB_FOUND) + CGAL_target_use_TBB( test_classification_point_set ) +endif() diff --git a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt index b7e26cfcf2b..c87ed7a4d4b 100644 --- a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt @@ -69,6 +69,6 @@ if(OpenMesh_FOUND) create_single_source_cgal_program( "quickhull_OM_3.cpp" ) create_single_source_cgal_program( "dynamic_hull_OM_3.cpp" ) - target_link_libraries( quickhull_OM_3 ${OPENMESH_LIBRARIES} ) - target_link_libraries( dynamic_hull_OM_3 ${OPENMESH_LIBRARIES} ) + target_link_libraries( quickhull_OM_3 PRIVATE ${OPENMESH_LIBRARIES} ) + target_link_libraries( dynamic_hull_OM_3 PRIVATE ${OPENMESH_LIBRARIES} ) endif() diff --git a/Documentation/doc/Documentation/Installation.txt b/Documentation/doc/Documentation/Installation.txt index 5c07d5253a7..121bb2f331c 100644 --- a/Documentation/doc/Documentation/Installation.txt +++ b/Documentation/doc/Documentation/Installation.txt @@ -323,7 +323,7 @@ variable `BUILD_SHARED_LIBS` to `FALSE`. If you use \subsection subsection_headeronly Header-only option -Since \cgal 4.9, \cgal can be used in headers only mode, i.e. without compiling the \cgal libraries and linking with these libraries when compiling examples, tests and demos. This possibility can be enabled by setting the value of the CMake variable `CGAL_HEADER_ONLY` to `ON`. CMake version 3.0.0 or higher is required to use this option. +Since \cgal 4.11, \cgal can be used in header-only mode, i.e. without configuring nor building any \cgal library. In this case, the program using \cgal (example, test, demo, etc.) must be directly configured using CMake. The variable `CGAL_DIR` must point to the root directory of the CGAL source code. One advantage of using \cgal in header-only mode is that you do not need to compile and install \cgal libraries before compiling a given example or demo. Note that even in header-only mode we still need to run CMake on \cgal in order to generate different configuration files. So, setting up \cgal becomes now: diff --git a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt index 74befb6c8d3..79481e9d477 100644 --- a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt +++ b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt @@ -35,14 +35,16 @@ qt5_generate_moc( Alpha_shapes_2.cpp Alpha_shapes_2.moc ) # The executable itself. add_executable ( Alpha_shapes_2 Alpha_shapes_2.cpp Alpha_shapes_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) -qt5_use_modules(Alpha_shapes_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shapes_2 ) -# Link with Qt libraries -target_link_libraries( Alpha_shapes_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Alpha_shapes_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Alpha_shapes_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Alpha_shapes_2) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Alpha_shapes_2) else() diff --git a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt index c471e14a301..5277df796c8 100644 --- a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt @@ -33,14 +33,17 @@ qt5_generate_moc( Apollonius_graph_2.cpp Apollonius_graph_2.moc ) # The executable itself. add_executable ( Apollonius_graph_2 Apollonius_graph_2.cpp Apollonius_graph_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) -qt5_use_modules(Apollonius_graph_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Apollonius_graph_2 ) -# Link with Qt libraries -target_link_libraries( Apollonius_graph_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Apollonius_graph_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Apollonius_graph_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 + Qt5::Gui ) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Apollonius_graph_2) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Apollonius_graph_2) else() diff --git a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt index fe3dee88349..73dbe769131 100644 --- a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt +++ b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt @@ -38,14 +38,16 @@ qt5_generate_moc( "Bounding_volumes.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Bounding_v # The executable itself. add_executable ( Bounding_volumes Bounding_volumes.cpp Bounding_volumes.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) -qt5_use_modules(Bounding_volumes Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Bounding_volumes ) -# Link with Qt libraries -target_link_libraries( Bounding_volumes ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Bounding_volumes ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Bounding_volumes PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Bounding_volumes) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Bounding_volumes) else() diff --git a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt index 8faf940eb06..b832117e578 100644 --- a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt +++ b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt @@ -38,14 +38,16 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) # The executable itself. add_executable ( Circular_kernel_2 Circular_kernel_2.cpp Circular_kernel_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules(Circular_kernel_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_2 ) - # Link with Qt libraries - target_link_libraries( Circular_kernel_2 ${QT_LIBRARIES} ) - # Link with CGAL - target_link_libraries( Circular_kernel_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + target_link_libraries( Circular_kernel_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui) + + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Circular_kernel_2) + + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Circular_kernel_2) else() diff --git a/GraphicsView/demo/Generator/CMakeLists.txt b/GraphicsView/demo/Generator/CMakeLists.txt index ee92ef751ae..186f37e94dd 100644 --- a/GraphicsView/demo/Generator/CMakeLists.txt +++ b/GraphicsView/demo/Generator/CMakeLists.txt @@ -1,4 +1,3 @@ -# Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. project (Generator_Demo) @@ -15,8 +14,6 @@ include(${CGAL_USE_FILE}) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) -include_directories (BEFORE ../../include) - if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) add_definitions(-DQT_NO_KEYWORDS) @@ -35,15 +32,13 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) # The executable itself. add_executable ( Generator_2 Generator_2.cpp Generator_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) - qt5_use_modules(Generator_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Generator_2 ) - # Link with Qt libraries - target_link_libraries( Generator_2 ${QT_LIBRARIES} ) - # And with CGAL libraries - target_link_libraries( Generator_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + target_link_libraries( Generator_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Generator_2) else() message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.") diff --git a/GraphicsView/demo/GraphicsView/CMakeLists.txt b/GraphicsView/demo/GraphicsView/CMakeLists.txt index e1d0ecf5135..3da163ace44 100644 --- a/GraphicsView/demo/GraphicsView/CMakeLists.txt +++ b/GraphicsView/demo/GraphicsView/CMakeLists.txt @@ -20,15 +20,13 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) add_executable ( min min.cpp ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules(min Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS min ) - # Link with Qt libraries - target_link_libraries( min ${QT_LIBRARIES} ) - # Link with CGAL - target_link_libraries( min ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + 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.") diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt index 2a5579dfd2b..4e42f7ed98f 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt @@ -37,14 +37,16 @@ qt5_generate_moc( L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ) # The executable itself. add_executable ( L1_voronoi_diagram_2 L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) -qt5_use_modules(L1_voronoi_diagram_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS L1_voronoi_diagram_2 ) -# Link with Qt libraries -target_link_libraries( L1_voronoi_diagram_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( L1_voronoi_diagram_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( L1_voronoi_diagram_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(L1_voronoi_diagram_2) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(L1_voronoi_diagram_2) else() diff --git a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt index 7d4429da9dd..f3ea3822cee 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt +++ b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt @@ -36,15 +36,13 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) # The executable itself. add_executable ( Largest_empty_rectangle_2 Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) - qt5_use_modules(Largest_empty_rectangle_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Largest_empty_rectangle_2 ) - # Link with Qt libraries - target_link_libraries( Largest_empty_rectangle_2 ${QT_LIBRARIES} ) - # And with CGAL libraries - target_link_libraries( Largest_empty_rectangle_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + target_link_libraries( Largest_empty_rectangle_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Largest_empty_rectangle_2) else() message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.") diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt index b500820bea4..065264be817 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt @@ -53,14 +53,13 @@ add_executable ( Periodic_2_Delaunay_triangulation_2 ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ${headers} ${QT_headers} ${P2T2_headers}) -qt5_use_modules( Periodic_2_Delaunay_triangulation_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Periodic_2_Delaunay_triangulation_2 ) -# Link with Qt libraries -target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Periodic_2_Delaunay_triangulation_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Periodic_2_Delaunay_triangulation_2) else() message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.") diff --git a/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index 9f7e2ff5038..ed26300f92c 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -43,16 +43,13 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) # The executable itself. add_executable ( Polygon_2 Polygon_2.cpp Polygon_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) - qt5_use_modules(Polygon_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polygon_2 ) + target_link_libraries( Polygon_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) - # Link with Qt libraries - target_link_libraries( Polygon_2 ${QT_LIBRARIES} ) - # And with CGAL libraries - target_link_libraries( Polygon_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) - + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Polygon_2) else() message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core, and Qt5, and will not be compiled.") diff --git a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt index 5aee7461e01..d686684058e 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt @@ -43,15 +43,13 @@ qt5_generate_moc( "Segment_voronoi_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_v # The executable itself. add_executable ( Segment_voronoi_2 Segment_voronoi_2.cpp Segment_voronoi_2.moc ${CDT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) -qt5_use_modules(Segment_voronoi_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_2 ) -# Link with Qt libraries -target_link_libraries( Segment_voronoi_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Segment_voronoi_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Segment_voronoi_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Segment_voronoi_2) else() diff --git a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 54c06e8794c..235361f99be 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -43,16 +43,13 @@ qt5_generate_moc( "Segment_voronoi_linf_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segm # The executable itself. add_executable ( Segment_voronoi_linf_2 Segment_voronoi_linf_2.cpp Segment_voronoi_linf_2.moc ${CDT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) -qt5_use_modules(Segment_voronoi_linf_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_linf_2 ) -# Link with Qt libraries -target_link_libraries( Segment_voronoi_linf_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Segment_voronoi_linf_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) - +target_link_libraries( Segment_voronoi_linf_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Segment_voronoi_linf_2) else() message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.") diff --git a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt index a8b9e52638b..0644db2a4ef 100644 --- a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt +++ b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt @@ -35,14 +35,16 @@ qt5_generate_moc( Snap_rounding_2.cpp Snap_rounding_2.moc ) # The executable itself. add_executable ( Snap_rounding_2 Snap_rounding_2.cpp Snap_rounding_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) -qt5_use_modules(Snap_rounding_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Snap_rounding_2 ) -# Link with Qt libraries -target_link_libraries( Snap_rounding_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Snap_rounding_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Snap_rounding_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Snap_rounding_2) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Snap_rounding_2) else() diff --git a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt index 0aa76f63964..92c07195c75 100644 --- a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt +++ b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt @@ -37,15 +37,14 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) # The executable itself. add_executable ( Spatial_searching_2 Spatial_searching_2.cpp Spatial_searching_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) - qt5_use_modules(Spatial_searching_2 Xml Script OpenGL Svg) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Spatial_searching_2 ) - # Link with Qt libraries - target_link_libraries( Spatial_searching_2 ${QT_LIBRARIES} ) - # And with CGAL libraries - target_link_libraries( Spatial_searching_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + target_link_libraries( Spatial_searching_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Spatial_searching_2) else() message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.") diff --git a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt index 5a0d0d8ab2e..e980d9e818e 100644 --- a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt +++ b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt @@ -36,14 +36,16 @@ qt5_generate_moc( Stream_lines_2.cpp Stream_lines_2.moc ) # The executable itself. add_executable ( Stream_lines_2 Stream_lines_2.cpp Stream_lines_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ) -qt5_use_modules(Stream_lines_2 Xml Script OpenGL Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS Stream_lines_2 ) -# Link with Qt libraries -target_link_libraries( Stream_lines_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Stream_lines_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Stream_lines_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Stream_lines_2) + +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Stream_lines_2) else() diff --git a/GraphicsView/demo/Triangulation_2/CMakeLists.txt b/GraphicsView/demo/Triangulation_2/CMakeLists.txt index 5b8e2f404ef..461ad726ad7 100644 --- a/GraphicsView/demo/Triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Triangulation_2/CMakeLists.txt @@ -9,99 +9,68 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + +set(CMAKE_AUTOMOC TRUE) +set(CMAKE_AUTOUIC TRUE) +set(CMAKE_AUTORCC TRUE) +set(CMAKE_INCLUDE_CURRENT_DIR TRUE) + find_package(CGAL COMPONENTS Qt5) +find_package(Qt5 QUIET COMPONENTS Widgets) -include(${CGAL_USE_FILE}) - - -find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) - -include_directories (BEFORE ../../include) -include_directories (BEFORE ./include) -include_directories (BEFORE ../../../Number_types/include) - -include_directories (BEFORE ../../../Triangulation_2/include) - -if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) +if ( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND OR NOT Qt5_FOUND ) + message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.") + return() +endif() add_definitions(-DQT_NO_KEYWORDS) - - #-------------------------------- # The "constrained Delaunay" demo: Constrained_Delaunay_triangulation_2 #-------------------------------- -# UI files (Qt Designer files) -qt5_wrap_ui( CDT_UI_FILES Constrained_Delaunay_triangulation_2.ui ) - -# qrc files (resources files, that contain icons, at least) -qt5_add_resources ( CDT_RESOURCE_FILES ./Constrained_Delaunay_triangulation_2.qrc ) - -# use the Qt MOC preprocessor on classes that derives from QObject -qt5_generate_moc( "Constrained_Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Constrained_Delaunay_triangulation_2.moc" ) # The executable itself. -add_executable ( Constrained_Delaunay_triangulation_2 Constrained_Delaunay_triangulation_2.cpp Constrained_Delaunay_triangulation_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) +add_executable( Constrained_Delaunay_triangulation_2 + Constrained_Delaunay_triangulation_2.cpp) +target_link_libraries( Constrained_Delaunay_triangulation_2 + PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets) +target_include_directories( Constrained_Delaunay_triangulation_2 + PRIVATE ./include) -qt5_use_modules(Constrained_Delaunay_triangulation_2 Xml Script OpenGL Svg) - -add_to_cached_list( CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2 ) - -# Link with Qt libraries -target_link_libraries( Constrained_Delaunay_triangulation_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Constrained_Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +add_to_cached_list(CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2) #-------------------------------- # The "Delaunay" demo: Delaunay_triangulation_2 #-------------------------------- -# UI files (Qt Designer files) -qt5_wrap_ui( DT_UI_FILES Delaunay_triangulation_2.ui ) - -# qrc files (resources files, that contain icons, at least) -qt5_add_resources ( DT_RESOURCE_FILES ./Delaunay_triangulation_2.qrc ) - -# use the Qt MOC preprocessor on classes that derives from QObject -qt5_generate_moc( "Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Delaunay_triangulation_2.moc" ) # The executable itself. -add_executable ( Delaunay_triangulation_2 Delaunay_triangulation_2.cpp Delaunay_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - -qt5_use_modules(Delaunay_triangulation_2 Xml Script OpenGL Svg) +add_executable ( Delaunay_triangulation_2 + Delaunay_triangulation_2.cpp) +target_link_libraries( Delaunay_triangulation_2 + PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 ) -# Link with Qt libraries -target_link_libraries( Delaunay_triangulation_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) - #-------------------------------- # The "Regular" demo: Regular_triangulation_2 #-------------------------------- -# UI files (Qt Designer files) -qt5_wrap_ui( DT_UI_FILES Regular_triangulation_2.ui ) - -# qrc files (resources files, that contain icons, at least) -qt5_add_resources ( DT_RESOURCE_FILES ./Regular_triangulation_2.qrc ) - -# use the Qt MOC preprocessor on classes that derives from QObject -qt5_generate_moc( "Regular_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Regular_triangulation_2.moc" ) # The executable itself. -add_executable ( Regular_triangulation_2 Regular_triangulation_2.cpp Regular_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - -qt5_use_modules(Regular_triangulation_2 Xml Script OpenGL Svg) +add_executable ( Regular_triangulation_2 + Regular_triangulation_2.cpp) +target_link_libraries(Regular_triangulation_2 + PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Regular_triangulation_2 ) -# Link with Qt libraries -target_link_libraries( Regular_triangulation_2 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Regular_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +foreach(target + Constrained_Delaunay_triangulation_2 + Delaunay_triangulation_2 + Regular_triangulation_2) + cgal_add_compilation_test(${target}) +endforeach() -else() - - message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.") - -endif() diff --git a/GraphicsView/include/CGAL/Qt/debug.h b/GraphicsView/include/CGAL/Qt/debug.h index 967f808cba8..d87439e8805 100644 --- a/GraphicsView/include/CGAL/Qt/debug.h +++ b/GraphicsView/include/CGAL/Qt/debug.h @@ -48,7 +48,33 @@ CGAL_QT_EXPORT void traverse_resources(const QString& name, /** * Call this in the end of an OpenGL implementation to check if it returns errors. */ -CGAL_QT_EXPORT void opengl_check_errors(unsigned int line); +template +void opengl_check_errors(QtOpenGLFunctions* gl, + unsigned int line) { + GLenum error = gl->glGetError(); + while (error != GL_NO_ERROR) + { + if(error == GL_INVALID_ENUM) + std::cerr << "An unacceptable value is specified for an enumerated argument." << "@" << line << std::endl; + if(error == GL_INVALID_VALUE) + std::cerr << "A numeric argument is out of range." << "@" << line << std::endl; + if(error == GL_INVALID_OPERATION) + std::cerr << "The specified operation is not allowed in the current state." << "@" << line << std::endl; + if(error == GL_INVALID_FRAMEBUFFER_OPERATION) + std::cerr << "The framebuffer object is not complete." << "@" << line << std::endl; + if(error == GL_OUT_OF_MEMORY) + std::cerr << "There is not enough memory left to execute the command." << "@" << line << std::endl; +#ifdef GL_STACK_UNDERFLOW + if(error == GL_STACK_UNDERFLOW) + std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to underflow." << "@" << line << std::endl; +#endif +#ifdef GL_STACK_OVERFLOW + if(error == GL_STACK_OVERFLOW) + std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to overflow." << "@" << line << std::endl; +#endif + error = gl->glGetError(); + } +} } // namespace Qt } // namespace CGAL diff --git a/GraphicsView/include/CGAL/Qt/debug_impl.h b/GraphicsView/include/CGAL/Qt/debug_impl.h index 56ba9754291..abaad10d91c 100644 --- a/GraphicsView/include/CGAL/Qt/debug_impl.h +++ b/GraphicsView/include/CGAL/Qt/debug_impl.h @@ -60,32 +60,5 @@ void traverse_resources(const QString& name, const QString& dirname, int indent) } } -CGAL_INLINE_FUNCTION -void opengl_check_errors(unsigned int line) -{ - GLenum error = ::glGetError(); - while (error != GL_NO_ERROR) - { - if(error == GL_INVALID_ENUM) - std::cerr << "An unacceptable value is specified for an enumerated argument." << "@" << line << std::endl; - if(error == GL_INVALID_VALUE) - std::cerr << "A numeric argument is out of range." << "@" << line << std::endl; - if(error == GL_INVALID_OPERATION) - std::cerr << "The specified operation is not allowed in the current state." << "@" << line << std::endl; - if(error == GL_INVALID_FRAMEBUFFER_OPERATION) - std::cerr << "The framebuffer object is not complete." << "@" << line << std::endl; - if(error == GL_OUT_OF_MEMORY) - std::cerr << "There is not enough memory left to execute the command." << "@" << line << std::endl; -#ifdef GL_STACK_UNDERFLOW - if(error == GL_STACK_UNDERFLOW) - std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to underflow." << "@" << line << std::endl; -#endif -#ifdef GL_STACK_OVERFLOW - if(error == GL_STACK_OVERFLOW) - std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to overflow." << "@" << line << std::endl; -#endif - error = ::glGetError(); - } -} } // namesapce Qt } // namespace CGAL diff --git a/GraphicsView/src/CGAL_Qt5/CMakeLists.txt b/GraphicsView/src/CGAL_Qt5/CMakeLists.txt index d0077a33c88..519b923a322 100644 --- a/GraphicsView/src/CGAL_Qt5/CMakeLists.txt +++ b/GraphicsView/src/CGAL_Qt5/CMakeLists.txt @@ -5,107 +5,36 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() -if($ENV{CGAL_FAKE_PUBLIC_RELEASE}) - add_definitions( -DCGAL_FAKE_PUBLIC_RELEASE ) +include(CGAL_SetupCGAL_Qt5Dependencies) + +if(CGAL_Qt5_MISSING_DEPS) + message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.") + return() +endif() + +message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" ) + +if(NOT CGAL_HEADER_ONLY) + collect_cgal_library( CGAL_Qt5 "${_CGAL_Qt5_MOC_FILES_private};${_CGAL_Qt5_RESOURCE_FILES_private}") +else() + collect_cgal_library( CGAL_Qt5 "") endif() if(CGAL_HEADER_ONLY) - cache_set(CGAL_Qt5_3RD_PARTY_LIBRARIES Qt5::OpenGL Qt5::Svg ) -else(CGAL_HEADER_ONLY) - find_package(Qt5 QUIET COMPONENTS OpenGL Svg) - find_package(OpenGL QUIET) + set(keyword "INTERFACE") +endif() - set(CGAL_Qt5_MISSING_DEPS "") - if(NOT Qt5OpenGL_FOUND) - set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL") - endif() - if(NOT Qt5Svg_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg") - endif() - if(NOT Qt5_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5") - endif() - if(NOT OPENGL_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL") - endif() +CGAL_setup_CGAL_Qt5_dependencies( CGAL_Qt5 ${keyword}) - if(CGAL_Qt5_MISSING_DEPS) - message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.") - return() - endif() - - include_directories (BEFORE ../../include) - - message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" ) - if(COMMAND add_config_flag) - set( CGAL_HAS_QT5 TRUE ) - add_config_flag( CGAL_HAS_QT5 ) - endif() - - get_property(QT_UIC_EXECUTABLE TARGET Qt5::uic PROPERTY LOCATION) - message( STATUS "OpenGL include: ${OPENGL_INCLUDE_DIR}" ) - message( STATUS "OpenGL libraries: ${OPENGL_LIBRARIES}" ) - message( STATUS "OpenGL definitions: ${OPENGL_DEFINITIONS}" ) - message( STATUS "Qt5Core include: ${Qt5Core_INCLUDE_DIRS}" ) - message( STATUS "Qt5 libraries: ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5OpenGL_LIBRARIES}" ) - message( STATUS "Qt5Core definitions: ${Qt5Core_DEFINITIONS}" ) - message( STATUS "moc executable: ${QT_MOC_EXECUTABLE}" ) - message( STATUS "uic executable: ${QT_UIC_EXECUTABLE}" ) - - cache_set(CGAL_Qt5_3RD_PARTY_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ) - cache_set(CGAL_Qt5_3RD_PARTY_LIBRARIES ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ) - cache_set(CGAL_Qt5_3RD_PARTY_DEFINITIONS ${QT_DEFINITIONS} ${OPENGL_DEFINITIONS} ) - - set(mocfiles "") - set(RESOURCE_FILES "") - - foreach (package ${CGAL_CONFIGURED_PACKAGES} ) - file(GLOB PACKAGE_QTMOC_FILES "${package}/src/CGAL_Qt5/*.qtmoc.cmake") - list(SORT PACKAGE_QTMOC_FILES) - foreach(package_qtmoc_file ${PACKAGE_QTMOC_FILES}) - # includes 'moccing' for sources/headers in package + collects lists of moc-files for dependency (to properly build the lib) - include(${package_qtmoc_file}) - # message(STATUS QTMOC------------FILE: ${package_qtmoc_file}) - - endforeach() - endforeach() - - foreach(mocfile ${mocfiles}) - list(APPEND additional_files ${mocfile}) - endforeach() - foreach(resfile ${RESOURCE_FILES}) - list(APPEND additional_files ${resfile}) - endforeach() - -# message(STATUS "Additional input files: ${additional_files}") - - use_essential_libs() - - include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_Qt5_3RD_PARTY_INCLUDE_DIRS} ) - - link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} ) - - add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_Qt5_3RD_PARTY_DEFINITIONS} ) -endif(CGAL_HEADER_ONLY) - -collect_cgal_library( CGAL_Qt5 "${additional_files}") - -if (NOT CGAL_HEADER_ONLY) - - qt5_use_modules(CGAL_Qt5 OpenGL Svg) - - add_dependencies( CGAL_Qt5 CGAL ) - - # CGAL_Qt5 only depends on CGAL in DEBUG, but we still link it in - # both build types. - target_link_libraries( CGAL_Qt5 CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_Qt5_3RD_PARTY_LIBRARIES} ) - -else() - - install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/include/CGAL/Qt") - install(DIRECTORY "../../demo/resources/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/demo/resources") - install(DIRECTORY "../../demo/icons/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/demo/icons") +if(COMMAND add_config_flag) + set( CGAL_HAS_QT5 TRUE ) + add_config_flag( CGAL_HAS_QT5 ) +endif() +if (CGAL_HEADER_ONLY) + install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/include/CGAL/Qt" COMPONENT CGAL_Qt5) + install(DIRECTORY "../../demo/resources/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/demo/resources" COMPONENT CGAL_Qt5) + install(DIRECTORY "../../demo/icons/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/demo/icons" COMPONENT CGAL_Qt5) endif() message("libCGAL_Qt5 is configured") diff --git a/Installation/CGALConfig.cmake b/Installation/CGALConfig.cmake new file mode 100644 index 00000000000..8b228bdf3eb --- /dev/null +++ b/Installation/CGALConfig.cmake @@ -0,0 +1,6 @@ +# +# This file points to the CGALConfig.cmake for a header-only +# CGAL installation. +# + +include(${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig.cmake) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 4ebf07b21d7..f97b6f07f60 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -35,12 +35,11 @@ include(GNUInstallDirs) if(CMAKE_MAJOR_VERSION GREATER 2) # In header only mode, we use INTERFACE libraries, which was introduced in cmake 3.0. # Thus this option is only enabled for cmake >= 3.0. - option(CGAL_HEADER_ONLY "Enable the header only version of CGAL" OFF ) if (CGAL_HEADER_ONLY) set(CGAL_HEADER_ONLY TRUE CACHE BOOL "Enable cgal header only" FORCE) add_definitions(-DCGAL_HEADER_ONLY) - endif (CGAL_HEADER_ONLY) + endif() endif() @@ -551,12 +550,18 @@ message( "== Generate version files (DONE) ==\n") # -= External libraries =- # #-------------------------------------------------------------------------------------------------- - -message("== Set up flags ==") -include(CGAL_SetupFlags) +if( RUNNING_CGAL_AUTO_TEST ) + message("== Set up flags ==") -message("== Set up flags (DONE) ==\n") + # Ugly hack to be compatible with current CGAL testsuite process (as of + # Nov. 2017). -- Laurent Rineau + include(CGAL_SetupFlags) + + message("== Set up flags (DONE) ==\n") +else() + include( CGAL_display_flags ) +endif() message("== Detect external libraries ==") @@ -673,7 +678,9 @@ option( CGAL_ENABLE_PRECONFIG "Select to allow to preconfiguration of external l # this; e.g. in MPFI/RS in Algebraic_kernel_d. For these cases CGAL # and the example/test must be configured with MPFI (just one is not sufficient) -include(CGAL_SetupDependencies) +if(NOT CGAL_HEADER_ONLY) + include(CGAL_SetupDependencies) +endif() message("== Detect external libraries (DONE) ==\n") @@ -683,6 +690,7 @@ message("== Detect external libraries (DONE) ==\n") # #-------------------------------------------------------------------------------------------------- +if(NOT CGAL_HEADER_ONLY) # The variables set are the #defines expected by compiler_config.h # Note: CMake will not notice when files are added or removed # but this is probably OK for the installation procedure. @@ -742,6 +750,10 @@ if ( RUNNING_CGAL_AUTO_TEST AND MSVC ) file( APPEND "${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h" "#include \n\n" ) endif() +message("== Write compiler_config.h (DONE) ==\n") + +endif(NOT CGAL_HEADER_ONLY) + #-------------------------------------------------------------------------------------------------- # # -= Installation Setup =- @@ -760,7 +772,7 @@ set ( CGAL_INSTALL_BIN_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING "The folder where CGAL user-side scripts will be installed, relative to CMAKE_INSTALL_PREFIX" ) -set ( CGAL_INSTALL_CMAKE_DIR "${CGAL_INSTALL_LIB_DIR}/CGAL" +set ( CGAL_INSTALL_CMAKE_DIR "${CGAL_INSTALL_LIB_DIR}/cmake/CGAL" CACHE STRING "The folder where CGAL CMake modules will be installed, relative to CMAKE_INSTALL_PREFIX" ) @@ -772,8 +784,6 @@ set ( CGAL_INSTALL_MAN_DIR "${CMAKE_INSTALL_DATAROOTDIR}/man/man1" CACHE STRING "The folder where manual pages for CGAL scripts will be installed, relative to CMAKE_INSTALL_PREFIX" ) -message("== Write compiler_config.h (DONE) ==\n") - #-------------------------------------------------------------------------------------------------- # # -= Build =- @@ -788,7 +798,9 @@ set(CGAL_LIBRARIES_DIR ${CMAKE_BINARY_DIR}/lib) set(CGAL_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include) foreach (package ${CGAL_CONFIGURED_PACKAGES}) - set(CGAL_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS} ${package}/include) + if(EXISTS ${package}/include) + set(CGAL_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS} ${package}/include) + endif() endforeach() include_directories (${CGAL_INCLUDE_DIRS}) @@ -847,7 +859,12 @@ if (CGAL_BRANCH_BUILD AND CGAL_REPORT_DUPLICATE_FILES ) endif() -create_CGALconfig_files() +if(NOT CGAL_HEADER_ONLY) + create_CGALconfig_files() +else() + configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary_header_only.cmake.in" + "${CMAKE_BINARY_DIR}/CGALConfig.cmake" @ONLY) +endif() #-------------------------------------------------------------------------------------------------- # @@ -892,10 +909,17 @@ if ( ZLIB_IN_AUXILIARY ) endif() -install(FILES - ${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake - ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake - DESTINATION ${CGAL_INSTALL_CMAKE_DIR} ) +if(NOT CGAL_HEADER_ONLY) + install(FILES + ${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake + ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake + DESTINATION ${CGAL_INSTALL_CMAKE_DIR} ) +else() + install(FILES + ${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake + ${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig.cmake + DESTINATION ${CGAL_INSTALL_CMAKE_DIR} ) +endif() if(CGAL_INSTALL_MAN_DIR) install(FILES auxiliary/cgal_create_cmake_script.1 DESTINATION ${CGAL_INSTALL_MAN_DIR} ) diff --git a/Installation/cmake/modules/CGALConfig_binary.cmake.in b/Installation/cmake/modules/CGALConfig_binary.cmake.in index 7c817e6a7f0..d50ef38cf46 100644 --- a/Installation/cmake/modules/CGALConfig_binary.cmake.in +++ b/Installation/cmake/modules/CGALConfig_binary.cmake.in @@ -15,30 +15,9 @@ set(CGAL_HEADER_ONLY "@CGAL_HEADER_ONLY@" ) # The code for including exported targets is different from # CGAL_Config_install.cmake. We do not have separate export files in # an installed version and we need to make sure that we are not -# currently building CGAL. Note that for CMake<=2.8.11 (detected by -# the absence of CMP0024), the else() condition is never used. -if(NOT POLICY CMP0024 OR NOT CGAL_BUILDING_LIBS) +# currently building CGAL. +if(NOT CGAL_BUILDING_LIBS) include("${CGAL_CONFIG_DIR}/CGALExports.cmake") - - macro(CGAL_get_property_optional VAR TARGET PROPERTY) - if(TARGET ${TARGET}) - get_property(${VAR} TARGET ${TARGET} PROPERTY ${PROPERTY}) - else() - set(${VAR} "") - endif() - endmacro() - - if(NOT MSVC AND NOT CGAL_HEADER_ONLY) - CGAL_get_property_optional(CGAL_LIBRARY CGAL::CGAL LOCATION) - CGAL_get_property_optional(CGAL_Core_LIBRARY CGAL::CGAL_Core LOCATION) - CGAL_get_property_optional(CGAL_ImageIO_LIBRARY CGAL::CGAL_ImageIO LOCATION) - CGAL_get_property_optional(CGAL_Qt5_LIBRARY CGAL::CGAL_Qt5 LOCATION) - else() - set(CGAL_LIBRARY "") - set(CGAL_Core_LIBRARY "") - set(CGAL_ImageIO_LIBRARY "") - set(CGAL_Qt5_LIBRARY "") - endif() else() # We are currently in a CGAL Build and CGALExports.cmake has not # necessarily been created yet. Just alias the targets. Also don't @@ -48,9 +27,6 @@ else() macro(CGAL_alias_library lib) if(TARGET ${lib} AND NOT TARGET CGAL::${lib}) add_library(CGAL::${lib} ALIAS ${lib}) - set(${lib}_LIBRARY CGAL::${lib}) - else() - set(${lib}_LIBRARY "") endif() endmacro() @@ -60,6 +36,19 @@ else() CGAL_alias_library(CGAL_Qt5) endif() +macro(CGAL_set_LIB_LIBRARY_var lib) + if(TARGET CGAL::${lib}) + set(${lib}_LIBRARY CGAL::${lib}) + else() + set(${lib}_LIBRARY "") + endif() +endmacro() + +CGAL_set_LIB_LIBRARY_var(CGAL) +CGAL_set_LIB_LIBRARY_var(CGAL_Core) +CGAL_set_LIB_LIBRARY_var(CGAL_ImageIO) +CGAL_set_LIB_LIBRARY_var(CGAL_Qt5) + # Check for possible config files of our libraries and include them. file(GLOB CGAL_CONFIG_FILES LIST_DIRECTORIES false RELATIVE "${CGAL_CONFIG_DIR}" "${CGAL_CONFIG_DIR}/*LibConfig.cmake") @@ -130,47 +119,30 @@ macro(check_cgal_component COMPONENT) set( CHECK_CGAL_ERROR_TAIL "" ) else( "${CGAL_LIB}" STREQUAL "CGAL" ) if ( WITH_${CGAL_LIB} ) - if(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB}) + if(TARGET CGAL::${CGAL_LIB}) if ("${CGAL_LIB}" STREQUAL "CGAL_Qt5") - find_package(Qt5 QUIET COMPONENTS OpenGL Svg) - find_package(OpenGL QUIET) - - set(CGAL_Qt5_MISSING_DEPS "") - if(NOT Qt5OpenGL_FOUND) - set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL") - endif() - if(NOT Qt5Svg_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg") - endif() - if(NOT Qt5_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5") - endif() - if(NOT OPENGL_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL") - endif() + + include("${CGAL_MODULES_DIR}/CGAL_SetupCGAL_Qt5Dependencies.cmake") if(CGAL_Qt5_MISSING_DEPS) - set( ${CGAL_LIB}_FOUND FALSE ) + set( CGAL_Qt5_FOUND FALSE ) message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.") else() - set( ${CGAL_LIB}_FOUND TRUE ) - if (CGAL_HEADER_ONLY) - include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake") - endif() + set( CGAL_Qt5_FOUND TRUE ) endif() else("${CGAL_LIB}" STREQUAL "CGAL_Qt5") # Librairies that have no dependencies set( ${CGAL_LIB}_FOUND TRUE ) endif("${CGAL_LIB}" STREQUAL "CGAL_Qt5") - else(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB}) + else(TARGET CGAL::${CGAL_LIB}) set( ${CGAL_LIB}_FOUND FALSE ) set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." ) - endif(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB}) + endif(TARGET CGAL::${CGAL_LIB}) else( WITH_${CGAL_LIB} ) set( ${CGAL_LIB}_FOUND FALSE ) set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." ) endif( WITH_${CGAL_LIB} ) - endif( "${CGAL_LIB}" STREQUAL "CGAL" ) + endif() if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR ) message( ${CHECK_CGAL_COMPONENT_ERROR_TYPE} "${CHECK_CGAL_COMPONENT_ERROR_TITLE} The ${CGAL_LIB} library was not configured.${CHECK_${CGAL_LIB}_ERROR_TAIL}" ) @@ -198,3 +170,15 @@ set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@") set(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "@CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES@") set(CGAL_DISABLE_GMP "@CGAL_DISABLE_GMP@") + +include(${CGAL_MODULES_DIR}/CGAL_CreateSingleSourceCGALProgram.cmake) +include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) + +# Temporary? Change the CMAKE module path +cgal_setup_module_path() + +if( RUNNING_CGAL_AUTO_TEST ) + # Ugly hack to be compatible with current CGAL testsuite process (as of + # Nov. 2017). -- Laurent Rineau + include(CGAL_SetupFlags) +endif() diff --git a/Installation/cmake/modules/CGALConfig_binary_header_only.cmake.in b/Installation/cmake/modules/CGALConfig_binary_header_only.cmake.in new file mode 100644 index 00000000000..474864c0b7e --- /dev/null +++ b/Installation/cmake/modules/CGALConfig_binary_header_only.cmake.in @@ -0,0 +1,5 @@ +# +# This file points to the CGALConfig.cmake for header-only CGAL. +# + +include(@CGAL_INSTALLATION_PACKAGE_DIR@/lib/cmake/CGAL/CGALConfig.cmake) diff --git a/Installation/cmake/modules/CGALConfig_install.cmake.in b/Installation/cmake/modules/CGALConfig_install.cmake.in index ea644ba9ade..8c5031762a8 100644 --- a/Installation/cmake/modules/CGALConfig_install.cmake.in +++ b/Installation/cmake/modules/CGALConfig_install.cmake.in @@ -91,42 +91,25 @@ macro(check_cgal_component COMPONENT) endif() if ( WITH_${CGAL_LIB} ) - if(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB}) + if(TARGET CGAL::${CGAL_LIB}) if ("${CGAL_LIB}" STREQUAL "CGAL_Qt5") - find_package(Qt5 QUIET COMPONENTS OpenGL Svg) - find_package(OpenGL QUIET) - - set(CGAL_Qt5_MISSING_DEPS "") - if(NOT Qt5OpenGL_FOUND) - set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL") - endif() - if(NOT Qt5Svg_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg") - endif() - if(NOT Qt5_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5") - endif() - if(NOT OPENGL_FOUND) - set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL") - endif() + + include("${CGAL_MODULES_DIR}/CGAL_SetupCGAL_Qt5Dependencies.cmake") if(CGAL_Qt5_MISSING_DEPS) - set( ${CGAL_LIB}_FOUND FALSE ) + set( CGAL_Qt5_FOUND FALSE ) message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.") else() - set( ${CGAL_LIB}_FOUND TRUE ) - if (CGAL_HEADER_ONLY) - include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake") - endif() + set( CGAL_Qt5_FOUND TRUE ) endif() else("${CGAL_LIB}" STREQUAL "CGAL_Qt5") # Librairies that have no dependencies set( ${CGAL_LIB}_FOUND TRUE ) endif("${CGAL_LIB}" STREQUAL "CGAL_Qt5") - else(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB}) + else(TARGET CGAL::${CGAL_LIB}) set( ${CGAL_LIB}_FOUND FALSE ) set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." ) - endif(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB}) + endif(TARGET CGAL::${CGAL_LIB}) else( WITH_${CGAL_LIB} ) set( ${CGAL_LIB}_FOUND FALSE ) set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." ) @@ -159,3 +142,15 @@ set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@") set(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "@CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES@") set(CGAL_DISABLE_GMP "@CGAL_DISABLE_GMP@") + +include(${CGAL_MODULES_DIR}/CGAL_CreateSingleSourceCGALProgram.cmake) +include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) + +# Temporary? Change the CMAKE module path +cgal_setup_module_path() + +if( RUNNING_CGAL_AUTO_TEST ) + # Ugly hack to be compatible with current CGAL testsuite process (as of + # Nov. 2017). -- Laurent Rineau + include(CGAL_SetupFlags) +endif() diff --git a/Installation/cmake/modules/CGAL_Common.cmake b/Installation/cmake/modules/CGAL_Common.cmake index 2110d9c3aa1..68a9791fde7 100644 --- a/Installation/cmake/modules/CGAL_Common.cmake +++ b/Installation/cmake/modules/CGAL_Common.cmake @@ -1,4 +1,4 @@ -include(CGAL_Macros) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake) if(RUNNING_CGAL_AUTO_TEST) # Just to avoid a warning from CMake if that variable is set on the command line... @@ -43,7 +43,7 @@ if( NOT CGAL_COMMON_FILE_INCLUDED ) hide_variable(CMAKE_UNAME) # Optionally setup the Visual Leak Detector - include(CGAL_SetupVLD) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupVLD.cmake) CGAL_SetupVLD() if(VLD_FOUND) message(STATUS "Visual Leak Detector (VLD) is enabled.") diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index 8168a4baf47..b6b7c44bd52 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -1,4 +1,9 @@ -include(CGAL_add_test) +if(CGAL_CreateSingleSourceCGALProgram_included) + return() +endif(CGAL_CreateSingleSourceCGALProgram_included) +set(CGAL_CreateSingleSourceCGALProgram_included TRUE) + +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_add_test.cmake) include(CMakeParseArguments) function(create_single_source_cgal_program firstfile ) @@ -11,7 +16,7 @@ function(create_single_source_cgal_program firstfile ) set(NO_TESTING ${create_single_source_cgal_program_NO_TESTING}) if(NOT IS_ABSOLUTE "${firstfile}") - set(firstfile "${CGAL_CURRENT_SOURCE_DIR}/${firstfile}") + set(firstfile "${CMAKE_CURRENT_SOURCE_DIR}/${firstfile}") endif() get_filename_component(exe_name ${firstfile} NAME_WE) @@ -52,22 +57,22 @@ function(create_single_source_cgal_program firstfile ) set(NO_TESTING TRUE) endif() - if(NOT NO_TESTING) - cgal_add_test(${exe_name}) - endif(NOT NO_TESTING) + if(POLICY CMP0064) + # CMake 3.4 or later + if(NOT NO_TESTING) + cgal_add_test(${exe_name}) + else() + cgal_add_test(${exe_name} NO_EXECUTION) + endif() + endif() add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} ) - # Link the executable to CGAL and third-party libraries - if ( CGAL_AUTO_LINK_ENABLED ) - - target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} ) - - else() - - target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) - + target_link_libraries(${exe_name} PRIVATE CGAL::CGAL) + if(CGAL_3RD_PARTY_LIBRARIES) + target_link_libraries(${exe_name} PRIVATE ${CGAL_3RD_PARTY_LIBRARIES}) endif() + else() message(AUTHOR_WARNING "The executable ${exe_name} will not be created because the source file ${firstfile} does not exist.") endif() diff --git a/Installation/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake b/Installation/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake index 9dac365114f..ca4470a2124 100644 --- a/Installation/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake +++ b/Installation/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake @@ -12,7 +12,7 @@ # CGAL_TAUCS_LIBRARIES_DIR -list of folders (using full path name) containing # TAUCS (and optionaly BLAS and LAPACK) libraries -include(CGAL_Macros) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake) if ( NOT CGAL_TAUCS_FOUND ) diff --git a/Installation/cmake/modules/CGAL_Macros.cmake b/Installation/cmake/modules/CGAL_Macros.cmake index c0520f3ea44..0568b713a3e 100644 --- a/Installation/cmake/modules/CGAL_Macros.cmake +++ b/Installation/cmake/modules/CGAL_Macros.cmake @@ -159,16 +159,20 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) set ( ${LIB}_VERSION "unknown" ) - try_run( ${LIB}_RUN_RES - ${LIB}_COMPILE_RES - "${CMAKE_BINARY_DIR}" - "${CGAL_INSTALLATION_PACKAGE_DIR}/config/support/print_${LIB}_version.cpp" - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${${PKG}_INCLUDE_DIR};${${PKG}_DEPENDENCY_INCLUDE_DIR}" - "-DLINK_LIBRARIES:STRING=${${PKG}_LIBRARIES};${${PKG}_DEPENDENCY_LIBRARIES}" - "-DLINK_DIRECTORIES:STRING=${${PKG}_LIBRARIES_DIR};${${PKG}_DEPENDENCY_LIBRARIES_DIR}" - OUTPUT_VARIABLE ${LIB}_OUTPUT - ) - + if(NOT CMAKE_CROSSCOMPILING) + try_run( ${LIB}_RUN_RES + ${LIB}_COMPILE_RES + "${CMAKE_BINARY_DIR}" + "${CGAL_INSTALLATION_PACKAGE_DIR}/config/support/print_${LIB}_version.cpp" + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${${PKG}_INCLUDE_DIR};${${PKG}_DEPENDENCY_INCLUDE_DIR}" + "-DLINK_LIBRARIES:STRING=${${PKG}_LIBRARIES};${${PKG}_DEPENDENCY_LIBRARIES}" + "-DLINK_DIRECTORIES:STRING=${${PKG}_LIBRARIES_DIR};${${PKG}_DEPENDENCY_LIBRARIES_DIR}" + OUTPUT_VARIABLE ${LIB}_OUTPUT + ) + else() + set(${LIB}_COMPILE_RES FALSE) + message(STATUS "CROSS-COMPILING!") + endif() if ( ${LIB}_COMPILE_RES ) if ( ${LIB}_RUN_RES EQUAL "0" ) @@ -268,7 +272,9 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) message (STATUS "Requested component: ${component}") if(WITH_CGAL_${component}) - if(TARGET CGAL_${component}) + if(TARGET CGAL::CGAL_${component}) + add_to_list( CGAL_LIBRARIES CGAL::CGAL_${component} ) + elseif(TARGET CGAL_${component}) add_to_list( CGAL_LIBRARIES CGAL_${component} ) else() add_to_list( CGAL_LIBRARIES ${CGAL_${component}_LIBRARY} ) @@ -298,7 +304,6 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) endif() if (${component} STREQUAL "Qt5") - find_package(OpenGL QUIET) find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET) endif() @@ -335,7 +340,6 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) if (${component} STREQUAL "Qt5") set(CGAL_${component}_FOUND TRUE) - find_package(OpenGL QUIET) find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET) endif() ####message( STATUS "External library ${vlib} after find") diff --git a/Installation/cmake/modules/Use_CGAL_Qt5_headers.cmake b/Installation/cmake/modules/CGAL_Qt5_moc_and_resource_files.cmake similarity index 73% rename from Installation/cmake/modules/Use_CGAL_Qt5_headers.cmake rename to Installation/cmake/modules/CGAL_Qt5_moc_and_resource_files.cmake index 4132d77bfab..a8e0a36d4da 100644 --- a/Installation/cmake/modules/Use_CGAL_Qt5_headers.cmake +++ b/Installation/cmake/modules/CGAL_Qt5_moc_and_resource_files.cmake @@ -1,13 +1,17 @@ -qt5_wrap_cpp(CGAL_Qt5_MOC_FILES +if(CGAL_Qt5_moc_and_resource_files_included) + return() +endif() +set(CGAL_Qt5_moc_and_resource_files_included TRUE) + +qt5_wrap_cpp(_CGAL_Qt5_MOC_FILES_private ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/DemosMainWindow.h ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsItem.h ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewInput.h) # qrc files (resources files, that contain icons, at least) -qt5_add_resources (CGAL_Qt5_RESOURCE_FILES +qt5_add_resources (_CGAL_Qt5_RESOURCE_FILES_private ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/CGAL.qrc ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Input.qrc ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/File.qrc ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Triangulation_2.qrc) - diff --git a/Installation/cmake/modules/CGAL_SCM.cmake b/Installation/cmake/modules/CGAL_SCM.cmake index 6fafc60c7aa..2e826779307 100644 --- a/Installation/cmake/modules/CGAL_SCM.cmake +++ b/Installation/cmake/modules/CGAL_SCM.cmake @@ -1,50 +1,58 @@ # Common settings for CGAL cmake scripts -if( NOT CGAL_SCM_FILE_INCLUDED ) - set(CGAL_SCM_FILE_INCLUDED 1 ) +if(CGAL_SCM_FILE_INCLUDED) + return() +endif() +set(CGAL_SCM_FILE_INCLUDED 1) # CGAL_SCM_NAME can be either git or n/a as an indicator if we have a # build system or not # TODO: make that scm agnostic and turn it into a boolean -set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}") -set(GIT_DIR "${GIT_PARENT_DIR}/.git") -if (EXISTS "${GIT_DIR}") - set( CGAL_SCM_NAME "git" ) -else() - while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories - set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") - get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) - if( "${GIT_PARENT_DIR}" STREQUAL "${GIT_PREVIOUS_PARENT}" ) - # We have reached the root directory, we are not in git - set( _refspecvar "GITDIR-NOTFOUND" ) - set( _hashvar "GITDIR-NOTFOUND" ) - set( CGAL_SCM_NAME "n/a" ) - break() - else() - set( GIT_DIR "${GIT_PARENT_DIR}/.git" ) - set( CGAL_SCM_NAME "git" ) - endif() - endwhile() -endif() +function(CGAL_detect_git GIT_PARENT_DIR) + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + if (EXISTS "${GIT_DIR}") + set( CGAL_SCM_NAME "git" ) + else() + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if( "${GIT_PARENT_DIR}" STREQUAL "${GIT_PREVIOUS_PARENT}" ) + # We have reached the root directory, we are not in git + set( _refspecvar "GITDIR-NOTFOUND" ) + set( _hashvar "GITDIR-NOTFOUND" ) + set( CGAL_SCM_NAME "n/a" ) + break() + else() + set( GIT_DIR "${GIT_PARENT_DIR}/.git" ) + set( CGAL_SCM_NAME "git" ) + endif() + endwhile() + endif() -if ( "${CGAL_SCM_NAME}" STREQUAL "git" ) - find_program(GIT_EXECUTABLE git DOC "git command line client") - execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIR} rev-parse --symbolic --abbrev-ref HEAD - OUTPUT_VARIABLE CGAL_GIT_BRANCH - OUTPUT_STRIP_TRAILING_WHITESPACE) + if ( "${CGAL_SCM_NAME}" STREQUAL "git" ) + find_program(GIT_EXECUTABLE git DOC "git command line client") + execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIR} rev-parse --symbolic --abbrev-ref HEAD + OUTPUT_VARIABLE CGAL_GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE) - set( CGAL_SCM_BRANCH_NAME "${CGAL_GIT_BRANCH}" ) + set( CGAL_SCM_BRANCH_NAME "${CGAL_GIT_BRANCH}" ) - execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIR} rev-parse HEAD - OUTPUT_VARIABLE CGAL_GIT_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIR} rev-parse HEAD + OUTPUT_VARIABLE CGAL_CREATED_GIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE) - # backward compatible - set( CGAL_CREATED_SVN_REVISION "99999" ) -else() - set( CGAL_SCM_BRANCH_NAME "n/a") - set( CGAL_CREATED_GIT_HASH "n/a" ) - set( CGAL_CREATED_SVN_REVISION "n/a" ) -endif() + # backward compatible + set( CGAL_CREATED_SVN_REVISION "99999" ) + else() + set( CGAL_SCM_BRANCH_NAME "n/a" ) + set( CGAL_CREATED_GIT_HASH "n/a" ) + set( CGAL_CREATED_SVN_REVISION "n/a" ) + endif() + + # export the variables to PARENT_SCOPE + set( CGAL_SCM_NAME ${CGAL_SCM_NAME} PARENT_SCOPE ) + set( CGAL_SCM_BRANCH_NAME ${CGAL_SCM_BRANCH_NAME} PARENT_SCOPE ) + set( CGAL_CREATED_GIT_HASH ${CGAL_CREATED_GIT_HASH} PARENT_SCOPE ) + set( CGAL_CREATED_SVN_REVISION ${CGAL_CREATED_SVN_REVISION} PARENT_SCOPE ) +endfunction() -endif() diff --git a/Installation/cmake/modules/CGAL_SetupBoost.cmake b/Installation/cmake/modules/CGAL_SetupBoost.cmake index c392d09e78e..849fc7fcc7c 100644 --- a/Installation/cmake/modules/CGAL_SetupBoost.cmake +++ b/Installation/cmake/modules/CGAL_SetupBoost.cmake @@ -1,6 +1,21 @@ -if ( NOT CGAL_Boost_Setup ) +#.rst: +# CGAL_SetupBoost +# --------------- +# +# The module searchs for the `Boost` headers and library, by calling +# +# .. code-block:: cmake +# +# find_package(Boost) +# +# and defines the function :command:`use_CGAL_Boost_support`. - include(CGAL_TweakFindBoost) +if ( CGAL_Boost_Setup ) + return() +endif() +set ( CGAL_Boost_Setup TRUE ) + +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake) set ( CGAL_requires_Boost_libs TRUE ) if ( DEFINED MSVC_VERSION AND "${MSVC_VERSION}" GREATER 1800) @@ -17,40 +32,54 @@ if ( NOT CGAL_Boost_Setup ) endif() endif() - if (CGAL_requires_Boost_libs) - find_package( Boost 1.48 REQUIRED thread system ) - else() - find_package( Boost 1.48 REQUIRED ) - endif() - - if(Boost_FOUND) - if(DEFINED Boost_DIR AND NOT Boost_DIR) - # Unset that cache variable that is set in the cache by FindBoost - # (while it was searching for boost-cmake). - unset(Boost_DIR CACHE) - set(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "Avoid future search of boost-cmake") - endif() - endif() - - message( STATUS "Boost include: ${Boost_INCLUDE_DIRS}" ) - message( STATUS "Boost libraries: ${Boost_LIBRARIES}" ) - message( STATUS "Boost definitions: ${Boost_DEFINITIONS}" ) - - set ( CGAL_USE_BOOST 1 ) - - include(CGAL_Macros) - - add_to_cached_list(CGAL_3RD_PARTY_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ) - add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES_DIRS ${Boost_LIBRARY_DIRS} ) - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS ${Boost_DEFINITIONS} ) - - if ( NOT MSVC ) - add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES} ) - endif() - - message( STATUS "USING BOOST_VERSION = '${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}'" ) - - set ( CGAL_Boost_Setup TRUE ) - +if (CGAL_requires_Boost_libs) + find_package( Boost 1.48 REQUIRED thread system ) +else() + find_package( Boost 1.48 REQUIRED ) endif() +if(Boost_FOUND) + if(DEFINED Boost_DIR AND NOT Boost_DIR) + # Unset that cache variable that is set in the cache by FindBoost + # (while it was searching for boost-cmake). + unset(Boost_DIR CACHE) + set(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "Avoid future search of boost-cmake") + endif() +endif() + +message( STATUS "Boost include dirs: ${Boost_INCLUDE_DIRS}" ) +message( STATUS "Boost libraries: ${Boost_LIBRARIES}" ) + +set ( CGAL_USE_BOOST 1 ) + + +#.rst: +# Provided Functions +# ^^^^^^^^^^^^^^^^^^ +# +# .. command:: use_CGAL_Boost_support +# +# Link the target with the `Boost` libraries:: +# +# use_CGAL_Boost_support( target [INTERFACE] ) +# +# If the option ``INTERFACE`` is passed, the dependencies are +# added using :command:`target_link_libraries` with the ``INTERFACE`` +# keyword, or ``PUBLIC`` otherwise. + +function(use_CGAL_Boost_support target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + if(NOT Boost_FOUND) + message(FATAL_ERROR "use_CGAL_Boost_support is use whereas Boost_FOUND is false.") + return() + endif() + if(NOT CGAL_Boost_USE_STATIC_LIBS AND CGAL_AUTO_LINK_ENABLED) + target_compile_definitions(${target} ${keyword} BOOST_ALL_DYN_LINK=1) + endif() + target_include_directories(${target} SYSTEM ${keyword} ${Boost_INCLUDE_DIRS}) + target_link_libraries(${target} ${keyword} ${Boost_LIBRARIES}) +endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake new file mode 100644 index 00000000000..a784d745370 --- /dev/null +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -0,0 +1,150 @@ +#.rst: +# CGAL_SetupCGALDependencies +# -------------------------- +# +# The module searchs for the dependencies of the CGAL library: +# - the `GMP/MPFR` couple, +# - `LEDA` (optional) +# - the `Boost` libraries (mostly the header-only libraries) +# +# and defines the variable :variable:`CGAL_FOUND` and the function +# :command:`CGAL_setup_CGAL_dependencies`. +# +# Module Input Variables +# ^^^^^^^^^^^^^^^^^^^^^^ +# .. variable:: CGAL_DISABLE_GMP +# +# If set, the `GMP` library will not be used. If +# :variable:`WITH_LEDA` is not used either, a efficient exact +# number types are used by CGAL kernels for exact computation. +# +# .. variable:: WITH_LEDA +# +# If set, the `LEDA` library will be searched and used to provide +# the exact number types used by CGAL kernels. +# +# .. variable:: CGAL_HEADER_ONLY +# +# Set this variable if you are using the CGAL libraries as +# header-only libraries. +# +if(CGAL_SetupCGALDependencies_included) + return() +endif() +set(CGAL_SetupCGALDependencies_included TRUE) + +#.rst: +# Used Modules +# ^^^^^^^^^^^^ +# - :module:`CGAL_SetupGMP` +if(NOT CGAL_DISABLE_GMP) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupGMP.cmake) +endif() + +#.rst: +# - :module:`CGAL_SetupLEDA` +if(WITH_LEDA) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupLEDA.cmake) +endif() + +#.rst: +# - :module:`CGAL_SetupBoost` +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupBoost.cmake) + +#.rst: +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# .. variable:: CGAL_FOUND +# +# Set to `TRUE` if the dependencies of CGAL were found. +if(Boost_FOUND) + set(CGAL_FOUND TRUE) +endif() + +#.rst: +# +# Provided Functions +# ^^^^^^^^^^^^^^^^^^ +# +# .. command:: CGAL_setup_CGAL_dependencies +# +# Link the target with the dependencies of CGAL:: +# +# CGAL_setup_CGAL_dependencies( target [INTERFACE] ) +# +# If the option ``INTERFACE`` is passed, the dependencies are +# added using :command:`target_link_libraries` with the ``INTERFACE`` +# keyword, or ``PUBLIC`` otherwise. +# +function(CGAL_setup_CGAL_dependencies target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + if(NOT CGAL_DISABLE_GMP) + use_CGAL_GMP_support(${target} ${keyword}) + set(CGAL_USE_GMP TRUE CACHE INTERNAL "CGAL library is configured to use GMP") + set(CGAL_USE_MPFR TRUE CACHE INTERNAL "CGAL library is configured to use MPFR") + endif() + + if(WITH_LEDA) + use_CGAL_LEDA_support(${target} ${keyword}) + endif() + + if (CGAL_HEADER_ONLY) + target_compile_definitions(${target} ${keyword} CGAL_HEADER_ONLY=1) + endif() + if (RUNNING_CGAL_AUTO_TEST) + target_compile_definitions(${target} ${keyword} CGAL_TEST_SUITE=1) + endif() + + use_CGAL_Boost_support(${target} ${keyword}) + + foreach(dir ${CGAL_INCLUDE_DIRS}) + target_include_directories(${target} ${keyword} + $) + endforeach() + target_include_directories(${target} ${keyword} + $) + + # Now setup compilation flags + if(MSVC) + target_compile_options(${target} ${keyword} + "-D_CRT_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_DEPRECATE;-D_CRT_SECURE_NO_WARNINGS;-D_SCL_SECURE_NO_WARNINGS" + "/fp:strict" + "/fp:except-" + "/wd4503" # Suppress warnings C4503 about "decorated name length exceeded" + "/bigobj" # Use /bigobj by default + ) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") + message( STATUS "Using Intel Compiler. Adding -fp-model strict" ) + if(WIN32) + target_compile_options(${target} ${keyword} "/fp:strict") + else() + target_compile_options(${target} ${keyword} "-fp-model" "strict") + endif() + elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") + message( STATUS "Using SunPro compiler, using STLPort 4." ) + target_compile_options(${target} ${keyword} + "-features=extensions;-library=stlport4;-D_GNU_SOURCE") + target_link_libraries(${target} ${keyword} "-library=stlport4") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if ( RUNNING_CGAL_AUTO_TEST ) + target_compile_options(${target} ${keyword} "-Wall") + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3) + message( STATUS "Using gcc version 4 or later. Adding -frounding-math" ) + target_compile_options(${target} ${keyword} "-frounding-math") + endif() + if ( "${GCC_VERSION}" MATCHES "^4.2" ) + message( STATUS "Using gcc version 4.2. Adding -fno-strict-aliasing" ) + target_compile_options(${target} ${keyword} "-fno-strict-aliasing" ) + endif() + if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "alpha" ) + message( STATUS "Using gcc on alpha. Adding -mieee -mfp-rounding-mode=d" ) + target_compile_options(${target} ${keyword} "-mieee -mfp-rounding-mode=d" ) + endif() + endif() +endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake new file mode 100644 index 00000000000..b5f469cf386 --- /dev/null +++ b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake @@ -0,0 +1,70 @@ +#.rst: +# CGAL_SetupCGAL_CoreDependencies +# ------------------------------- +# +# The module searchs for the dependencies of the `CGAL_Core` library: +# - the `GMP/MPFR` couple, +# +# and defines the variable :variable:`CGAL_Core_FOUND` and the function +# :command:`CGAL_setup_CGAL_Core_dependencies`. +# +# Module Input Variables +# ^^^^^^^^^^^^^^^^^^^^^^ +# - :variable:`CGAL_DISABLE_GMP` + +if(CGAL_SetupCGAL_CoreDependencies_included) + return() +endif() +set(CGAL_SetupCGAL_CoreDependencies_included TRUE) + +#.rst: +# Used Modules +# ^^^^^^^^^^^^ +# - :module:`CGAL_SetupGMP` +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# .. variable:: CGAL_Core_FOUND +# +# Set to `TRUE` if the dependencies of `CGAL_Core` were found. + +if(NOT CGAL_DISABLE_GMP) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupGMP.cmake) + if(GMP_FOUND) + set(CGAL_Core_FOUND TRUE) + endif() +endif() + +#.rst: +# +# Provided Functions +# ^^^^^^^^^^^^^^^^^^ +# +# .. command:: CGAL_setup_CGAL_Core_dependencies +# +# Link the target with the dependencies of `CGAL_Core`:: +# +# CGAL_setup_CGAL_Core_dependencies( target [INTERFACE] ) +# +# If the option ``INTERFACE`` is passed, the dependencies are +# added using :command:`target_link_libraries` with the ``INTERFACE`` +# keyword, or ``PUBLIC`` otherwise. +# + +# See the release notes of CGAL-4.10: CGAL_Core now requires +# Boost.Thread, with all compilers but MSVC. +if (NOT MSVC) + find_package( Boost 1.48 REQUIRED thread system ) +endif() + +function(CGAL_setup_CGAL_Core_dependencies target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + use_CGAL_GMP_support(CGAL_Core ${keyword}) + target_compile_definitions(${target} ${keyword} CGAL_USE_CORE=1) + target_link_libraries( CGAL_Core ${keyword} CGAL::CGAL ${Boost_LIBRARIES}) +endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake new file mode 100644 index 00000000000..ed2981f3b5e --- /dev/null +++ b/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake @@ -0,0 +1,72 @@ +#.rst: +# CGAL_SetupCGAL_ImageIODependencies +# ---------------------------------- +# +# The module searchs for the dependencies of the `CGAL_ImageIO` library: +# - the `Zlib` library (optional) +# +# by calling +# +# .. code-block:: cmake +# +# find_package(ZLIB) +# +# and defines the variable :variable:`CGAL_ImageIO_FOUND` and the function +# :command:`CGAL_setup_CGAL_ImageIO_dependencies`. +# +if(CGAL_SetupCGAL_ImageIODependencies_included) + return() +endif() +set(CGAL_SetupCGAL_ImageIODependencies_included TRUE) + +#.rst: +# Used Modules +# ^^^^^^^^^^^^ +# - :module:`FindZLIB` +find_package( ZLIB ) + +define_property(TARGET PROPERTY CGAL_TARGET_USES_ZLIB + BRIEF_DOCS "Tells if the target uses ZLIB as a dependency" + FULL_DOCS "Tells if the target uses ZLIB as a dependency") + +#.rst: +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# .. variable:: CGAL_ImageIO_USE_ZLIB +# +# Set to `TRUE` if `CGAL_ImageIO` was compiled with `Zlib`. +# +# .. variable:: CGAL_ImageIO_FOUND +# +# Always set to `TRUE`. + +if(ZLIB_FOUND) + set(CGAL_ImageIO_USE_ZLIB ON CACHE BOOL "CGAL_ImageIO uses ZLIB") +endif(ZLIB_FOUND) + +set( CGAL_ImageIO_BASENAME CGAL_ImageIO) + +set(CGAL_ImageIO_FOUND TRUE) + +function(CGAL_setup_CGAL_ImageIO_dependencies target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + + target_link_libraries( CGAL_ImageIO ${keyword} CGAL::CGAL) + + if(ZLIB_FOUND) + target_include_directories( CGAL_ImageIO SYSTEM ${keyword} ${ZLIB_INCLUDE_DIRS}) + target_link_libraries( CGAL_ImageIO ${keyword} ${ZLIB_LIBRARIES}) + + target_compile_definitions( CGAL_ImageIO ${keyword} CGAL_USE_ZLIB=1) + if(NOT ARGV1 STREQUAL INTERFACE) + set_target_properties(CGAL_ImageIO PROPERTIES CGAL_TARGET_USES_ZLIB TRUE) + endif() + else() + message( STATUS "NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.") + endif() +endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_Qt5Dependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_Qt5Dependencies.cmake new file mode 100644 index 00000000000..ea5d623a499 --- /dev/null +++ b/Installation/cmake/modules/CGAL_SetupCGAL_Qt5Dependencies.cmake @@ -0,0 +1,105 @@ +#.rst: +# CGAL_SetupCGAL_Qt5Dependencies +# ------------------------------ +# +# The module searchs for the dependencies of the `CGAL_Qt5` library: +# - the `Qt5` libraries +# +# by calling +# +# .. code-block:: cmake +# +# find_package(Qt5 QUIET COMPONENTS OpenGL Svg) +# +# and defines the variable :variable:`CGAL_Qt5_FOUND` and the function +# :command:`CGAL_setup_CGAL_Qt5_dependencies`. +# + +if(CGAL_SetupCGAL_Qt5Dependencies_included) + return() +endif() +set(CGAL_SetupCGAL_Qt5Dependencies_included TRUE) + +#.rst: +# Used Modules +# ^^^^^^^^^^^^ +# - :module:`Qt5Config` +find_package(Qt5 QUIET COMPONENTS OpenGL Svg) + +set(CGAL_Qt5_MISSING_DEPS "") +if(NOT Qt5OpenGL_FOUND) + set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL") +endif() +if(NOT Qt5Svg_FOUND) + set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg") +endif() +if(NOT Qt5_FOUND) + set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5") +endif() + + +#.rst: +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# .. variable:: CGAL_Qt5_FOUND +# +# Set to `TRUE` if the dependencies of `CGAL_Qt5` were found. +# +if(NOT CGAL_Qt5_MISSING_DEPS) + set(CGAL_Qt5_FOUND TRUE) + + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Qt5_moc_and_resource_files.cmake) + + if(NOT TARGET CGAL_Qt5_moc_and_resources) + add_library(CGAL_Qt5_moc_and_resources STATIC ${_CGAL_Qt5_MOC_FILES_private} ${_CGAL_Qt5_RESOURCE_FILES_private}) + set_target_properties(CGAL_Qt5_moc_and_resources PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + EXCLUDE_FROM_ALL TRUE) + target_link_libraries(CGAL_Qt5_moc_and_resources CGAL::CGAL Qt5::Widgets Qt5::OpenGL Qt5::Svg) + + add_library(CGAL::CGAL_Qt5_moc_and_resources ALIAS CGAL_Qt5_moc_and_resources) + add_library(CGAL::Qt5_moc_and_resources ALIAS CGAL_Qt5_moc_and_resources) + endif() + +endif() + +#get_property(QT_UIC_EXECUTABLE TARGET Qt5::uic PROPERTY LOCATION) +#message( STATUS "Qt5Core include: ${Qt5Core_INCLUDE_DIRS}" ) +#message( STATUS "Qt5 libraries: ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5OpenGL_LIBRARIES}" ) +#message( STATUS "Qt5Core definitions: ${Qt5Core_DEFINITIONS}" ) +#message( STATUS "moc executable: ${QT_MOC_EXECUTABLE}" ) +#message( STATUS "uic executable: ${QT_UIC_EXECUTABLE}" ) + +#.rst: +# +# Provided Functions +# ^^^^^^^^^^^^^^^^^^ +# +# .. command:: CGAL_setup_CGAL_Qt5_dependencies +# +# Link the target with the dependencies of `CGAL_Qt5`:: +# +# CGAL_setup_CGAL_Qt5_dependencies( target [INTERFACE] ) +# +# If the option ``INTERFACE`` is passed, the dependencies are +# added using :command:`target_link_libraries` with the ``INTERFACE`` +# keyword, or ``PUBLIC`` otherwise. +# +function(CGAL_setup_CGAL_Qt5_dependencies target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + + if($ENV{CGAL_FAKE_PUBLIC_RELEASE}) + target_compile_definitions( ${target} ${keyword} CGAL_FAKE_PUBLIC_RELEASE=1 ) + endif() + target_link_libraries( ${target} ${keyword} CGAL::CGAL) + if(CGAL_HEADER_ONLY) + target_link_libraries( ${target} ${keyword} CGAL::Qt5_moc_and_resources) + endif() + target_link_libraries( ${target} ${keyword} Qt5::OpenGL Qt5::Svg) +endfunction() + diff --git a/Installation/cmake/modules/CGAL_SetupDependencies.cmake b/Installation/cmake/modules/CGAL_SetupDependencies.cmake index 6575cdf542d..1c0135b155a 100644 --- a/Installation/cmake/modules/CGAL_SetupDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupDependencies.cmake @@ -1,4 +1,4 @@ -include(CGAL_Macros) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake) message ( STATUS "External libraries supported: ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES}") @@ -82,4 +82,4 @@ if( NOT GMP_FOUND ) endif( NOT GMP_FOUND ) # finally setup Boost -include(CGAL_SetupBoost) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupBoost.cmake) diff --git a/Installation/cmake/modules/CGAL_SetupGMP.cmake b/Installation/cmake/modules/CGAL_SetupGMP.cmake new file mode 100644 index 00000000000..757ca2637a7 --- /dev/null +++ b/Installation/cmake/modules/CGAL_SetupGMP.cmake @@ -0,0 +1,50 @@ +#.rst: +# CGAL_SetupGMP +# ------------- +# +# The module searchs for the `GMP` and `MPFR` headers and libraries, +# by calling +# +# .. code-block:: cmake +# +# find_package(GMP) +# find_package(MPFR) +# +# and defines the function :command:`use_CGAL_GMP_support`. + +if(CGAL_SetupGMP_included OR CGAL_DISABLE_GMP) + return() +endif() +set(CGAL_SetupGMP_included TRUE) + +find_package(GMP) +find_package(MPFR) + +#.rst: +# Provided Functions +# ^^^^^^^^^^^^^^^^^^ +# +# .. command:: use_CGAL_GMP_support +# +# Link the target with the `GMP` and `MPFR` libraries:: +# +# use_CGAL_GMP_support( target [INTERFACE] ) +# +# If the option ``INTERFACE`` is passed, the dependencies are +# added using :command:`target_link_libraries` with the ``INTERFACE`` +# keyword, or ``PUBLIC`` otherwise. + +function(use_CGAL_GMP_support target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + if(NOT GMP_FOUND OR NOT MPFR_FOUND) + message(FATAL_ERROR "CGAL requires GMP and MPFR.") + return() + endif() + + target_include_directories(${target} SYSTEM ${keyword} ${GMP_INCLUDE_DIR} ${MPFR_INCLUDE_DIR}) + target_link_libraries(${target} ${keyword} ${GMP_LIBRARIES} ${MPFR_LIBRARIES}) +endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupLEDA.cmake b/Installation/cmake/modules/CGAL_SetupLEDA.cmake new file mode 100644 index 00000000000..fb7a2f6c721 --- /dev/null +++ b/Installation/cmake/modules/CGAL_SetupLEDA.cmake @@ -0,0 +1,47 @@ +#.rst: +# CGAL_SetupLEDA +# -------------- +# +# The module searchs for the `LEDA` headers and library, by calling +# +# .. code-block:: cmake +# +# find_package(LEDA) +# +# and defines the function :command:`use_CGAL_LEDA_support`. + +if(CGAL_SetupLEDA_included) + return() +endif() +set(CGAL_SetupLEDA_included TRUE) + +find_package(LEDA) + +#.rst: +# Provided Functions +# ^^^^^^^^^^^^^^^^^^ +# +# .. command:: use_CGAL_LEDA_support +# +# Link the target with the `LEDA` libraries:: +# +# use_CGAL_LEDA_support( target [INTERFACE] ) +# +# If the option ``INTERFACE`` is passed, the dependencies are +# added using :command:`target_link_libraries` with the ``INTERFACE`` +# keyword, or ``PUBLIC`` otherwise. + +function(use_CGAL_LEDA_support target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + if(NOT LEDA_FOUND) + message(FATAL_ERROR "use_CGAL_LEDA_support is use whereas LEDA_FOUND is false.") + return() + endif() + target_compile_options(${target} ${keyword} ${LEDA_CXX_FLAGS} ${LEDA_DEFINITIONS}) + target_include_directories(${target} SYSTEM ${keyword} ${LEDA_INCLUDE_DIR}) + target_link_libraries(${target} ${keyword} ${LEDA_LIBRARIES} ${LEDA_LINKER_FLAGS}) +endfunction() diff --git a/Installation/cmake/modules/CGAL_TweakFindBoost.cmake b/Installation/cmake/modules/CGAL_TweakFindBoost.cmake index 95577907b49..a27ff2d960b 100644 --- a/Installation/cmake/modules/CGAL_TweakFindBoost.cmake +++ b/Installation/cmake/modules/CGAL_TweakFindBoost.cmake @@ -52,10 +52,9 @@ if( NOT CGAL_TweakFindBoost ) # One must add -DBOOST_ALL_DYN_LINK to DEFINITIONS to use Boost # auto-link with shared libraries. - # First, add the variable to cache, if it was loaded from CGALConfig.cmake - cache_set(CGAL_3RD_PARTY_DEFINITIONS "${CGAL_3RD_PARTY_DEFINITIONS}") - # Then amend it - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DBOOST_ALL_DYN_LINK) + list(APPEND CGAL_3RD_PARTY_DEFINITIONS -DBOOST_ALL_DYN_LINK) + set(CGAL_3RD_PARTY_DEFINITIONS "${CGAL_3RD_PARTY_DEFINITIONS}" + CACHE INTERNAL "3rd party definitions for CGAL") endif() endif() diff --git a/Installation/cmake/modules/CGAL_UseRS.cmake b/Installation/cmake/modules/CGAL_UseRS.cmake index 5104bdd7549..d638ff0f12a 100644 --- a/Installation/cmake/modules/CGAL_UseRS.cmake +++ b/Installation/cmake/modules/CGAL_UseRS.cmake @@ -9,7 +9,7 @@ if( RS_FOUND AND NOT RS_SETUP ) message( STATUS "RS libraries: ${RS_LIBRARIES}" ) if( APPLE AND CMAKE_COMPILER_IS_GNUCXX ) - include( CGAL_VersionUtils ) + include( ${CMAKE_CURRENT_LIST_DIR}/CGAL_VersionUtils.cmake ) EXEC_PROGRAM( ${CMAKE_CXX_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE RS_GXX_VERSION ) diff --git a/Installation/cmake/modules/CGAL_UseRS3.cmake b/Installation/cmake/modules/CGAL_UseRS3.cmake index 77a4065ad44..3a560aecd72 100644 --- a/Installation/cmake/modules/CGAL_UseRS3.cmake +++ b/Installation/cmake/modules/CGAL_UseRS3.cmake @@ -3,7 +3,7 @@ if( RS3_FOUND AND NOT RS3_SETUP ) - include( CGAL_UseRS ) + include( ${CMAKE_CURRENT_LIST_DIR}/CGAL_UseRS.cmake ) # add rs3 parameters, if necessary (rs3 must be always after rsexport) message( STATUS "UseRS3" ) @@ -40,7 +40,7 @@ if( RS3_FOUND AND NOT RS3_SETUP ) message( STATUS "Using old RS signatures" ) endif( RS3_OLD_INCLUDES ) - include(CGAL_UseMPFI) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_UseMPFI.cmake) set (RS3_SETUP TRUE) diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake index 163ebfee9b9..79bef011112 100644 --- a/Installation/cmake/modules/CGAL_add_test.cmake +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -3,10 +3,26 @@ if(CGAL_add_test_included) endif(CGAL_add_test_included) set(CGAL_add_test_included TRUE) -if(POLICY CMP0064) - cmake_policy(SET CMP0064 NEW) +if(NOT POLICY CMP0064) + # CMake <= 3.3 + if(BUILD_TESTING) + message(WARNING + "CGAL CTest support requires CMake 3.4 or later.\n" + "You must either disable BUILD_TESTING or upgrade CMake.") + endif() + + # Add a fake function to avoid CMake errors + function(cgal_add_compilation_test) + endfunction() + + # Then return, to exit the file + return() endif() +include(CTest) + +cmake_policy(SET CMP0064 NEW) + include(CMakeParseArguments) option(CGAL_CTEST_DISPLAY_MEM_AND_TIME @@ -19,6 +35,11 @@ if(CGAL_CTEST_DISPLAY_MEM_AND_TIME) endif() endif() +if(ANDROID) + set(ANDROID_DIR_PREFIX /data/local/tmp/) + find_program(adb_executable adb) +endif() + # Process a list, and replace items contains a file pattern (like # `*.off`) by the sublist that corresponds to the globbing of the # pattern in the directory `${CGAL_CURRENT_SOURCE_DIR}`. @@ -61,7 +82,7 @@ function(expand_list_with_globbing list_name) endfunction() function(cgal_add_compilation_test exe_name) - if(TEST compilation_of__${exe_name}) + if(NOT POLICY CMP0064 OR TEST compilation_of__${exe_name}) return() endif() add_test(NAME "compilation_of__${exe_name}" @@ -78,7 +99,7 @@ function(cgal_setup_test_properties test_name) APPEND PROPERTY LABELS "${PROJECT_NAME}") # message(STATUS " working dir: ${CGAL_CURRENT_SOURCE_DIR}") set_property(TEST "${test_name}" - PROPERTY WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR}) + PROPERTY WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) if(exe_name) set_property(TEST "${test_name}" APPEND PROPERTY DEPENDS "compilation_of__${exe_name}") @@ -86,20 +107,47 @@ function(cgal_setup_test_properties test_name) if(POLICY CMP0066) # CMake 3.7 or later if(NOT TEST ${PROJECT_NAME}_SetupFixture) - add_test(NAME ${PROJECT_NAME}_SetupFixture - COMMAND - ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir - ) + if(ANDROID) + add_test(NAME ${PROJECT_NAME}_SetupFixture + COMMAND + ${adb_executable} push + ${CMAKE_CURRENT_SOURCE_DIR} + ${ANDROID_DIR_PREFIX}${PROJECT_NAME} + ) + add_test(NAME ${PROJECT_NAME}_copy_GMP_MPFR + COMMAND + ${adb_executable} push + ${GMP_LIBRARIES} ${MPFR_LIBRARIES} + ${ANDROID_DIR_PREFIX}${PROJECT_NAME} + ) + set_property(TEST ${PROJECT_NAME}_copy_GMP_MPFR + APPEND PROPERTY DEPENDS ${PROJECT_NAME}_SetupFixture) + set_property(TEST ${PROJECT_NAME}_copy_GMP_MPFR + PROPERTY FIXTURES_SETUP ${PROJECT_NAME}) + else() + add_test(NAME ${PROJECT_NAME}_SetupFixture + COMMAND + ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir + ) + endif() set_property(TEST ${PROJECT_NAME}_SetupFixture PROPERTY FIXTURES_SETUP ${PROJECT_NAME}) - add_test(NAME ${PROJECT_NAME}_CleanupFixture - COMMAND - ${CMAKE_COMMAND} -E remove_directory - ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir - ) + if(ANDROID) + add_test(NAME ${PROJECT_NAME}_CleanupFixture + COMMAND + ${adb_executable} shell rm -rf + ${ANDROID_DIR_PREFIX}${PROJECT_NAME} + ) + else() + add_test(NAME ${PROJECT_NAME}_CleanupFixture + COMMAND + ${CMAKE_COMMAND} -E remove_directory + ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir + ) + endif() set_property(TEST ${PROJECT_NAME}_CleanupFixture PROPERTY FIXTURES_CLEANUP ${PROJECT_NAME}) @@ -107,15 +155,26 @@ function(cgal_setup_test_properties test_name) ${PROJECT_NAME}_CleanupFixture ${PROJECT_NAME}_SetupFixture APPEND PROPERTY LABELS "${PROJECT_NAME}") endif() - set_tests_properties("${test_name}" - PROPERTIES - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir - FIXTURES_REQUIRED "${PROJECT_NAME}") + if(NOT ANDROID) + set_property(TEST "${test_name}" + PROPERTY + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir) + endif() + set_property(TEST "${test_name}" + APPEND PROPERTY FIXTURES_REQUIRED "${PROJECT_NAME}") if(exe_name) set_property(TEST ${test_name} APPEND PROPERTY FIXTURES_REQUIRED "${exe_name}") set_property(TEST "compilation_of__${exe_name}" PROPERTY FIXTURES_SETUP "${exe_name}") + if(ANDROID) + add_test(NAME "push_of__${exe_name}" + COMMAND ${adb_executable} push $ ${ANDROID_DIR_PREFIX}${PROJECT_NAME}/${exe_name}) + set_property(TEST "push_of__${exe_name}" + APPEND PROPERTY FIXTURES_SETUP "${exe_name}") + set_property(TEST "push_of__${exe_name}" + APPEND PROPERTY DEPENDS "compilation_of__${exe_name}") + endif() endif() endif() # end CMake 3.7 or later endfunction(cgal_setup_test_properties) @@ -124,7 +183,7 @@ function(cgal_add_test exe_name) cgal_add_compilation_test(${exe_name}) cmake_parse_arguments("cgal_add_test" # prefix - "" # optional arguments + "NO_EXECUTION" # optional arguments "TEST_NAME" # single arguments "ARGUMENTS" # multivalue arguments ${ARGN}) @@ -135,7 +194,7 @@ function(cgal_add_test exe_name) set(test_name "execution___of__${exe_name}") endif() # message(" test_name: ${test_name}") - if(TEST ${test_name}) + if(cgal_add_test_NO_EXECUTION OR NOT POLICY CMP0064 OR TEST ${test_name}) return() endif() # message("Add test ${test_name}") @@ -145,7 +204,11 @@ function(cgal_add_test exe_name) COMMAND ${TIME_COMMAND} ${CMAKE_COMMAND} -DCMD:STRING=$ -DCIN:STRING=${cin_file} + -DANDROID_DIR_PREFIX=${ANDROID_DIR_PREFIX} + -DPROJECT_NAME=${PROJECT_NAME} -P "${CGAL_MODULES_DIR}/run_test_with_cin.cmake") + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${cin_file}) # message(STATUS "add test: ${exe_name} < ${cin_file}") else() if(NOT ARGS AND NOT cgal_add_test_TEST_NAME) @@ -168,10 +231,16 @@ function(cgal_add_test exe_name) list(APPEND ARGS ${CMD_LINE_ARGS}) endforeach() expand_list_with_globbing(ARGS) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${cmd_file}) endif() endif() # message(STATUS "add test: ${exe_name} ${ARGS}") - add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} $ ${ARGS}) + if(ANDROID) + add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} ${adb_executable} shell cd ${ANDROID_DIR_PREFIX}${PROJECT_NAME} && LD_LIBRARY_PATH=${ANDROID_DIR_PREFIX}${PROJECT_NAME} ${ANDROID_DIR_PREFIX}${PROJECT_NAME}/${exe_name} ${ARGS}) + else() + add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} $ ${ARGS}) + endif() endif() cgal_setup_test_properties(${test_name} ${exe_name}) return() @@ -197,3 +266,6 @@ function(cgal_add_test exe_name) set_property(TEST "${test_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") endfunction() + +function(CGAL_add_compilation_tests_for_all_targets) +endfunction() diff --git a/Installation/cmake/modules/CGAL_display_flags.cmake b/Installation/cmake/modules/CGAL_display_flags.cmake new file mode 100644 index 00000000000..777d6402898 --- /dev/null +++ b/Installation/cmake/modules/CGAL_display_flags.cmake @@ -0,0 +1,21 @@ +if(CMAKE_CONFIGURATION_TYPES) + # Multi-configuration CMake generator, + message( STATUS "Multi-configuration CMake generator: cannot display flags" ) + return() +endif() + +message( STATUS "Build type: ${CMAKE_BUILD_TYPE}" ) + +string( TOUPPER "${CMAKE_BUILD_TYPE}" CGAL_BUILD_TYPE_UPPER ) + +message( STATUS "USING CXXFLAGS = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CGAL_BUILD_TYPE_UPPER}}'" ) + +if ( CGAL_BUILDING_LIBS ) + if ( BUILD_SHARED_LIBS ) + message( STATUS "USING LDFLAGS = '${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CGAL_BUILD_TYPE_UPPER}}'" ) + else() + message( STATUS "USING LDFLAGS = '${CMAKE_STATIC_LINKER_FLAGS} ${CMAKE_STATIC_LINKER_FLAGS_${CGAL_BUILD_TYPE_UPPER}}'" ) + endif() +else() + message( STATUS "USING EXEFLAGS = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CGAL_BUILD_TYPE_UPPER}}'" ) +endif() diff --git a/Installation/cmake/modules/CGAL_setup_target_dependencies.cmake b/Installation/cmake/modules/CGAL_setup_target_dependencies.cmake new file mode 100644 index 00000000000..73a357b4d08 --- /dev/null +++ b/Installation/cmake/modules/CGAL_setup_target_dependencies.cmake @@ -0,0 +1,17 @@ +function(CGAL_setup_target_dependencies target) + if(ARGV1 STREQUAL INTERFACE) + set(keyword INTERFACE) + else() + set(keyword PUBLIC) + endif() + + if(${target} STREQUAL CGAL) + CGAL_setup_CGAL_dependencies(${target} ${keyword}) + elseif(${target} STREQUAL CGAL_Core) + CGAL_setup_CGAL_Core_dependencies(${target} ${keyword}) + elseif(${target} STREQUAL CGAL_ImageIO) + CGAL_setup_CGAL_ImageIO_dependencies(${target} ${keyword}) + elseif(${target} STREQUAL CGAL_Qt5) + CGAL_setup_CGAL_Qt5_dependencies(${target} ${keyword}) + endif() +endfunction() diff --git a/Installation/cmake/modules/CGAL_target_use_TBB.cmake b/Installation/cmake/modules/CGAL_target_use_TBB.cmake new file mode 100644 index 00000000000..2cb56b11ad9 --- /dev/null +++ b/Installation/cmake/modules/CGAL_target_use_TBB.cmake @@ -0,0 +1,10 @@ +if (CGAL_target_use_TBB_included) + return() +endif() +set(CGAL_target_use_TBB_included TRUE) + +function(CGAL_target_use_TBB target) + target_include_directories ( ${target} SYSTEM PRIVATE ${TBB_INCLUDE_DIRS} ) + target_link_libraries( ${target} PRIVATE ${TBB_LIBRARIES} ) + target_compile_options( ${target} PRIVATE -DNOMINMAX -DCGAL_LINKED_WITH_TBB ) +endfunction() diff --git a/Installation/cmake/modules/FindBLAS.cmake b/Installation/cmake/modules/FindBLAS.cmake index f00a896d66f..34f5bb5fdf2 100644 --- a/Installation/cmake/modules/FindBLAS.cmake +++ b/Installation/cmake/modules/FindBLAS.cmake @@ -32,8 +32,8 @@ include(CheckFunctionExists) -include(CGAL_GeneratorSpecificSettings) -include(CGAL_Macros) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake) # This macro checks for the existence of the combination of fortran libraries @@ -161,7 +161,7 @@ else() # Look first for the TAUCS library distributed with CGAL in auxiliary/taucs. # Set CGAL_TAUCS_FOUND, CGAL_TAUCS_INCLUDE_DIR and CGAL_TAUCS_LIBRARIES_DIR. - include(CGAL_Locate_CGAL_TAUCS) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake) # Search for BLAS in CGAL_TAUCS_INCLUDE_DIR/CGAL_TAUCS_LIBRARIES_DIR (TAUCS shipped with CGAL)... if(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED) diff --git a/Installation/cmake/modules/FindF2C.cmake b/Installation/cmake/modules/FindF2C.cmake index b677ec18218..105a31632d2 100644 --- a/Installation/cmake/modules/FindF2C.cmake +++ b/Installation/cmake/modules/FindF2C.cmake @@ -15,7 +15,7 @@ else(F2C_LIBRARIES) # F2C shipped with CGAL (as part of TAUCS)? # If found, we will search for f2c library in ${CGAL_TAUCS_LIBRARIES_DIR}. - include(CGAL_Locate_CGAL_TAUCS) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake) find_library(F2C_LIBRARIES NAMES f2c g2c vcf2c PATHS ${CGAL_TAUCS_LIBRARIES_DIR} diff --git a/Installation/cmake/modules/FindGMP.cmake b/Installation/cmake/modules/FindGMP.cmake index 9f2ac1802b1..1cd156da92f 100644 --- a/Installation/cmake/modules/FindGMP.cmake +++ b/Installation/cmake/modules/FindGMP.cmake @@ -9,7 +9,7 @@ # TODO: support MacOSX include(FindPackageHandleStandardArgs) -include(CGAL_GeneratorSpecificSettings) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) if(GMP_INCLUDE_DIR) set(GMP_in_cache TRUE) diff --git a/Installation/cmake/modules/FindLAPACK.cmake b/Installation/cmake/modules/FindLAPACK.cmake index 660429c0756..8612095f14e 100644 --- a/Installation/cmake/modules/FindLAPACK.cmake +++ b/Installation/cmake/modules/FindLAPACK.cmake @@ -31,8 +31,8 @@ include(CheckFunctionExists) -include(CGAL_GeneratorSpecificSettings) -include(CGAL_Macros) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake) # This macro checks for the existence of the combination of fortran libraries @@ -172,7 +172,7 @@ else() # Look first for the TAUCS library distributed with CGAL in auxiliary/taucs. # Set CGAL_TAUCS_FOUND, CGAL_TAUCS_INCLUDE_DIR and CGAL_TAUCS_LIBRARIES_DIR. - include(CGAL_Locate_CGAL_TAUCS) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake) # Search for LAPACK in CGAL_TAUCS_INCLUDE_DIR/CGAL_TAUCS_LIBRARIES_DIR (TAUCS shipped with CGAL)... if(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED) diff --git a/Installation/cmake/modules/FindMKL.cmake b/Installation/cmake/modules/FindMKL.cmake index 92def59f19c..391c7b1d082 100644 --- a/Installation/cmake/modules/FindMKL.cmake +++ b/Installation/cmake/modules/FindMKL.cmake @@ -15,8 +15,8 @@ include(CheckFunctionExists) -include(CGAL_GeneratorSpecificSettings) -include(CGAL_Macros) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake) # This macro checks for the existence of the combination of fortran libraries diff --git a/Installation/cmake/modules/FindMPFR.cmake b/Installation/cmake/modules/FindMPFR.cmake index c01948fb188..f108294cb6f 100644 --- a/Installation/cmake/modules/FindMPFR.cmake +++ b/Installation/cmake/modules/FindMPFR.cmake @@ -8,7 +8,7 @@ # TODO: support MacOSX include(FindPackageHandleStandardArgs) -include(CGAL_GeneratorSpecificSettings) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) if(MPFR_INCLUDE_DIR) set(MPFR_in_cache TRUE) diff --git a/Installation/cmake/modules/FindNTL.cmake b/Installation/cmake/modules/FindNTL.cmake index 1a76114b2b3..55d671bd1c1 100644 --- a/Installation/cmake/modules/FindNTL.cmake +++ b/Installation/cmake/modules/FindNTL.cmake @@ -10,7 +10,7 @@ if( (TARGET CGAL AND NOT WITH_GMP) OR NOT GMP_FOUND ) else( (TARGET CGAL AND NOT WITH_GMP) OR NOT GMP_FOUND ) - include( CGAL_VersionUtils ) + include( ${CMAKE_CURRENT_LIST_DIR}/CGAL_VersionUtils.cmake ) get_dependency_version( GMP ) diff --git a/Installation/cmake/modules/FindOpenGL.cmake b/Installation/cmake/modules/FindOpenGL.cmake deleted file mode 100644 index 49121fd6717..00000000000 --- a/Installation/cmake/modules/FindOpenGL.cmake +++ /dev/null @@ -1,31 +0,0 @@ -if ( NOT FIND_OPENGL_WRAPPER ) - - set ( FIND_OPENGL_WRAPPER 1 ) - - set(SAVED_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ) - - set(CMAKE_MODULE_PATH ${ORIG_CMAKE_MODULE_PATH} ) - - find_package(OpenGL) - - if ( OPENGL_FOUND AND CGAL_APPLE_LEOPARD ) - - if ( BUILD_SHARED_LIBS ) - - uniquely_add_flags( CMAKE_SHARED_LINKER_FLAGS - "-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib" - ) - - else() - - uniquely_add_flags( CMAKE_MODULE_LINKER_FLAGS - "-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib" - ) - endif() - - - endif() - - set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH} ) - -endif() diff --git a/Installation/cmake/modules/FindQGLViewer.cmake b/Installation/cmake/modules/FindQGLViewer.cmake index e769d9e196f..aadfa505689 100644 --- a/Installation/cmake/modules/FindQGLViewer.cmake +++ b/Installation/cmake/modules/FindQGLViewer.cmake @@ -6,6 +6,12 @@ # QGLVIEWER_LIBRARIES - Link these to use QGLViewer # QGLVIEWER_DEFINITIONS - Compiler switches required for using QGLViewer # +if(POLICY CMP0072) + # About the use of OpenGL + cmake_policy(SET CMP0072 NEW) +endif() +find_package(OpenGL QUIET) +find_package(Qt5 QUIET COMPONENTS OpenGL Xml) # first look in user defined locations find_path(QGLVIEWER_INCLUDE_DIR @@ -50,9 +56,9 @@ endif() if(QGLVIEWER_LIBRARY_RELEASE) if(QGLVIEWER_LIBRARY_DEBUG) - set(QGLVIEWER_LIBRARIES_ optimized ${QGLVIEWER_LIBRARY_RELEASE} debug ${QGLVIEWER_LIBRARY_DEBUG}) + set(QGLVIEWER_LIBRARIES_ Qt5::Xml Qt5::OpenGL ${OPENGL_LIBRARIES} optimized ${QGLVIEWER_LIBRARY_RELEASE} debug ${QGLVIEWER_LIBRARY_DEBUG}) else() - set(QGLVIEWER_LIBRARIES_ ${QGLVIEWER_LIBRARY_RELEASE}) + set(QGLVIEWER_LIBRARIES_ Qt5::Xml Qt5::OpenGL ${OPENGL_LIBRARIES} ${QGLVIEWER_LIBRARY_RELEASE}) endif() set(QGLVIEWER_LIBRARIES ${QGLVIEWER_LIBRARIES_} CACHE FILEPATH "The QGLViewer library") diff --git a/Installation/cmake/modules/FindRS.cmake b/Installation/cmake/modules/FindRS.cmake index 9ddba75c32c..00eac97e03b 100644 --- a/Installation/cmake/modules/FindRS.cmake +++ b/Installation/cmake/modules/FindRS.cmake @@ -11,7 +11,7 @@ endif() if( MPFI_FOUND ) - include( CGAL_VersionUtils ) + include( ${CMAKE_CURRENT_LIST_DIR}/CGAL_VersionUtils.cmake ) find_path(RS_INCLUDE_DIR NAMES rs_exports.h diff --git a/Installation/cmake/modules/FindRS3.cmake b/Installation/cmake/modules/FindRS3.cmake index d2d1753e83b..fbb782bac6a 100644 --- a/Installation/cmake/modules/FindRS3.cmake +++ b/Installation/cmake/modules/FindRS3.cmake @@ -9,7 +9,7 @@ if ( RS_FOUND ) if( MPFI_FOUND ) - include( CGAL_VersionUtils ) + include( ${CMAKE_CURRENT_LIST_DIR}/CGAL_VersionUtils.cmake ) find_path(RS3_INCLUDE_DIR NAMES rs3_fncts.h diff --git a/Installation/cmake/modules/FindTAUCS.cmake b/Installation/cmake/modules/FindTAUCS.cmake index d6625e7471c..f45c51dd9d6 100644 --- a/Installation/cmake/modules/FindTAUCS.cmake +++ b/Installation/cmake/modules/FindTAUCS.cmake @@ -11,7 +11,7 @@ # TAUCS_USE_FILE - The name of the cmake module to include to compile # applications or libraries using TAUCS. -include(CGAL_GeneratorSpecificSettings) +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) # TAUCS requires LAPACK if(TAUCS_FIND_QUIETLY OR NOT TAUCS_FIND_REQUIRED) @@ -43,7 +43,7 @@ else() # Look first for the TAUCS library distributed with CGAL in auxiliary/taucs. # Set CGAL_TAUCS_FOUND, CGAL_TAUCS_INCLUDE_DIR and CGAL_TAUCS_LIBRARIES_DIR. - include(CGAL_Locate_CGAL_TAUCS) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake) # Search for TAUCS headers in ${CGAL_TAUCS_INCLUDE_DIR} (TAUCS shipped with CGAL), # else in $TAUCS_INC_DIR environment variable. diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 13f4d9292a2..0d9a135cd52 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -418,7 +418,7 @@ if (TBB_FOUND) endif (TBB_FOUND) set(TBB_USE_FILE "UseTBB") - +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake) ### ** Emacs settings ** ### Local Variables: ### cmake-tab-width: 4 diff --git a/Installation/cmake/modules/Help/CGAL_SetupBoost.rst b/Installation/cmake/modules/Help/CGAL_SetupBoost.rst new file mode 100644 index 00000000000..23f0d839045 --- /dev/null +++ b/Installation/cmake/modules/Help/CGAL_SetupBoost.rst @@ -0,0 +1 @@ +.. cmake-module:: ../CGAL_SetupBoost.cmake diff --git a/Installation/cmake/modules/Help/CGAL_SetupCGALDependencies.rst b/Installation/cmake/modules/Help/CGAL_SetupCGALDependencies.rst new file mode 100644 index 00000000000..b660bd26231 --- /dev/null +++ b/Installation/cmake/modules/Help/CGAL_SetupCGALDependencies.rst @@ -0,0 +1 @@ +.. cmake-module:: ../CGAL_SetupCGALDependencies.cmake diff --git a/Installation/cmake/modules/Help/CGAL_SetupCGAL_CoreDependencies.rst b/Installation/cmake/modules/Help/CGAL_SetupCGAL_CoreDependencies.rst new file mode 100644 index 00000000000..7db98a80573 --- /dev/null +++ b/Installation/cmake/modules/Help/CGAL_SetupCGAL_CoreDependencies.rst @@ -0,0 +1 @@ +.. cmake-module:: ../CGAL_SetupCGAL_CoreDependencies.cmake diff --git a/Installation/cmake/modules/Help/CGAL_SetupCGAL_ImageIODependencies.rst b/Installation/cmake/modules/Help/CGAL_SetupCGAL_ImageIODependencies.rst new file mode 100644 index 00000000000..98fef84747d --- /dev/null +++ b/Installation/cmake/modules/Help/CGAL_SetupCGAL_ImageIODependencies.rst @@ -0,0 +1 @@ +.. cmake-module:: ../CGAL_SetupCGAL_ImageIODependencies.cmake diff --git a/Installation/cmake/modules/Help/CGAL_SetupCGAL_Qt5Dependencies.rst b/Installation/cmake/modules/Help/CGAL_SetupCGAL_Qt5Dependencies.rst new file mode 100644 index 00000000000..815f7a4dd5f --- /dev/null +++ b/Installation/cmake/modules/Help/CGAL_SetupCGAL_Qt5Dependencies.rst @@ -0,0 +1 @@ +.. cmake-module:: ../CGAL_SetupCGAL_Qt5Dependencies.cmake diff --git a/Installation/cmake/modules/Help/CGAL_SetupGMP.rst b/Installation/cmake/modules/Help/CGAL_SetupGMP.rst new file mode 100644 index 00000000000..701ef3aabed --- /dev/null +++ b/Installation/cmake/modules/Help/CGAL_SetupGMP.rst @@ -0,0 +1 @@ +.. cmake-module:: ../CGAL_SetupGMP.cmake diff --git a/Installation/cmake/modules/Help/CGAL_SetupLEDA.rst b/Installation/cmake/modules/Help/CGAL_SetupLEDA.rst new file mode 100644 index 00000000000..d9a872a44a8 --- /dev/null +++ b/Installation/cmake/modules/Help/CGAL_SetupLEDA.rst @@ -0,0 +1 @@ +.. cmake-module:: ../CGAL_SetupLEDA.cmake diff --git a/Installation/cmake/modules/Help/cmake.py b/Installation/cmake/modules/Help/cmake.py new file mode 100644 index 00000000000..32003d475e6 --- /dev/null +++ b/Installation/cmake/modules/Help/cmake.py @@ -0,0 +1,393 @@ +#============================================================================= +# CMake - Cross Platform Makefile Generator +# Copyright 2000-2013 Kitware, Inc., Insight Software Consortium +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +import os +import re + +# Monkey patch for pygments reporting an error when generator expressions are +# used. +# https://bitbucket.org/birkenfeld/pygments-main/issue/942/cmake-generator-expressions-not-handled +from pygments.lexers import CMakeLexer +from pygments.token import Name, Operator +from pygments.lexer import bygroups +CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)', + bygroups(Operator, Name.Variable, Operator))) + +# Monkey patch for sphinx generating invalid content for qcollectiongenerator +# https://bitbucket.org/birkenfeld/sphinx/issue/1435/qthelp-builder-should-htmlescape-keywords +from sphinx.util.pycompat import htmlescape +from sphinx.builders.qthelp import QtHelpBuilder +old_build_keywords = QtHelpBuilder.build_keywords +def new_build_keywords(self, title, refs, subitems): + old_items = old_build_keywords(self, title, refs, subitems) + new_items = [] + for item in old_items: + before, rest = item.split("ref=\"", 1) + ref, after = rest.split("\"") + if ("<" in ref and ">" in ref): + new_items.append(before + "ref=\"" + htmlescape(ref) + "\"" + after) + else: + new_items.append(item) + return new_items +QtHelpBuilder.build_keywords = new_build_keywords + + +from docutils.parsers.rst import Directive, directives +from docutils.transforms import Transform +try: + from docutils.utils.error_reporting import SafeString, ErrorString +except ImportError: + # error_reporting was not in utils before version 0.11: + from docutils.error_reporting import SafeString, ErrorString + +from docutils import io, nodes + +from sphinx.directives import ObjectDescription +from sphinx.domains import Domain, ObjType +from sphinx.roles import XRefRole +from sphinx.util.nodes import make_refnode +from sphinx import addnodes + +class CMakeModule(Directive): + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + option_spec = {'encoding': directives.encoding} + + def __init__(self, *args, **keys): + self.re_start = re.compile(r'^#\[(?P=*)\[\.rst:$') + Directive.__init__(self, *args, **keys) + + def run(self): + settings = self.state.document.settings + if not settings.file_insertion_enabled: + raise self.warning('"%s" directive disabled.' % self.name) + + env = self.state.document.settings.env + rel_path, path = env.relfn2path(self.arguments[0]) + path = os.path.normpath(path) + encoding = self.options.get('encoding', settings.input_encoding) + e_handler = settings.input_encoding_error_handler + try: + settings.record_dependencies.add(path) + f = io.FileInput(source_path=path, encoding=encoding, + error_handler=e_handler) + except UnicodeEncodeError as error: + raise self.severe('Problems with "%s" directive path:\n' + 'Cannot encode input file path "%s" ' + '(wrong locale?).' % + (self.name, SafeString(path))) + except IOError as error: + raise self.severe('Problems with "%s" directive path:\n%s.' % + (self.name, ErrorString(error))) + raw_lines = f.read().splitlines() + f.close() + rst = None + lines = [] + for line in raw_lines: + if rst is not None and rst != '#': + # Bracket mode: check for end bracket + pos = line.find(rst) + if pos >= 0: + if line[0] == '#': + line = '' + else: + line = line[0:pos] + rst = None + else: + # Line mode: check for .rst start (bracket or line) + m = self.re_start.match(line) + if m: + rst = ']%s]' % m.group('eq') + line = '' + elif line == '#.rst:': + rst = '#' + line = '' + elif rst == '#': + if line == '#' or line[:2] == '# ': + line = line[2:] + else: + rst = None + line = '' + elif rst is None: + line = '' + lines.append(line) + if rst is not None and rst != '#': + raise self.warning('"%s" found unclosed bracket "#[%s[.rst:" in %s' % + (self.name, rst[1:-1], path)) + self.state_machine.insert_input(lines, path) + return [] + +class _cmake_index_entry: + def __init__(self, desc): + self.desc = desc + + def __call__(self, title, targetid, main = 'main'): +# return (targetid, title, main, targetid, '', '', 0) + return ('pair', u'%s ; %s' % (self.desc, title), targetid, main) + +_cmake_index_objs = { + 'command': _cmake_index_entry('command'), + 'generator': _cmake_index_entry('generator'), + 'manual': _cmake_index_entry('manual'), + 'module': _cmake_index_entry('module'), + 'policy': _cmake_index_entry('policy'), + 'prop_cache': _cmake_index_entry('cache property'), + 'prop_dir': _cmake_index_entry('directory property'), + 'prop_gbl': _cmake_index_entry('global property'), + 'prop_inst': _cmake_index_entry('installed file property'), + 'prop_sf': _cmake_index_entry('source file property'), + 'prop_test': _cmake_index_entry('test property'), + 'prop_tgt': _cmake_index_entry('target property'), + 'variable': _cmake_index_entry('variable'), + } + +def _cmake_object_inventory(env, document, line, objtype, targetid): + inv = env.domaindata['cmake']['objects'] + if targetid in inv: + document.reporter.warning( + 'CMake object "%s" also described in "%s".' % + (targetid, env.doc2path(inv[targetid][0])), line=line) + inv[targetid] = (env.docname, objtype) + +class CMakeTransform(Transform): + + # Run this transform early since we insert nodes we want + # treated as if they were written in the documents. + default_priority = 210 + + def __init__(self, document, startnode): + Transform.__init__(self, document, startnode) + self.titles = {} + + def parse_title(self, docname): + """Parse a document title as the first line starting in [A-Za-z0-9<] + or fall back to the document basename if no such line exists. + The cmake --help-*-list commands also depend on this convention. + Return the title or False if the document file does not exist. + """ + env = self.document.settings.env + title = self.titles.get(docname) + if title is None: + fname = os.path.join(env.srcdir, docname+'.rst') + try: + f = open(fname, 'r') + except IOError: + title = False + else: + for line in f: + if len(line) > 0 and (line[0].isalnum() or line[0] == '<'): + title = line.rstrip() + break + f.close() + if title is None: + title = os.path.basename(docname) + self.titles[docname] = title + return title + + def apply(self): + env = self.document.settings.env + + # Treat some documents as cmake domain objects. + objtype, sep, tail = env.docname.rpartition('/') + make_index_entry = _cmake_index_objs.get(objtype) + if make_index_entry: + title = self.parse_title(env.docname) + # Insert the object link target. + if objtype == 'command': + targetname = title.lower() + else: + targetname = title + targetid = '%s:%s' % (objtype, targetname) + targetnode = nodes.target('', '', ids=[targetid]) + self.document.note_explicit_target(targetnode) + self.document.insert(0, targetnode) + # Insert the object index entry. + indexnode = addnodes.index() + indexnode['entries'] = [make_index_entry(title, targetid)] + self.document.insert(0, indexnode) + # Add to cmake domain object inventory + _cmake_object_inventory(env, self.document, 1, objtype, targetid) + +class CMakeObject(ObjectDescription): + + def handle_signature(self, sig, signode): + # called from sphinx.directives.ObjectDescription.run() + signode += addnodes.desc_name(sig, sig) + return sig + + def add_target_and_index(self, name, sig, signode): + if self.objtype == 'command': + targetname = name.lower() + else: + targetname = name + targetid = '%s:%s' % (self.objtype, targetname) + if targetid not in self.state.document.ids: + signode['names'].append(targetid) + signode['ids'].append(targetid) + signode['first'] = (not self.names) + self.state.document.note_explicit_target(signode) + _cmake_object_inventory(self.env, self.state.document, + self.lineno, self.objtype, targetid) + + make_index_entry = _cmake_index_objs.get(self.objtype) + if make_index_entry: + self.indexnode['entries'].append(make_index_entry(name, targetid)) + +class CMakeXRefRole(XRefRole): + + # See sphinx.util.nodes.explicit_title_re; \x00 escapes '<'. + _re = re.compile(r'^(.+?)(\s*)(?$', re.DOTALL) + _re_sub = re.compile(r'^([^()\s]+)\s*\(([^()]*)\)$', re.DOTALL) + + def __call__(self, typ, rawtext, text, *args, **keys): + # Translate CMake command cross-references of the form: + # `command_name(SUB_COMMAND)` + # to have an explicit target: + # `command_name(SUB_COMMAND) ` + if typ == 'cmake:command': + m = CMakeXRefRole._re_sub.match(text) + if m: + text = '%s <%s>' % (text, m.group(1)) + # CMake cross-reference targets frequently contain '<' so escape + # any explicit `` with '<' not preceded by whitespace. + while True: + m = CMakeXRefRole._re.match(text) + if m and len(m.group(2)) == 0: + text = '%s\x00<%s>' % (m.group(1), m.group(3)) + else: + break + return XRefRole.__call__(self, typ, rawtext, text, *args, **keys) + + # We cannot insert index nodes using the result_nodes method + # because CMakeXRefRole is processed before substitution_reference + # nodes are evaluated so target nodes (with 'ids' fields) would be + # duplicated in each evaluted substitution replacement. The + # docutils substitution transform does not allow this. Instead we + # use our own CMakeXRefTransform below to add index entries after + # substitutions are completed. + # + # def result_nodes(self, document, env, node, is_ref): + # pass + +class CMakeXRefTransform(Transform): + + # Run this transform early since we insert nodes we want + # treated as if they were written in the documents, but + # after the sphinx (210) and docutils (220) substitutions. + default_priority = 221 + + def apply(self): + env = self.document.settings.env + + # Find CMake cross-reference nodes and add index and target + # nodes for them. + for ref in self.document.traverse(addnodes.pending_xref): + if not ref['refdomain'] == 'cmake': + continue + + objtype = ref['reftype'] + make_index_entry = _cmake_index_objs.get(objtype) + if not make_index_entry: + continue + + objname = ref['reftarget'] + targetnum = env.new_serialno('index-%s:%s' % (objtype, objname)) + + targetid = 'index-%s-%s:%s' % (targetnum, objtype, objname) + targetnode = nodes.target('', '', ids=[targetid]) + self.document.note_explicit_target(targetnode) + + indexnode = addnodes.index() + indexnode['entries'] = [make_index_entry(objname, targetid, '')] + ref.replace_self([indexnode, targetnode, ref]) + +class CMakeDomain(Domain): + """CMake domain.""" + name = 'cmake' + label = 'CMake' + object_types = { + 'command': ObjType('command', 'command'), + 'generator': ObjType('generator', 'generator'), + 'variable': ObjType('variable', 'variable'), + 'module': ObjType('module', 'module'), + 'policy': ObjType('policy', 'policy'), + 'prop_cache': ObjType('prop_cache', 'prop_cache'), + 'prop_dir': ObjType('prop_dir', 'prop_dir'), + 'prop_gbl': ObjType('prop_gbl', 'prop_gbl'), + 'prop_inst': ObjType('prop_inst', 'prop_inst'), + 'prop_sf': ObjType('prop_sf', 'prop_sf'), + 'prop_test': ObjType('prop_test', 'prop_test'), + 'prop_tgt': ObjType('prop_tgt', 'prop_tgt'), + 'manual': ObjType('manual', 'manual'), + } + directives = { + 'command': CMakeObject, + 'variable': CMakeObject, + # Other object types cannot be created except by the CMakeTransform + # 'generator': CMakeObject, + # 'module': CMakeObject, + # 'policy': CMakeObject, + # 'prop_cache': CMakeObject, + # 'prop_dir': CMakeObject, + # 'prop_gbl': CMakeObject, + # 'prop_inst': CMakeObject, + # 'prop_sf': CMakeObject, + # 'prop_test': CMakeObject, + # 'prop_tgt': CMakeObject, + # 'manual': CMakeObject, + } + roles = { + 'command': CMakeXRefRole(fix_parens = True, lowercase = True), + 'generator': CMakeXRefRole(), + 'variable': CMakeXRefRole(), + 'module': CMakeXRefRole(), + 'policy': CMakeXRefRole(), + 'prop_cache': CMakeXRefRole(), + 'prop_dir': CMakeXRefRole(), + 'prop_gbl': CMakeXRefRole(), + 'prop_inst': CMakeXRefRole(), + 'prop_sf': CMakeXRefRole(), + 'prop_test': CMakeXRefRole(), + 'prop_tgt': CMakeXRefRole(), + 'manual': CMakeXRefRole(), + } + initial_data = { + 'objects': {}, # fullname -> docname, objtype + } + + def clear_doc(self, docname): + to_clear = set() + for fullname, (fn, _) in self.data['objects'].items(): + if fn == docname: + to_clear.add(fullname) + for fullname in to_clear: + del self.data['objects'][fullname] + + def resolve_xref(self, env, fromdocname, builder, + typ, target, node, contnode): + targetid = '%s:%s' % (typ, target) + obj = self.data['objects'].get(targetid) + if obj is None: + # TODO: warn somehow? + return None + return make_refnode(builder, fromdocname, obj[0], targetid, + contnode, target) + + def get_objects(self): + for refname, (docname, type) in self.data['objects'].items(): + yield (refname, refname, type, docname, refname, 1) + +def setup(app): + app.add_directive('cmake-module', CMakeModule) + app.add_transform(CMakeTransform) + app.add_transform(CMakeXRefTransform) + app.add_domain(CMakeDomain) diff --git a/Installation/cmake/modules/Help/conf.py b/Installation/cmake/modules/Help/conf.py new file mode 100644 index 00000000000..8f40868be48 --- /dev/null +++ b/Installation/cmake/modules/Help/conf.py @@ -0,0 +1,340 @@ +# -*- coding: utf-8 -*- +# +# CGAL CMake Modules documentation build configuration file, created by +# sphinx-quickstart on Fri Sep 23 22:51:32 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +primary_domain = 'cmake' + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['cmake'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +# +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'CGAL CMake Modules' +copyright = u'2016, The CGAL Project' +author = u'The CGAL Project' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'4.10' +# The full version, including alpha/beta/rc tags. +release = u'4.10' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# +# today = '' +# +# Else, today_fmt is used as the format for a strftime call. +# +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. +# " v documentation" by default. +# +# html_title = u'CGAL CMake Modules v4.10' + +# A shorter title for the navigation bar. Default is the same as html_title. +# +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# +# html_logo = None + +# The name of an image file (relative to this directory) to use as a favicon of +# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# +# html_extra_path = [] + +# If not None, a 'Last updated on:' timestamp is inserted at every page +# bottom, using the given strftime format. +# The empty string is equivalent to '%b %d, %Y'. +# +# html_last_updated_fmt = None + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# +# html_additional_pages = {} + +# If false, no module index is generated. +# +# html_domain_indices = True + +# If false, no index is generated. +# +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' +# +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# 'ja' uses this config value. +# 'zh' user can custom change `jieba` dictionary path. +# +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'CGALModulesdoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'CGALModules.tex', u'CGAL CMake Modules Documentation', + u'Laurent Rineau', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# +# latex_use_parts = False + +# If true, show page references after internal links. +# +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# +# latex_appendices = [] + +# It false, will not define \strong, \code, itleref, \crossref ... but only +# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added +# packages. +# +# latex_keep_old_macro_names = True + +# If false, no module index is generated. +# +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'cgalmodules', u'CGAL CMake Modules Documentation', + [author], 1) +] + +# If true, show URL addresses after external links. +# +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'CGALModules', u'CGAL CMake Modules Documentation', + author, 'CGALModules', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +# +# texinfo_appendices = [] + +# If false, no module index is generated. +# +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# +# texinfo_no_detailmenu = False diff --git a/Installation/cmake/modules/Help/index.rst b/Installation/cmake/modules/Help/index.rst new file mode 100644 index 00000000000..7178feb71ac --- /dev/null +++ b/Installation/cmake/modules/Help/index.rst @@ -0,0 +1,34 @@ +.. CGAL CMake Modules documentation master file, created by + sphinx-quickstart on Fri Sep 23 22:51:32 2016. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to CGAL CMake Modules's documentation! +============================================== + +Contents: + +.. toctree:: + :maxdepth: 1 + + CGAL_SetupGMP + CGAL_SetupLEDA + CGAL_SetupBoost + CGAL_SetupCGALDependencies + CGAL_SetupCGAL_CoreDependencies + CGAL_SetupCGAL_Qt5Dependencies + CGAL_SetupCGAL_ImageIODependencies + +TODO +^^^^ +- ``CGAL_SetupDependencies.cmake`` +- ``CGAL_SetupFlags.cmake`` +- ``CGAL_SetupVLD.cmake`` + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/Installation/cmake/modules/Makefile b/Installation/cmake/modules/Makefile new file mode 100644 index 00000000000..a45ff590e87 --- /dev/null +++ b/Installation/cmake/modules/Makefile @@ -0,0 +1,225 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) Help +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) Help + +.PHONY: help +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " epub3 to make an epub3" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" + @echo " dummy to check syntax errors of document sources" + +.PHONY: clean +clean: + rm -rf $(BUILDDIR)/* + +.PHONY: html +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: dirhtml +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +.PHONY: singlehtml +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +.PHONY: pickle +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +.PHONY: json +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +.PHONY: htmlhelp +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +.PHONY: qthelp +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/CGALModules.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/CGALModules.qhc" + +.PHONY: applehelp +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +.PHONY: devhelp +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/CGALModules" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/CGALModules" + @echo "# devhelp" + +.PHONY: epub +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +.PHONY: epub3 +epub3: + $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3 + @echo + @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3." + +.PHONY: latex +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +.PHONY: latexpdf +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: latexpdfja +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: text +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +.PHONY: man +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +.PHONY: texinfo +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +.PHONY: info +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +.PHONY: gettext +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +.PHONY: changes +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +.PHONY: linkcheck +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +.PHONY: doctest +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +.PHONY: coverage +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +.PHONY: xml +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +.PHONY: pseudoxml +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + +.PHONY: dummy +dummy: + $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy + @echo + @echo "Build finished. Dummy builder generates no files." diff --git a/Installation/cmake/modules/UseCGAL.cmake b/Installation/cmake/modules/UseCGAL.cmake index 075b6c17093..9a70bf7ec18 100644 --- a/Installation/cmake/modules/UseCGAL.cmake +++ b/Installation/cmake/modules/UseCGAL.cmake @@ -17,16 +17,21 @@ set(CGAL_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) if(NOT USE_CGAL_FILE_INCLUDED) set(USE_CGAL_FILE_INCLUDED 1) - include(CGAL_Common) - include(CGAL_SetupFlags) - include(CGAL_GeneratorSpecificSettings) - include(CGAL_TweakFindBoost) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Common.cmake) + if( RUNNING_CGAL_AUTO_TEST ) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupFlags.cmake) + else() + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_display_flags.cmake) + endif() + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake) set(CGAL_INSTALLED_SCM_BRANCH_NAME ${CGAL_SCM_BRANCH_NAME}) set(CGAL_SCM_BRANCH_NAME "") if( NOT "${CGAL_INSTALLED_SCM_BRANCH_NAME}" STREQUAL "" ) - include(CGAL_SCM) + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SCM.cmake) + CGAL_detect_git(${CMAKE_SOURCE_DIR}) if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "" ) message ( STATUS "Code taken from Git branch: ${CGAL_SCM_BRANCH_NAME}" ) if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "${CGAL_INSTALLED_SCM_BRANCH_NAME}") @@ -45,7 +50,9 @@ if(NOT USE_CGAL_FILE_INCLUDED) include_directories( "${CMAKE_CURRENT_BINARY_DIR}" ) - if(TARGET CGAL) + if(TARGET CGAL::CGAL) + add_to_list( CGAL_LIBRARIES CGAL::CGAL ) + elseif(TARGET CGAL) add_to_list( CGAL_LIBRARIES CGAL ) else() add_to_list( CGAL_LIBRARIES ${CGAL_LIBRARY} ) @@ -62,7 +69,7 @@ if(NOT USE_CGAL_FILE_INCLUDED) add_definitions(-DCGAL_HEADER_ONLY) if(NOT CGAL_NO_BLANKET_LINKING) link_directories ( ${CGAL_3RD_PARTY_LIBRARIES_DIRS} ) - link_libraries ( ${CGAL_3RD_PARTY_LIBRARIES} ) + link_libraries ( ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) endif() else() if(NOT CGAL_NO_BLANKET_LINKING) diff --git a/Installation/cmake/modules/UseTBB.cmake b/Installation/cmake/modules/UseTBB.cmake index 25122e25825..5a22f6f079a 100644 --- a/Installation/cmake/modules/UseTBB.cmake +++ b/Installation/cmake/modules/UseTBB.cmake @@ -4,3 +4,5 @@ include_directories ( ${TBB_INCLUDE_DIRS} ) link_directories( ${TBB_LIBRARY_DIRS} ) add_definitions( -DNOMINMAX -DCGAL_LINKED_WITH_TBB ) + +message(DEPRECATION "This file UseTBB.cmake is deprecated, and the function `CGAL_target_use_TBB` from CGAL_target_use_TBB.cmake should be used instead.") diff --git a/Installation/cmake/modules/run_test_with_cin.cmake b/Installation/cmake/modules/run_test_with_cin.cmake index c5218fc8141..1877beb096d 100644 --- a/Installation/cmake/modules/run_test_with_cin.cmake +++ b/Installation/cmake/modules/run_test_with_cin.cmake @@ -8,10 +8,17 @@ if(NOT CIN OR NOT EXISTS ${CIN}) "The variable `CIN` should be defined to the input file for the test!") endif() -execute_process( - COMMAND ${CMD} - INPUT_FILE ${CIN} - RESULT_VARIABLE error_result) +if(ANDROID) + execute_process( + COMMAND adb shell "cd ${ANDROID_DIR_PREFIX}${PROJECT_NAME} && ${ANDROID_DIR_PREFIX}${CMD}" + INPUT_FILE ${CIN} + RESULT_VARIABLE error_result) +else() + execute_process( + COMMAND ${CMD} + INPUT_FILE ${CIN} + RESULT_VARIABLE error_result) +endif() if(error_result) message(SEND_ERROR diff --git a/Installation/config/testfiles/CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp b/Installation/config/testfiles/CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp deleted file mode 100644 index 5d59ee84aef..00000000000 --- a/Installation/config/testfiles/CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2005 Foundation for Research and Technology-Hellas (Greece). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Menelaos Karavelas - -//| The flag CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG is set -//| if the compiler cannot recognize the declaration of a nested -//| class as friend. -//| Compilers such as the Intel compiler 8.x (for linux or windows), -//| MSVC 7.1 or pgCC have this "bug". It should be noted that the C++ -//| standard is a bit vague on this issue, in other words what is referred -//| to as "bug" above, may not really be a bug. Hopefully, the next standard -//| will resolve this issue. - -#include - -template -struct A -{ - void do_something() const { - std::cerr << "A's do_something" << std::endl; - T().do_something(); - } -}; - -template -struct B -{ - typedef A Nested; - - void do_something() const { - std::cerr << "B's do_something" << std::endl; - T().do_something(); - } -}; - - -template -class C -{ - friend struct B< C >; - friend struct B< C >::Nested; - // the following declaration (instead of the one above) is what - // pgCC, Intel 8.x and MSVC 7.1 would accept: - // friend class A< C >; - - protected: - void do_something() const { - std::cerr << "C's do_something" << std::endl; - } -}; - - -int main() -{ - A< C > a; - B< C > b; - - a.do_something(); - b.do_something(); - - return 0; -} diff --git a/Installation/include/CGAL/MSVC_compiler_config.h b/Installation/include/CGAL/MSVC_compiler_config.h new file mode 100644 index 00000000000..81f34913a8c --- /dev/null +++ b/Installation/include/CGAL/MSVC_compiler_config.h @@ -0,0 +1,36 @@ +// Copyright (c) 2016 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_MSVC_COMPILER_CONFIG_H +#define CGAL_MSVC_COMPILER_CONFIG_H + +// For all known version of MSVC. Actually we do not really have a +// test for that bug. +#define CGAL_CFG_MATCHING_BUG_6 1 + +// Fixed since MSVC 2015 +#define CGAL_CFG_MATCHING_BUG_7 1 + +// for all known version of MSVC +#define CGAL_CFG_MATCHING_BUG_8 1 + +// Should be only for MSVC 2012 and 2013 in Release +#define CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG 1 + +#endif // CGAL_MSVC_COMPILER_CONFIG_H diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 69f851441aa..f476f4d0d56 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -140,7 +140,18 @@ // platform specific workaround flags (CGAL_CFG_...) //----------------------------------------------------------------------// -#include +#if CGAL_HEADER_ONLY +# include +# if(BOOST_MSVC) +# include +# endif +#else +# include +#endif + +#if BOOST_MSVC && CGAL_TEST_SUITE +# include +#endif //----------------------------------------------------------------------// // Support for DLL on Windows (CGAL_EXPORT macro) diff --git a/Installation/include/CGAL/internal/enable_third_party_libraries.h b/Installation/include/CGAL/internal/enable_third_party_libraries.h new file mode 100644 index 00000000000..a33c9b9827d --- /dev/null +++ b/Installation/include/CGAL/internal/enable_third_party_libraries.h @@ -0,0 +1,52 @@ +// Copyright (c) 2016 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_INTERNAL_ENABLE_THIRD_PARTY_LIBRARIES_H +#define CGAL_INTERNAL_ENABLE_THIRD_PARTY_LIBRARIES_H + +// GMP and MPFR are highly recommended in CGAL. +#define CGAL_USE_GMP 1 +#define CGAL_USE_MPFR 1 + +#if CGAL_DISABLE_GMP && ! defined(CGAL_NO_GMP) +# define CGAL_NO_GMP 1 +#endif + +#if CGAL_NO_GMP || CGAL_NO_MPFR +# undef CGAL_USE_MPFR +# undef CGAL_USE_GMP +#endif + +#if defined(__has_include) +# if CGAL_USE_GMP && ! __has_include() +# warning " cannot be found. Less efficient number types will be used instead. Define CGAL_NO_GMP=1 if that is on purpose." +# undef CGAL_USE_GMP +# undef CGAL_USE_MPFR +# elif CGAL_USE_MPFR && ! __has_include() +# warning " cannot be found and the GMP support in CGAL requires it. Less efficient number types will be used instead. Define CGAL_NO_GMP=1 if that is on purpose." +# undef CGAL_USE_GMP +# undef CGAL_USE_MPFR +# endif // CGAL_USE_MPFR and no +#endif // __has_include + +#if CGAL_USE_GMP && CGAL_USE_MPFR && ! CGAL_NO_CORE +# define CGAL_USE_CORE 1 +#endif + +#endif // CGAL_INTERNAL_ENABLE_THIRD_PARTY_LIBRARIES_H diff --git a/Installation/include/CGAL/version.h b/Installation/include/CGAL/version.h new file mode 100644 index 00000000000..4fca07236a3 --- /dev/null +++ b/Installation/include/CGAL/version.h @@ -0,0 +1,30 @@ +// Copyright (c) 2009 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Author(s) : - + +#ifndef CGAL_VERSION_H +#define CGAL_VERSION_H + +#define CGAL_VERSION 4.12-dev +#define CGAL_VERSION_NR 1041200000 +#define CGAL_SVN_REVISION 99999 + +#include + +#endif diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake new file mode 100644 index 00000000000..ad259f4c753 --- /dev/null +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -0,0 +1,120 @@ +# +# This file is the CGALConfig.cmake for a header-only CGAL installation +# + +if(CGALConfig_included) + return() +endif() + +message(STATUS "Using header-only CGAL") + +set(CGALConfig_included TRUE) + +get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + +set(CGAL_HEADER_ONLY TRUE) + +set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} ) + +# Save the current source directory. That variable can be changed by +# a `CMakeLists.txt`, for `CMakeLists.txt` files that are created in +# the binary directory. +set(CGAL_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +function(_detect_branch_build VAR_NAME) + if(IS_DIRECTORY ${CGAL_CONFIG_DIR}/../../../../Installation) + set(${VAR_NAME} TRUE PARENT_SCOPE) + else() + set(${VAR_NAME} FALSE PARENT_SCOPE) + endif() +endfunction() + +_detect_branch_build(BRANCH_BUILD) +if(BRANCH_BUILD) + set(CGAL_ROOT ${CGAL_CONFIG_DIR}/../../../..) + set(CGAL_INSTALLATION_PACKAGE_DIR ${CGAL_ROOT}/Installation) + set(CGAL_GRAPHICSVIEW_PACKAGE_DIR ${CGAL_ROOT}/GraphicsView) + file(GLOB packages_dirs ${CGAL_ROOT}/*) +# message("packages_dirs: ${packages_dirs}") + foreach(package_dir ${packages_dirs}) + set(inc_dir ${package_dir}/include) + if(IS_DIRECTORY ${inc_dir} + AND IS_DIRECTORY ${package_dir}/package_info) + list(APPEND CGAL_INCLUDE_DIRS ${inc_dir}) + if(EXISTS ${inc_dir}/CGAL/config.h) + set(CGAL_FOUND TRUE) + endif() + endif() + endforeach() +else() + set(CGAL_ROOT ${CGAL_CONFIG_DIR}/../../..) + set(CGAL_INSTALLATION_PACKAGE_DIR ${CGAL_ROOT}) + set(CGAL_GRAPHICSVIEW_PACKAGE_DIR ${CGAL_ROOT}) + set(CGAL_INCLUDE_DIRS ${CGAL_ROOT}/include) + if(EXISTS ${CGAL_ROOT}/include/CGAL/config.h) + set(CGAL_FOUND TRUE) + endif() +endif() + +if(NOT CGAL_FOUND) + return() +endif() + +set(CGAL_MODULES_DIR ${CGAL_CONFIG_DIR}/../../../cmake/modules) +list(APPEND CMAKE_MODULE_PATH ${CGAL_MODULES_DIR}) + +include( ${CGAL_MODULES_DIR}/CGAL_SCM.cmake ) +CGAL_detect_git(${CGAL_CONFIG_DIR}/../../../..) + +set(CGAL_LIBRARIES CGAL) +foreach(comp ${CGAL_FIND_COMPONENTS}) + if(NOT comp MATCHES "Core|ImageIO|Qt5") + message(FATAL_ERROR "The requested CGAL component ${comp} does not exist!") + endif() + list(APPEND CGAL_LIBRARIES CGAL_${comp}) +endforeach() + +# +# Search for all dependencies +# +foreach(cgal_lib ${CGAL_LIBRARIES}) + include(CGAL_Setup${cgal_lib}Dependencies) +endforeach() + +# +# Define the CGAL targets and theirs CGAL:: aliases +# +foreach(cgal_lib ${CGAL_LIBRARIES}) + set(WITH_${cgal_lib} TRUE) + if(${cgal_lib}_FOUND AND NOT TARGET ${cgal_lib}) + add_library(${cgal_lib} INTERFACE) + if(NOT TARGET CGAL::${cgal_lib}) + add_library(CGAL::${cgal_lib} ALIAS ${cgal_lib}) + endif() + endif() +endforeach() + +# this include has to be after the loop that includes the +# `CGAL_Setup${cgal_lib}Dependencies` files +include(CGAL_setup_target_dependencies) + +foreach(cgal_lib ${CGAL_LIBRARIES}) + if(${cgal_lib}_FOUND) + CGAL_setup_target_dependencies(${cgal_lib} INTERFACE) + endif() +endforeach() + +target_compile_definitions(CGAL INTERFACE CGAL_HEADER_ONLY=1) + + +# +# +# + +include(${CGAL_MODULES_DIR}/CGAL_CreateSingleSourceCGALProgram.cmake) +include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) + +# Temporary? Change the CMAKE module path +cgal_setup_module_path() + +set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake) diff --git a/Installation/src/CGAL/CMakeLists.txt b/Installation/src/CGAL/CMakeLists.txt index c3c36110247..cf661e93fa7 100644 --- a/Installation/src/CGAL/CMakeLists.txt +++ b/Installation/src/CGAL/CMakeLists.txt @@ -1,19 +1,24 @@ message("Configuring libCGAL") -use_essential_libs() - -include_directories (SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS}) - -add_definitions(${CGAL_3RD_PARTY_DEFINITIONS}) - -link_directories(${CGAL_3RD_PARTY_LIBRARIES_DIRS}) - collect_cgal_library(CGAL "") +include(CGAL_SetupCGALDependencies) + if(CGAL_HEADER_ONLY) - target_link_libraries(CGAL INTERFACE ${CGAL_3RD_PARTY_LIBRARIES}) -else() - target_link_libraries(CGAL ${CGAL_3RD_PARTY_LIBRARIES}) + set(keyword "INTERFACE") endif() +CGAL_setup_CGAL_dependencies(CGAL ${keyword}) + +if(CGAL_HEADER_ONLY) + target_compile_definitions(CGAL INTERFACE CGAL_HEADER_ONLY=1) +endif() + +if(NOT CGAL_DISABLE_GMP) + get_dependency_version(GMP) + get_dependency_version(MPFR) +endif() + +message( STATUS "USING BOOST_VERSION = '${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}'" ) + message("libCGAL is configured") diff --git a/Installation/src/CMakeLists.txt b/Installation/src/CMakeLists.txt index da2b92f5bad..f9a8b35c9c3 100644 --- a/Installation/src/CMakeLists.txt +++ b/Installation/src/CMakeLists.txt @@ -64,6 +64,11 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES) add_library(${LIBRARY_NAME} INTERFACE) endif() + # Add an alias with the prefix `CGAL::`, so that consumer + # CMakeLists.txt can be the target like if it was an imported + # target. + add_library(CGAL::${LIBRARY_NAME} ALIAS ${LIBRARY_NAME}) + if(CGAL_AUTO_LINK_ENABLED) if (NOT CGAL_HEADER_ONLY) set_target_properties( ${LIBRARY_NAME} PROPERTIES @@ -81,7 +86,7 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES) endif() endif() - # if (NOT CGAL_HEADER_ONLY) + if (NOT CGAL_HEADER_ONLY) install(TARGETS ${LIBRARY_NAME} EXPORT ${LIBRARY_NAME}Exports RUNTIME DESTINATION "${CGAL_INSTALL_BIN_DIR}" LIBRARY DESTINATION "${CGAL_INSTALL_LIB_DIR}" @@ -89,15 +94,14 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES) install(EXPORT ${LIBRARY_NAME}Exports DESTINATION "${CGAL_INSTALL_CMAKE_DIR}" NAMESPACE CGAL::) - # endif() - - # We have to call configure_file twice to force double expansion of variables. - configure_file("${CGAL_MODULES_DIR}/CGALLibConfig.cmake.in" - "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY) - configure_file("${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" - "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY) - install(FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR}) + # We have to call configure_file twice to force double expansion of variables. + configure_file("${CGAL_MODULES_DIR}/CGALLibConfig.cmake.in" + "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY) + configure_file("${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" + "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY) + install(FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR}) + endif() endfunction() function( configure_component DIR COMPONENT ) @@ -209,9 +213,9 @@ CGAL_add_if_target(CGAL_Core) CGAL_add_if_target(CGAL_ImageIO) CGAL_add_if_target(CGAL_Qt5) -# if (NOT CGAL_HEADER_ONLY) +if (NOT CGAL_HEADER_ONLY) export(TARGETS ${CGAL_ACTUAL_CONFIGURED_LIBRARIES} NAMESPACE CGAL:: FILE "${CMAKE_BINARY_DIR}/CGALExports.cmake") -# endif() +endif() message(STATUS "Sources for CGAL component libraries '${CGAL_CONFIGURED_LIBRARIES}' detected") diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index ca9a06d013b..ce85c54f412 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -46,11 +46,10 @@ if ( CGAL_FOUND ) endif() find_package( TBB QUIET ) - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() create_single_source_cgal_program( "test_TBB.cpp" ) + if(TBB_FOUND) + CGAL_target_use_TBB(test_TBB) + endif() create_link_to_program(CGAL) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt index 14f0e227b66..40b748a36ca 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt @@ -40,13 +40,12 @@ include(${CGAL_USE_FILE}) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) -find_package(OpenGL) find_package(QGLViewer) if ( NOT (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND - OPENGL_FOUND AND QGLVIEWER_FOUND) ) + QGLVIEWER_FOUND) ) - MESSAGE(STATUS "NOTICE: This demo requires CGAL, QGLViewer, OpenGL " + MESSAGE(STATUS "NOTICE: This demo requires CGAL, QGLViewer, " "and Qt5, and will not be compiled.") else() @@ -71,14 +70,12 @@ add_executable(Linear_cell_complex_3_demo typedefs.h import_moka.h ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) -qt5_use_modules(Linear_cell_complex_3_demo Xml Script OpenGL Svg) add_to_cached_list(CGAL_EXECUTABLE_TARGETS Linear_cell_complex_3_demo) -target_link_libraries(Linear_cell_complex_3_demo ${CGAL_LIBRARIES} - ${CGAL_3RD_PARTY_LIBRARIES}) -target_link_libraries(Linear_cell_complex_3_demo ${QT_LIBRARIES} - ${QGLVIEWER_LIBRARIES} ) -target_link_libraries(Linear_cell_complex_3_demo ${OPENGL_gl_LIBRARY} - ${OPENGL_glu_LIBRARY} ) +target_link_libraries(Linear_cell_complex_3_demo PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui Qt5::OpenGL + ${QGLVIEWER_LIBRARIES} ) +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Linear_cell_complex_3_demo) endif() diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index 2aa6a7ef98e..6eb833ab8d7 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -710,14 +710,14 @@ void Viewer::draw() color.setRgbF(0.2f, 0.2f, 0.7f); rendering_program_p_l.bind(); rendering_program_p_l.setAttributeValue(colorLocation,color); - ::glLineWidth(size_edges); + glLineWidth(size_edges); glDrawArrays(GL_LINES, 0, static_cast(pos_lines.size()/3)); rendering_program_p_l.release(); vao[2].release(); } if(vertices) { - ::glPointSize(size_points); + glPointSize(size_points); vao[3].bind(); attrib_buffers(this); color.setRgbF(.2f,.2f,.6f); @@ -751,23 +751,23 @@ void Viewer::init() setKeyDescription(Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)"); // Light default parameters - ::glLineWidth(size_edges); - ::glPointSize(size_points); - ::glEnable(GL_POLYGON_OFFSET_FILL); - ::glPolygonOffset(1.0f,1.0f); - ::glClearColor(1.0f,1.0f,1.0f,0.0f); - ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + glLineWidth(size_edges); + glPointSize(size_points); + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(1.0f,1.0f); + glClearColor(1.0f,1.0f,1.0f,0.0f); + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); - ::glEnable(GL_LIGHTING); + glEnable(GL_LIGHTING); - ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - ::glShadeModel(GL_FLAT); - ::glDisable(GL_BLEND); - ::glDisable(GL_LINE_SMOOTH); - ::glDisable(GL_POLYGON_SMOOTH_HINT); - ::glBlendFunc(GL_ONE, GL_ZERO); - ::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); + glShadeModel(GL_FLAT); + glDisable(GL_BLEND); + glDisable(GL_LINE_SMOOTH); + glDisable(GL_POLYGON_SMOOTH_HINT); + glBlendFunc(GL_ONE, GL_ZERO); + glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); compile_shaders(); } diff --git a/Mesh_2/demo/Mesh_2/CMakeLists.txt b/Mesh_2/demo/Mesh_2/CMakeLists.txt index d4ad9cdcc12..71a049e416f 100644 --- a/Mesh_2/demo/Mesh_2/CMakeLists.txt +++ b/Mesh_2/demo/Mesh_2/CMakeLists.txt @@ -28,6 +28,10 @@ if ( CGAL_FOUND ) target_link_libraries(mesh ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(conform) + cgal_add_compilation_test(mesh) + else() message(STATUS "NOTICE: This demo requires CGAL and will not be compiled.") diff --git a/Mesh_2/examples/Mesh_2/CMakeLists.txt b/Mesh_2/examples/Mesh_2/CMakeLists.txt index 54c140c7f82..43eaf6b585d 100644 --- a/Mesh_2/examples/Mesh_2/CMakeLists.txt +++ b/Mesh_2/examples/Mesh_2/CMakeLists.txt @@ -1,21 +1,11 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - - project( Mesh_2_Examples ) -cmake_minimum_required(VERSION 2.8.10) +cmake_minimum_required(VERSION 2.8.12) find_package(CGAL QUIET) if ( CGAL_FOUND ) - include( ${CGAL_USE_FILE} ) - - include( CGAL_CreateSingleSourceCGALProgram ) - - include_directories (BEFORE "../../include") - # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) @@ -27,4 +17,3 @@ else() message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt index 77e16344a65..9222bff6fe1 100644 --- a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt +++ b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt @@ -68,11 +68,6 @@ if ( CGAL_FOUND ) find_package( TBB ) endif( LINK_WITH_TBB ) endif() - - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() # Link with Boost.ProgramOptions (optional) find_package(Boost QUIET COMPONENTS program_options) @@ -91,6 +86,9 @@ if ( CGAL_FOUND ) # Compilable benchmark set (BENCHMARK_SOURCE_FILES "concurrency.cpp") + if(TBB_FOUND) + CGAL_target_use_TBB(concurrency) + endif() ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" BENCHMARK_SOURCE_FILES) create_single_source_cgal_program( ${BENCHMARK_SOURCE_FILES} ) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 4aa7648ef55..bd3429d445d 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -39,12 +39,6 @@ if ( CGAL_FOUND ) endif( LINK_WITH_TBB ) endif() - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - - set(VTK_LIBS "") find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) if(VTK_FOUND) @@ -107,6 +101,27 @@ if ( CGAL_FOUND ) # create_single_source_cgal_program( "mesh_polyhedral_surface_tolerance_region.cpp" ) # create_single_source_cgal_program( "mesh_polyhedral_edge_tolerance_region.cpp" ) + foreach(target + mesh_3D_image_with_features + mesh_3D_image + mesh_polyhedral_domain + mesh_3D_image_with_custom_initialization + mesh_two_implicit_spheres_with_balls + mesh_optimization_lloyd_example + mesh_optimization_example + mesh_implicit_sphere + mesh_polyhedral_complex_sm + mesh_implicit_sphere_variable_size + mesh_polyhedral_domain_sm + mesh_polyhedral_domain_with_lipschitz_sizing + mesh_polyhedral_complex + mesh_polyhedral_domain_with_features + mesh_3D_image_variable_size) + if(TBB_FOUND AND TARGET ${target}) + CGAL_target_use_TBB(${target}) + endif() + endforeach() + else() message(STATUS "NOTICE: This program requires Boost >= 1.34.1, and will not be compiled.") endif() diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index ab7b3690533..9eb5f4fb69a 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -14,11 +14,6 @@ if ( CGAL_FOUND ) find_package( TBB QUIET ) - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - include( CGAL_CreateSingleSourceCGALProgram ) include_directories (BEFORE ../../include) @@ -57,6 +52,23 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" ) create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" ) + foreach(target + test_meshing_polyhedron_with_features + test_meshing_utilities.h + test_mesh_implicit_domains + test_meshing_implicit_function + test_meshing_3D_image + test_meshing_3D_gray_image + test_meshing_unit_tetrahedron + test_backward_compatibility + test_meshing_polyhedron + test_meshing_polyhedral_complex + ) + if(TBB_FOUND AND TARGET ${target}) + CGAL_target_use_TBB(${target}) + endif() + endforeach() + else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt index a51ee9c07f8..0904749fa9e 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -21,9 +21,6 @@ if(Qt5_FOUND) add_definitions(-DQT_NO_KEYWORDS) endif(Qt5_FOUND) -# Find OpenGL -find_package(OpenGL) - # Find CImg find_path(CIMG_INCLUDE_DIR NAMES CImg.h @@ -31,19 +28,18 @@ find_path(CIMG_INCLUDE_DIR DOC "Path to the header of the CImg library") if (CIMG_INCLUDE_DIR) - add_definitions(-DCGAL_USE_CIMG) - include_directories(${CIMG_INCLUDE_DIR}) MESSAGE(STATUS "CImg library found, the demo can load point set from image files.") else() MESSAGE(STATUS "CImg library was not found, the demo will not be able to load point set from image files. " "Try setting the environment variable CIMG_INC_DIR to point to the path of the directory containing CImg.h.") endif() -if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND) +if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND) set( SRCS glviewer.cpp + scene.cpp Otr2_demo.cpp window.cpp render.cpp @@ -79,30 +75,26 @@ if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND) add_executable ( Otr2_demo ${SRCS} ${CGAL_Qt5_MOC_FILES} ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES}) - qt5_use_modules(Otr2_demo OpenGL) - - # Link with Qt libraries - target_link_libraries( Otr2_demo ${QT_LIBRARIES} ) - - # Link with CGAL - target_link_libraries( Otr2_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) - - # Link with OpenGL - target_link_libraries( Otr2_demo ${OPENGL_gl_LIBRARY} ) + target_link_libraries( Otr2_demo PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui Qt5::OpenGL ) # Link with pthread if necessary if (CIMG_INCLUDE_DIR) + target_compile_definitions( Otr2_demo PRIVATE -DCGAL_USE_CIMG ) + target_include_directories( Otr2_demo PRIVATE ${CIMG_INCLUDE_DIR} ) # Is pthread around? If yes, we need to link against it set(CMAKE_THREAD_PREFER_PTHREAD TRUE) find_package (Threads) if (CMAKE_USE_PTHREADS_INIT) - target_link_libraries( Otr2_demo ${CMAKE_THREAD_LIBS_INIT} ) + target_link_libraries( Otr2_demo PRIVATE ${CMAKE_THREAD_LIBS_INIT} ) endif() endif() add_to_cached_list( CGAL_EXECUTABLE_TARGETS Otr2_demo ) -else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Otr2_demo) +else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) set(OTR2_MISSING_DEPS "") @@ -118,10 +110,6 @@ else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) set(OTR2_MISSING_DEPS "Qt5.4, ${OTR2_MISSING_DEPS}") endif() - if(NOT OPENGL_FOUND) - set(OTR2_MISSING_DEPS "OpenGL, ${OTR2_MISSING_DEPS}") - endif() - message(STATUS "NOTICE: This demo requires ${OTR2_MISSING_DEPS}and will not be compiled.") -endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND) +endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND) diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h index 01b18024d36..bf6027014c1 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h @@ -14,6 +14,7 @@ //Qt #include +class GlViewer; typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_2 Point; typedef K::FT FT; @@ -39,7 +40,8 @@ public: Optimal_transportation_reconstruction_kerneled_2(const InputRange& input_range, Point_property_map point_pmap, Mass_property_map mass_pmap) : Otr_2(input_range, point_pmap, - mass_pmap) { + mass_pmap), + viewer(NULL){ } Optimal_transportation_reconstruction_kerneled_2() : @@ -149,5 +151,8 @@ public: void save_one_edge(std::ofstream& ofs, const Edge& edge); + void setViewer(GlViewer* vi) { viewer = vi; } +protected: + GlViewer* viewer; }; #endif diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp index b612978482b..683249ac0b4 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp @@ -46,6 +46,9 @@ void GlViewer::resizeGL(int width, int height) void GlViewer::initializeGL() { + QOpenGLWidget::initializeGL(); + initializeOpenGLFunctions(); + makeCurrent(); glClearColor(1., 1., 1., 0.); glDisable(GL_DEPTH_TEST); glEnable(GL_SMOOTH); @@ -73,7 +76,8 @@ void GlViewer::paintGL() m_view_edge_relevance, float(m_point_size), float(m_vertex_size), - float(m_line_thickness)); + float(m_line_thickness), + this); glPopMatrix(); } diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.h b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.h index 3a2e4d4c02a..2b2904f34fb 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.h +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.h @@ -3,12 +3,13 @@ // Qt #include +#include #include // local #include "scene.h" -class GlViewer : public QOpenGLWidget +class GlViewer : public QOpenGLWidget, public QOpenGLFunctions_2_1 { Q_OBJECT diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp index adeff853a27..ac0893ed1e9 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp @@ -5,8 +5,10 @@ // local #include "Otr2_kerneled.h" +#include "glviewer.h" #include + typedef Optimal_transportation_reconstruction_kerneled_2::Rec_edge_2 PEdge; typedef Optimal_transportation_reconstruction_kerneled_2 R_s_k_2; @@ -40,17 +42,17 @@ QColor R_s_k_2::get_color(float value) const void R_s_k_2::draw_point(const Point& point) { - ::glBegin(GL_POINTS); - ::glVertex2f(point.x(), point.y()); - ::glEnd(); + viewer->glBegin(GL_POINTS); + viewer->glVertex2f(point.x(), point.y()); + viewer->glEnd(); } void R_s_k_2::draw_segment(const Point& s, const Point& t) { - ::glBegin(GL_LINES); - ::glVertex2d(s.x(), s.y()); - ::glVertex2d(t.x(), t.y()); - ::glEnd(); + viewer->glBegin(GL_LINES); + viewer->glVertex2d(s.x(), s.y()); + viewer->glVertex2d(t.x(), t.y()); + viewer->glEnd(); } void R_s_k_2::draw_edge(const Edge& edge) @@ -64,13 +66,13 @@ void R_s_k_2::draw_edge(const Edge& edge) void R_s_k_2::draw_face(Face_handle face) { - ::glBegin(GL_TRIANGLES); + viewer->glBegin(GL_TRIANGLES); for (int i = 0; i < 3; ++i) { Point p = face->vertex(i)->point(); - ::glVertex2f(p.x(), p.y()); + viewer->glVertex2f(p.x(), p.y()); } - ::glEnd(); + viewer->glEnd(); } void R_s_k_2::draw_edge_with_arrow(const Point& s, const Point& t) @@ -85,11 +87,11 @@ void R_s_k_2::draw_edge_with_arrow(const Point& s, const Point& t) Point a = t - 0.4 * vec; Point b = a - 0.2 * vec - 0.1 * vec90; Point c = a - 0.2 * vec + 0.1 * vec90; - ::glBegin(GL_TRIANGLES); - ::glVertex2d(a.x(), a.y()); - ::glVertex2d(b.x(), b.y()); - ::glVertex2d(c.x(), c.y()); - ::glEnd(); + viewer->glBegin(GL_TRIANGLES); + viewer->glVertex2d(a.x(), a.y()); + viewer->glVertex2d(b.x(), b.y()); + viewer->glVertex2d(c.x(), c.y()); + viewer->glEnd(); } void R_s_k_2::draw_vertices(const float point_size, @@ -103,13 +105,13 @@ void R_s_k_2::draw_vertices(const float point_size, Vertex_handle vertex = vi; if (vertex->pinned()) { - ::glPointSize(point_size); - ::glColor3f(0.0f, 0.0f, 0.0f); + viewer->glPointSize(point_size); + viewer->glColor3f(0.0f, 0.0f, 0.0f); } else { - ::glPointSize(3*point_size); - ::glColor3f(red,green,blue); + viewer->glPointSize(3*point_size); + viewer->glColor3f(red,green,blue); } draw_point(vertex->point()); } @@ -120,16 +122,16 @@ void R_s_k_2::draw_edges(const float line_width, const float green, const float blue) { - ::glLineWidth(line_width); + viewer->glLineWidth(line_width); for (Finite_edges_iterator ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end(); ei++) { Edge edge = *ei; Edge twin = m_dt.twin_edge(edge); if (m_dt.is_pinned(edge) && m_dt.is_pinned(twin)) - ::glColor3f(0.9f,0.9f,0.75f); + viewer->glColor3f(0.9f,0.9f,0.75f); else - ::glColor3f(red,green,blue); + viewer->glColor3f(red,green,blue); draw_edge(edge); } } @@ -148,7 +150,7 @@ void R_s_k_2::draw_mesh_footpoints(const Triangulation& mesh, const float green, const float blue) { - ::glLineWidth(line_width); + viewer->glLineWidth(line_width); for (Finite_edges_iterator ei = mesh.finite_edges_begin(); ei != mesh.finite_edges_end(); ei++) { Edge edge = *ei; @@ -177,7 +179,7 @@ void R_s_k_2::draw_edge_footpoints(const Triangulation& mesh, Point q; if (mesh.get_plan(edge) == 0) { - ::glColor3f(0.8f + m, m, m); + viewer->glColor3f(0.8f + m, m, m); FT Da = CGAL::squared_distance(p, a); FT Db = CGAL::squared_distance(p, b); if (Da < Db) q = a; @@ -185,7 +187,7 @@ void R_s_k_2::draw_edge_footpoints(const Triangulation& mesh, } else { - ::glColor3f(red + m, green + m, blue + m); + viewer->glColor3f(red + m, green + m, blue + m); FT t = sample->coordinate(); q = CGAL::ORIGIN + (1.0 - t)*(a - CGAL::ORIGIN) + t*(b - CGAL::ORIGIN); } @@ -232,7 +234,7 @@ void R_s_k_2::draw_pedges(const float line_width) else { nb_discart++; - ::glColor3f(1.0, 0.0, 1.0); + viewer->glColor3f(1.0, 0.0, 1.0); draw_edge(edge); } edge = m_dt.twin_edge(edge); @@ -261,15 +263,15 @@ void R_s_k_2::draw_one_pedge(const Edge& edge, { if (value == min_value) { - ::glLineWidth(2*line_width); - ::glColor3f(0.0f, 0.0f, 0.0f); + viewer->glLineWidth(2*line_width); + viewer->glColor3f(0.0f, 0.0f, 0.0f); } else { - ::glLineWidth(line_width); + viewer->glLineWidth(line_width); FT color = (value - min_value) / (max_value - min_value); QColor qcolor = get_color(color); - ::glColor3f(qcolor.redF(), qcolor.greenF(), qcolor.blueF()); + viewer->glColor3f(qcolor.redF(), qcolor.greenF(), qcolor.blueF()); } Point s = m_dt.source_vertex(edge)->point(); @@ -292,7 +294,7 @@ void R_s_k_2::draw_costs(const float line_width, const bool view_ghost) } if (min_value == max_value) max_value += 1.0; - ::glLineWidth(line_width); + viewer->glLineWidth(line_width); for (Finite_edges_iterator ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end(); ++ei) { Edge edge = *ei; @@ -309,7 +311,7 @@ void R_s_k_2::draw_one_cost(const Edge& edge, if (mass == 0.0) { if (!view_ghost) return; - ::glColor3f(0.5f, 0.5f, 0.5f); + viewer->glColor3f(0.5f, 0.5f, 0.5f); draw_edge(edge); return; } @@ -317,14 +319,14 @@ void R_s_k_2::draw_one_cost(const Edge& edge, if (m_dt.is_ghost(edge)) { if (!view_ghost) return; - ::glColor3f(0.5f, 0.5f, 0.5f); + viewer->glColor3f(0.5f, 0.5f, 0.5f); draw_edge(edge); return; } FT value = m_dt.get_cost(edge).finalize(m_alpha); FT color = (value - min_value) / (max_value - min_value); - ::glColor3d(0.0, 1.0-color, color); // [green, blue] + viewer->glColor3d(0.0, 1.0-color, color); // [green, blue] draw_edge(edge); } @@ -347,10 +349,10 @@ void R_s_k_2::draw_relevance(const float line_width, const int nb) } if (min_value == max_value) max_value += 1.0; - ::glLineWidth(line_width); + viewer->glLineWidth(line_width); int nb_remove = (std::min)(nb, int(mindex.size())); - ::glColor3d(0.5, 0.1, 0.1); + viewer->glColor3d(0.5, 0.1, 0.1); for (int i = 0; i < nb_remove; ++i) { @@ -358,7 +360,7 @@ void R_s_k_2::draw_relevance(const float line_width, const int nb) (mindex.get<0>()).erase(pedge); } - ::glColor3d(0.0, 0.5, 0.0); + viewer->glColor3d(0.0, 0.5, 0.0); while (!mindex.empty()) { PEdge pedge = *(mindex.get<1>()).begin(); @@ -369,7 +371,7 @@ void R_s_k_2::draw_relevance(const float line_width, const int nb) void R_s_k_2::draw_bins(const float thickness) { - ::glLineWidth(thickness); + viewer->glLineWidth(thickness); for (Finite_edges_iterator ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end(); ++ei) { Edge edge = *ei; @@ -390,7 +392,7 @@ void R_s_k_2::draw_bins_plan0(const Edge& edge) m_dt.collect_samples_from_edge(edge, samples); m_dt.collect_samples_from_edge(twin, samples); - ::glColor3f(0.0f, 1.0f, 0.0f); + viewer->glColor3f(0.0f, 1.0f, 0.0f); Sample_vector_const_iterator it; for (it = samples.begin(); it != samples.end(); ++it) { @@ -412,7 +414,7 @@ void R_s_k_2::draw_bins_plan1(const Edge& edge) Vector va = m_dt.source_vertex(edge)->point() - CGAL::ORIGIN; Vector vb = m_dt.target_vertex(edge)->point() - CGAL::ORIGIN; - ::glColor3f(1.0f, 0.0f, 0.0f); + viewer->glColor3f(1.0f, 0.0f, 0.0f); SQueue queue; FT start = 0.0; m_dt.sort_samples_from_edge(edge, queue); @@ -459,19 +461,19 @@ void R_s_k_2::draw_relocation() grad = compute_gradient_for_plan1(edge); move = move + grad; - ::glLineWidth(2.0f); - ::glColor3f(1.0f, 1.0f, 0.0f); + viewer->glLineWidth(2.0f); + viewer->glColor3f(1.0f, 1.0f, 0.0f); draw_edge_with_arrow(pv, pv-grad); } - ::glLineWidth(1.0f); - ::glColor3f(1.0f, 0.0f, 0.0f); + viewer->glLineWidth(1.0f); + viewer->glColor3f(1.0f, 0.0f, 0.0f); draw_edge_with_arrow(pv, pv-move); } - ::glBegin(GL_LINES); - ::glLineWidth(3.0f); - ::glColor3f(0.1f, 1.0f, 1.0f); + viewer->glBegin(GL_LINES); + viewer->glLineWidth(3.0f); + viewer->glColor3f(0.1f, 1.0f, 1.0f); for (Finite_edges_iterator ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end(); ++ei) { Edge edge = *ei; @@ -480,10 +482,10 @@ void R_s_k_2::draw_relocation() const Point& pa = m_dt.source_vertex(edge)->relocated(); const Point& pb = m_dt.target_vertex(edge)->relocated(); - ::glVertex2d(pa.x(), pa.y()); - ::glVertex2d(pb.x(), pb.y()); + viewer->glVertex2d(pa.x(), pa.y()); + viewer->glVertex2d(pb.x(), pb.y()); } - ::glEnd(); + viewer->glEnd(); } bool R_s_k_2::locate_edge(const Point& query, Edge& edge) @@ -525,20 +527,20 @@ void R_s_k_2::draw_mesh_one_ring(const float point_size, draw_bg_faces(mesh, 1.0f, 0.7f, 0.7f, 0.5f); draw_vertex_faces(s, mesh, 0.7f, 0.7f, 1.0f, 1.0f); - ::glLineWidth(line_width); + viewer->glLineWidth(line_width); draw_bg_edges(mesh, 0.7f, 0.3f, 0.7f, 1.f, 0.f, 0.f); draw_vertex_edges(s, mesh, 0.f, 0.8f, 0.f, 0.f, 0.2f, 0.2f); - ::glLineWidth(2.0f*line_width); - ::glColor3f(0., 0., 1.); + viewer->glLineWidth(2.0f*line_width); + viewer->glColor3f(0., 0., 1.); draw_edge_with_arrow(s->point(), t->point()); - ::glPointSize(0.5*point_size); + viewer->glPointSize(0.5*point_size); draw_bg_vertices(mesh, 0.f, 0.f, 0.f); - ::glPointSize(point_size); - ::glColor3f(0., 1., 0.); + viewer->glPointSize(point_size); + viewer->glColor3f(0., 1., 0.); draw_point(s->point()); - ::glColor3f(1., 1., 0.); + viewer->glColor3f(1., 1., 0.); draw_point(t->point()); } @@ -563,8 +565,8 @@ void R_s_k_2::draw_mesh_blocking_edges(const float point_size, draw_mesh_one_ring(point_size, line_width, mesh, edge); - ::glColor3f(0.0f, 0.0f, 0.0f); - ::glLineWidth(2.0f*line_width); + viewer->glColor3f(0.0f, 0.0f, 0.0f); + viewer->glLineWidth(2.0f*line_width); Face_circulator fcirc = mesh.incident_faces(s); Face_circulator fend = fcirc; CGAL_For_all(fcirc, fend) @@ -622,17 +624,17 @@ void R_s_k_2::draw_cost_stencil(const float point_size, draw_bg_faces(copy, 0.7f, 0.7f, 1.0f, 1.0f); - ::glLineWidth(line_width); - ::glPointSize(point_size); + viewer->glLineWidth(line_width); + viewer->glPointSize(point_size); Edge_vector stencil; collect_cost_stencil(copy, copy_hull.begin(), copy_hull.end(), stencil); for (Edge_vector::const_iterator it = stencil.begin(); it != stencil.end(); ++it) { Edge e = *it; - ::glColor3f(0.7f, 0.4f, 0.0f); + viewer->glColor3f(0.7f, 0.4f, 0.0f); draw_edge(e); - ::glColor3f(0.0f, 0.0f, 0.0f); + viewer->glColor3f(0.0f, 0.0f, 0.0f); draw_point(copy.source_vertex(e)->point()); draw_point(copy.target_vertex(e)->point()); } @@ -655,16 +657,16 @@ void R_s_k_2::draw_remove_queue_stencil(const float point_size, draw_vertex_faces(src, m_dt, 0.7f, 0.7f, 1.0f, 1.0f); - ::glLineWidth(0.5*line_width); + viewer->glLineWidth(0.5*line_width); for (it = stencil.begin(); it != stencil.end(); ++it) { Edge ab = *it; - ::glColor3f(1.0f, 0.6f, 1.0f); + viewer->glColor3f(1.0f, 0.6f, 1.0f); draw_edge(ab); } - ::glLineWidth(line_width); - ::glPointSize(point_size); + viewer->glLineWidth(line_width); + viewer->glPointSize(point_size); for (it = stencil.begin(); it != stencil.end(); ++it) { Edge ab = *it; @@ -673,9 +675,9 @@ void R_s_k_2::draw_remove_queue_stencil(const float point_size, const Point& pa = va->point(); const Point& pb = vb->point(); Point pc = CGAL::midpoint(pa, pb); - ::glColor3f(0.8f, 0.2f, 0.8f); + viewer->glColor3f(0.8f, 0.2f, 0.8f); draw_edge_with_arrow(pc, pb); - ::glColor3f(0.0f, 0.0f, 0.0f); + viewer->glColor3f(0.0f, 0.0f, 0.0f); draw_point(pa); draw_point(pb); } @@ -728,16 +730,16 @@ void R_s_k_2::draw_push_queue_stencil(const float point_size, draw_bg_faces(copy, 0.7f, 0.7f, 1.0f, 1.0f); - ::glLineWidth(0.5*line_width); + viewer->glLineWidth(0.5*line_width); for (it = stencil.begin(); it != stencil.end(); ++it) { Edge ab = *it; - ::glColor3f(1.0f, 0.6f, 1.0f); + viewer->glColor3f(1.0f, 0.6f, 1.0f); draw_edge(ab); } - ::glLineWidth(line_width); - ::glPointSize(point_size); + viewer->glLineWidth(line_width); + viewer->glPointSize(point_size); for (it = stencil.begin(); it != stencil.end(); ++it) { Edge ab = *it; @@ -746,9 +748,9 @@ void R_s_k_2::draw_push_queue_stencil(const float point_size, const Point& pa = va->point(); const Point& pb = vb->point(); Point pc = CGAL::midpoint(pa, pb); - ::glColor3f(0.8f, 0.2f, 0.8f); + viewer->glColor3f(0.8f, 0.2f, 0.8f); draw_edge_with_arrow(pc, pb); - ::glColor3f(0.0f, 0.0f, 0.0f); + viewer->glColor3f(0.0f, 0.0f, 0.0f); draw_point(pa); draw_point(pb); } @@ -760,15 +762,15 @@ void R_s_k_2::draw_bg_faces(const Triangulation& mesh, const float blue, const float alpha) { - ::glEnable(GL_BLEND); - ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - ::glColor4f(red, green, blue, alpha); + viewer->glEnable(GL_BLEND); + viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + viewer->glColor4f(red, green, blue, alpha); for (Finite_faces_iterator fi = mesh.finite_faces_begin(); fi != mesh.finite_faces_end(); ++fi) { Face_handle f = fi; draw_face(f); } - ::glDisable(GL_BLEND); + viewer->glDisable(GL_BLEND); } void R_s_k_2::draw_bg_edges(const Triangulation& mesh, @@ -787,9 +789,9 @@ void R_s_k_2::draw_bg_edges(const Triangulation& mesh, Edge e(f, i); e = mesh.twin_edge(e); if (mesh.is_infinite(e.first)) - ::glColor3f(ro, go, bo); + viewer->glColor3f(ro, go, bo); else - ::glColor3f(ri, gi, bi); + viewer->glColor3f(ri, gi, bi); draw_edge(e); } } @@ -800,7 +802,7 @@ void R_s_k_2::draw_bg_vertices(const Triangulation& mesh, const float green, const float blue) { - ::glColor3f(red, green, blue); + viewer->glColor3f(red, green, blue); for (Finite_vertices_iterator vi = mesh.finite_vertices_begin(); vi != mesh.finite_vertices_end(); ++vi) { Vertex_handle v = vi; @@ -815,9 +817,9 @@ void R_s_k_2::draw_vertex_faces(Vertex_handle vertex, const float blue, const float alpha) { - ::glEnable(GL_BLEND); - ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - ::glColor4f(red, green, blue, alpha); + viewer->glEnable(GL_BLEND); + viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + viewer->glColor4f(red, green, blue, alpha); Face_circulator fcirc = mesh.incident_faces(vertex); Face_circulator fend = fcirc; CGAL_For_all(fcirc, fend) @@ -826,7 +828,7 @@ void R_s_k_2::draw_vertex_faces(Vertex_handle vertex, if (mesh.is_infinite(f)) continue; draw_face(f); } - ::glDisable(GL_BLEND); + viewer->glDisable(GL_BLEND); } void R_s_k_2::draw_vertex_edges(Vertex_handle vertex, @@ -848,8 +850,8 @@ void R_s_k_2::draw_vertex_edges(Vertex_handle vertex, { Edge e(f, i); if (mesh.is_infinite(e)) continue; - if (static_cast(i) == index) ::glColor3f(ro, go, bo); - else ::glColor3f(ri, gi, bi); + if (static_cast(i) == index) viewer->glColor3f(ro, go, bo); + else viewer->glColor3f(ri, gi, bi); draw_edge(e); } } diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.cpp b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.cpp new file mode 100644 index 00000000000..f250950944c --- /dev/null +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.cpp @@ -0,0 +1,19 @@ +#include "scene.h" +#include "glviewer.h" +void Scene::draw_samples(const float point_size, GlViewer* viewer) { + + viewer->glPointSize(point_size); + viewer->glBegin(GL_POINTS); + + std::vector::const_iterator it; + for (it = m_samples.begin(); it != m_samples.end(); it++) { + double mass = it->mass(); + + float value = mass; + float grey = 0.9 * (1.0f - value); + viewer->glColor3f(grey, grey, grey); + const Point& p = it->point(); + viewer->glVertex2d(p.x(), p.y()); + } + viewer->glEnd(); +} diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h index dd826b0b44f..587f22ca60f 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h @@ -24,6 +24,8 @@ #include #include +class GlViewer; + class Scene { public: @@ -83,6 +85,7 @@ private: Optimal_transportation_reconstruction_kerneled_2* m_pwsrec; int m_ignore; bool m_init_done; + bool is_viewer_set; double m_percentage; // bbox @@ -90,6 +93,7 @@ private: double m_bbox_y; double m_bbox_size; + public: Scene() { srand(0); // for sake of repeatability @@ -99,6 +103,7 @@ public: m_bbox_x = 0.0; m_bbox_y = 0.0; m_bbox_size = 1.0; + is_viewer_set = false; m_pwsrec = new Optimal_transportation_reconstruction_kerneled_2(); } @@ -532,12 +537,16 @@ public: const bool view_bins, const bool view_foot_points, const bool view_relocation, const bool view_edge_relevance, const float point_size, const float vertex_size, - const float line_thickness) + const float line_thickness, GlViewer* viewer) { if (m_pwsrec == NULL) { return; } - + if(!is_viewer_set) + { + m_pwsrec->setViewer(viewer); + is_viewer_set = true; + } if (view_edges) m_pwsrec->draw_edges(0.5f * line_thickness, 0.9f, 0.9f, 0.9f); @@ -563,26 +572,10 @@ public: m_pwsrec->draw_footpoints(line_thickness, 0.2f, 0.8f, 0.2f); if (view_points) - draw_samples(point_size); + draw_samples(point_size, viewer); } - void draw_samples(const float point_size) { - - ::glPointSize(point_size); - ::glBegin(GL_POINTS); - - std::vector::const_iterator it; - for (it = m_samples.begin(); it != m_samples.end(); it++) { - double mass = it->mass(); - - float value = mass; - float grey = 0.9 * (1.0f - value); - ::glColor3f(grey, grey, grey); - const Point& p = it->point(); - ::glVertex2d(p.x(), p.y()); - } - ::glEnd(); - } + void draw_samples(const float point_size, GlViewer* viewer); // PREDEFINED EXAMPLES // diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt index e54d1b9098b..feb38419680 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt @@ -17,16 +17,13 @@ include( ${CGAL_USE_FILE} ) # Find Qt5 itself find_package(Qt5 QUIET COMPONENTS Xml OpenGL Help Core) -# Find OpenGL -find_package(OpenGL) - # Find QGLViewer if(Qt5_FOUND) add_definitions(-DQT_NO_KEYWORDS) find_package(QGLViewer) endif(Qt5_FOUND) -if (CGAL_FOUND AND CGAL_Qt5_FOUND AND OPENGL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator) +if (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator) include_directories( ${QGLVIEWER_INCLUDE_DIR} ) @@ -67,13 +64,13 @@ if (CGAL_FOUND AND CGAL_Qt5_FOUND AND OPENGL_FOUND AND Qt5_FOUND AND QGLVIEWER_F MainWindow.ui moc_MainWindow.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} Periodic_3_triangulation_3.qhc) - qt5_use_modules(periodic_3_triangulation_3_demo Xml Help OpenGL) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS periodic_3_triangulation_3_demo) - # Link the executable to CGAL and third-party libraries - target_link_libraries(periodic_3_triangulation_3_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + target_link_libraries(periodic_3_triangulation_3_demo PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::OpenGL Qt5::Help ${QGLVIEWER_LIBRARIES}) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(periodic_3_triangulation_3_demo) else () set(PERIODIC_TRIANGULATION_MISSING_DEPS "") @@ -86,10 +83,6 @@ else () set(PERIODIC_TRIANGULATION_MISSING_DEPS "Qt5, ${PERIODIC_TRIANGULATION_MISSING_DEPS}") endif() - if(NOT OPENGL_FOUND) - set(PERIODIC_TRIANGULATION_MISSING_DEPS "OpenGL, ${PERIODIC_TRIANGULATION_MISSING_DEPS}") - endif() - if(NOT QGLVIEWER_FOUND) set(PERIODIC_TRIANGULATION_MISSING_DEPS "QGLViewer, ${PERIODIC_TRIANGULATION_MISSING_DEPS}") endif() diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp index ebfd09478b4..31b3bd81bfe 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp @@ -830,7 +830,7 @@ void Scene::draw() { rendering_program.bind(); glPointSize(5); - ::glEnable(GL_POINT_SMOOTH); + glEnable(GL_POINT_SMOOTH); rendering_program.setUniformValue(colorLocation[0], color); glDrawArrays(GL_POINTS, 0, static_cast(pos_points.size()/3)); @@ -844,7 +844,7 @@ void Scene::draw() { rendering_program.bind(); glPointSize(5); - ::glEnable(GL_POINT_SMOOTH); + glEnable(GL_POINT_SMOOTH); rendering_program.setUniformValue(colorLocation[0], color); glDrawArrays(GL_POINTS, 0, 1); rendering_program.release(); diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt index b3727dddfaf..413d9163a24 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt @@ -23,13 +23,11 @@ include(${CGAL_USE_FILE}) find_package(Qt5 QUIET COMPONENTS Xml Script Help OpenGL Svg) -find_package(OpenGL) - if(Qt5_FOUND) find_package(QGLViewer) endif(Qt5_FOUND) -if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator ) +if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator ) include_directories (${QGLVIEWER_INCLUDE_DIR}) @@ -58,14 +56,15 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_ add_executable ( Periodic_Lloyd_3 Periodic_Lloyd_3.qhc Periodic_Lloyd_3.cpp MainWindow.cpp Viewer.cpp ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules(Periodic_Lloyd_3 Xml Script Help OpenGL Svg) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Periodic_Lloyd_3 ) - target_link_libraries( Periodic_Lloyd_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) - target_link_libraries( Periodic_Lloyd_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ) - target_link_libraries( Periodic_Lloyd_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + target_link_libraries( Periodic_Lloyd_3 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::OpenGL Qt5::Help + ${QGLVIEWER_LIBRARIES} ) -else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(Periodic_Lloyd_3) +else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE ) set(PERIODIC_LLOYD_MISSING_DEPS "") @@ -77,10 +76,6 @@ else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER set(PERIODIC_LLOYD_MISSING_DEPS "Qt5, ${PERIODIC_LLOYD_MISSING_DEPS}") endif() - if(NOT OPENGL_FOUND) - set(PERIODIC_LLOYD_MISSING_DEPS "OpenGL, ${PERIODIC_LLOYD_MISSING_DEPS}") - endif() - if(NOT QGLVIEWER_FOUND) set(PERIODIC_LLOYD_MISSING_DEPS "QGLViewer, ${PERIODIC_LLOYD_MISSING_DEPS}") endif() diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp index 11b7c128f0a..0acffda59df 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp @@ -32,18 +32,18 @@ Viewer::draw() initialize_buffers(); QColor color; //the points - ::glEnable(GL_BLEND); - ::glEnable(GL_POINT_SMOOTH); - ::glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); - ::glEnable(GL_LINE_SMOOTH); - ::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - ::glPointSize(5); + glEnable(GL_BLEND); + glEnable(GL_POINT_SMOOTH); + glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); + glEnable(GL_LINE_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glPointSize(5); - ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); - ::glColor3f(0.2f, 0.2f, 1.f); - ::glEnable(GL_POLYGON_OFFSET_FILL); - ::glPolygonOffset(3.0f,-3.0f); + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + glColor3f(0.2f, 0.2f, 1.f); + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(3.0f,-3.0f); attrib_buffers(this); @@ -56,10 +56,10 @@ Viewer::draw() vao[0].release(); //The Lines - ::glLineWidth(1.); - ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); - ::glColor3ub(0,0,0); - ::glDisable(GL_POLYGON_OFFSET_FILL); + glLineWidth(1.); + glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + glColor3ub(0,0,0); + glDisable(GL_POLYGON_OFFSET_FILL); vao[1].bind(); color.setRgbF(0.27f, 0.51f, 0.7f); @@ -173,7 +173,7 @@ void Viewer::initialize_buffers() void Viewer::compute_elements() { - //::glColor3f(1.0f, 0.72f, 0.06f); + //glColor3f(1.0f, 0.72f, 0.06f); pos_points.resize(0); pos_lines.resize(0); pos_8lines.resize(0); @@ -188,7 +188,7 @@ void Viewer::compute_elements() pos_points.push_back(p.x()); pos_points.push_back(p.y()); pos_points.push_back(p.z()); } - //::glColor3f(0.27f, 0.51f, 0.7f); + //glColor3f(0.27f, 0.51f, 0.7f); for (Periodic_triangle_iterator ptit = scene->periodic_triangulation.periodic_triangles_begin( P3DT3::UNIQUE); diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index 07b25c695c3..1951d62595d 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -36,10 +36,6 @@ if ( CGAL_FOUND ) if( ACTIVATE_CONCURRENT_PSP3 OR ENV{ACTIVATE_CONCURRENT_PSP3} ) find_package( TBB REQUIRED ) - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() endif() # Executables that do *not* require EIGEN or LAPACK @@ -69,7 +65,7 @@ if ( CGAL_FOUND ) include_directories(${LASLIB_INCLUDE_DIR}) include_directories(${LASZIP_INCLUDE_DIR}) create_single_source_cgal_program( "read_las_example.cpp" CXX_FEATURES ${needed_cxx_features} ) - target_link_libraries(read_las_example ${LASLIB_LIBRARIES}) + target_link_libraries(read_las_example PRIVATE ${LASLIB_LIBRARIES}) else() message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.") endif() @@ -96,6 +92,19 @@ if ( CGAL_FOUND ) endif(EIGEN3_FOUND OR LAPACK_FOUND) + foreach(target + scale_estimation_example + wlop_simplify_and_regularize_point_set_example + bilateral_smooth_point_set_example + edge_aware_upsample_point_set_example + average_spacing_example + normals_example + jet_smoothing_example + normal_estimation) + if(TBB_FOUND AND TARGET ${target}) + CGAL_target_use_TBB(${target}) + endif() + endforeach() else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index 8907cb6e9a7..3059bda82c5 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -32,11 +32,6 @@ if ( CGAL_FOUND ) find_package( TBB QUIET ) - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - # Executables that do *not* require LAPACK create_single_source_cgal_program( "read_test.cpp" ) create_single_source_cgal_program( "read_test_with_different_pmaps.cpp" ) @@ -74,6 +69,18 @@ if ( CGAL_FOUND ) endif(EIGEN3_FOUND OR LAPACK_FOUND) + foreach(target + analysis_test + smoothing_test + bilateral_smoothing_test + wlop_simplify_and_regularize_test + edge_aware_upsample_test + normal_estimation_test) + if(TBB_FOUND AND TARGET ${target}) + CGAL_target_use_TBB(${target}) + endif() + endforeach() + else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 658ace669d0..2cffcc102aa 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -62,13 +62,13 @@ find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) include( CGAL_CreateSingleSourceCGALProgram ) find_package( TBB ) +create_single_source_cgal_program( "hausdorff_distance_remeshing_example.cpp") if( TBB_FOUND ) - include( ${TBB_USE_FILE} ) - list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} ) + CGAL_target_use_TBB(hausdorff_distance_remeshing_example) else() message( STATUS "NOTICE: Intel TBB was not found. hausdorff_distance_example will use sequential code." ) endif() -create_single_source_cgal_program( "hausdorff_distance_remeshing_example.cpp") + if (EIGEN3_FOUND) # Executables that require Eigen 3.2 include( ${EIGEN3_USE_FILE} ) @@ -105,22 +105,22 @@ create_single_source_cgal_program( "detect_features_example.cpp" ) if(OpenMesh_FOUND) create_single_source_cgal_program( "compute_normals_example_OM.cpp" ) -target_link_libraries( compute_normals_example_OM ${OPENMESH_LIBRARIES} ) +target_link_libraries( compute_normals_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) create_single_source_cgal_program( "hole_filling_example_OM.cpp" ) -target_link_libraries( hole_filling_example_OM ${OPENMESH_LIBRARIES} ) +target_link_libraries( hole_filling_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) create_single_source_cgal_program( "point_inside_example_OM.cpp") -target_link_libraries( point_inside_example_OM ${OPENMESH_LIBRARIES} ) +target_link_libraries( point_inside_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) create_single_source_cgal_program( "stitch_borders_example_OM.cpp" ) -target_link_libraries( stitch_borders_example_OM ${OPENMESH_LIBRARIES} ) +target_link_libraries( stitch_borders_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) #create_single_source_cgal_program( "remove_degeneracies_example_OM.cpp") -#target_link_libraries( remove_degeneracies_example_OM ${OPENMESH_LIBRARIES} ) +#target_link_libraries( remove_degeneracies_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) create_single_source_cgal_program( "triangulate_faces_example_OM.cpp") -target_link_libraries( triangulate_faces_example_OM ${OPENMESH_LIBRARIES} ) +target_link_libraries( triangulate_faces_example_OM PRIVATE ${OPENMESH_LIBRARIES} ) endif(OpenMesh_FOUND) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index 758084def30..4f085bb10b8 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -47,12 +47,6 @@ include_directories( BEFORE ../../include ) find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) find_package( TBB ) -if( TBB_FOUND ) - include( ${TBB_USE_FILE} ) - list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} ) -else() - message( STATUS "NOTICE: Intel TBB was not found. test_pmp_distance will use sequential code." ) -endif() include( CGAL_CreateSingleSourceCGALProgram ) if (EIGEN3_FOUND) @@ -101,8 +95,14 @@ endif() create_single_source_cgal_program("triangulate_hole_polyline_test.cpp") create_single_source_cgal_program("surface_intersection_sm_poly.cpp" ) + if( TBB_FOUND ) + CGAL_target_use_TBB(test_pmp_distance) + else() + message( STATUS "NOTICE: Intel TBB was not found. test_pmp_distance will use sequential code." ) + endif() + if(OpenMesh_FOUND) create_single_source_cgal_program("remeshing_test_P_SM_OM.cpp" ) - target_link_libraries( remeshing_test_P_SM_OM ${OPENMESH_LIBRARIES} ) + target_link_libraries( remeshing_test_P_SM_OM PRIVATE ${OPENMESH_LIBRARIES} ) endif() diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 0066867ccab..07731b0a0f0 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -10,6 +10,10 @@ endif() if(POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() +if(POLICY CMP0072) + # About the use of OpenGL + cmake_policy(SET CMP0072 NEW) +endif() # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -45,8 +49,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") include_directories( BEFORE ./ ./include ../../include ./CGAL_demo ) list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}") -add_subdirectory( implicit_functions ) - # Find CGAL option( POLYHEDRON_QTSCRIPT_DEBUGGER @@ -58,7 +60,7 @@ include( ${CGAL_USE_FILE} ) find_package(Qt5 QUIET - COMPONENTS OpenGL Script Svg Xml + COMPONENTS OpenGL Script OPTIONAL_COMPONENTS ScriptTools) # Find OpenGL @@ -85,10 +87,7 @@ option(POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY if( POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY ) find_package( TBB ) - if( TBB_FOUND ) - include( ${TBB_USE_FILE} ) - list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} ) - else() + if( NOT TBB_FOUND ) message( STATUS "NOTICE: Intel TBB was not found. Bilateral smoothing and WLOP plugins are faster if TBB is linked." ) endif() endif() @@ -104,10 +103,7 @@ if( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} ) add_definitions( -DCGAL_CONCURRENT_MESH_3 ) if(NOT TBB_FOUND) find_package( TBB REQUIRED ) - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - else() + if( NOT TBB_FOUND ) message(STATUS "NOTICE: Intel TBB was not found. Mesh_3 is faster if TBB is linked.") endif() endif() @@ -138,7 +134,6 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) qt5_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui ) qt5_wrap_ui( ViewerUI_FILES ImageInterface.ui) qt5_generate_moc( "File_loader_dialog.h" "${CMAKE_CURRENT_BINARY_DIR}/File_loader_dialog_moc.cpp" ) - add_file_dependencies( File_loader_dialog_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/File_loader_dialog.h" ) include( ${CMAKE_CURRENT_SOURCE_DIR}/polyhedron_demo_macros.cmake ) @@ -146,9 +141,9 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES Polyhedron_3.qrc ) qt5_add_resources(gl_splat_rc GlSplat/glsplat.qrc) add_library(gl_splat SHARED - GlSplat/GlSplat.cpp GlSplat/Shader.cpp ${gl_splat_rc}) - qt5_use_modules(gl_splat OpenGL Gui Xml) - target_link_libraries(gl_splat ${OPENGL_gl_LIBRARY}) + GlSplat/GlSplat.cpp GlSplat/Shader.cpp ${gl_splat_rc}) + target_link_libraries(gl_splat PUBLIC ${QGLVIEWER_LIBRARIES} Qt5::OpenGL Qt5::Gui) + target_link_libraries(gl_splat PRIVATE ${OPENGL_LIBRARIES} ${QGLVIEWER_LIBRARIES}) find_path(CGAL_THREE_HEADERS_PATH NAME CGAL/Three/Scene_item.h @@ -191,11 +186,9 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) TextRenderer.cpp TextRenderer_moc.cpp Polyhedron_demo_plugin_helper.cpp) - qt5_use_modules(demo_framework OpenGL Gui Widgets Script Xml) target_link_libraries(demo_framework + PUBLIC Qt5::OpenGL Qt5::Widgets Qt5::Gui Qt5::Script ${QGLVIEWER_LIBRARIES} - ${OPENGL_gl_LIBRARY} - ${OPENGL_glu_LIBRARY} gl_splat ) if(CGAL_HEADER_ONLY) @@ -205,32 +198,32 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) add_library(scene_basic_objects SHARED Scene_plane_item.cpp Scene_spheres_item.cpp -) - target_link_libraries(scene_basic_objects + ) + target_link_libraries(scene_basic_objects + PUBLIC demo_framework ${CGAL_LIBRARIES} ${QGLVIEWER_LIBRARIES} - ${OPENGL_gl_LIBRARY} - ${OPENGL_glu_LIBRARY} gl_splat - ) - qt5_use_modules(scene_basic_objects OpenGL Gui Xml Script Widgets) - + Qt5::OpenGL Qt5::Gui Qt5::Script Qt5::Widgets) add_library(scene_color_ramp SHARED Color_ramp.cpp) - qt5_use_modules(scene_color_ramp Core) + target_link_libraries(scene_color_ramp PRIVATE Qt5::Core) add_library(point_dialog SHARED Show_point_dialog.cpp Show_point_dialog.ui ${Show_point_dialogUI_FILES}) - qt5_use_modules(point_dialog OpenGL Gui Xml Script Widgets) + target_link_libraries(point_dialog + PUBLIC Qt5::OpenGL Qt5::Gui Qt5::Script Qt5::Widgets) macro(add_item item_name) add_library(${item_name} SHARED ${ARGN}) - qt5_use_modules(${item_name} OpenGL Gui Xml Script Widgets) - target_link_libraries(${item_name} demo_framework ${CGAL_LIBRARIES} ${Boost_LIBRARIES}) + target_link_libraries(${item_name} + PUBLIC demo_framework ${CGAL_LIBRARIES} ${Boost_LIBRARIES} + Qt5::OpenGL Qt5::Gui Qt5::Script Qt5::Widgets) + cgal_add_compilation_test(${item_name}) endmacro(add_item) add_item(scene_c2t3_item Scene_c2t3_item.cpp) add_item(scene_c3t3_item Scene_c3t3_item.cpp) - target_link_libraries(scene_c3t3_item scene_polyhedron_item scene_polygon_soup_item scene_basic_objects ${TBB_LIBRARIES}) + target_link_libraries(scene_c3t3_item PUBLIC scene_polyhedron_item scene_polygon_soup_item scene_basic_objects ${TBB_LIBRARIES}) add_item(scene_polyhedron_item Scene_polyhedron_item.cpp) add_item(scene_polyhedron_transform_item Plugins/PCA/Scene_facegraph_transform_item.cpp ) add_item(scene_sm_transform_item Plugins/PCA/Scene_facegraph_transform_item.cpp ) @@ -245,59 +238,56 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) # special add_item(scene_polylines_item Scene_polylines_item.cpp) - target_link_libraries(scene_polylines_item scene_basic_objects) + target_link_libraries(scene_polylines_item PUBLIC scene_basic_objects) add_item(scene_polyhedron_item_decorator Scene_polyhedron_item_decorator.cpp ) - target_link_libraries(scene_polyhedron_item_decorator scene_polyhedron_item) + target_link_libraries(scene_polyhedron_item_decorator PUBLIC scene_polyhedron_item) add_item(scene_surface_mesh_item_decorator Scene_polyhedron_item_decorator.cpp ) - target_link_libraries(scene_surface_mesh_item_decorator scene_surface_mesh_item) + target_link_libraries(scene_surface_mesh_item_decorator PUBLIC scene_surface_mesh_item) target_compile_definitions(scene_surface_mesh_item_decorator PUBLIC "-DUSE_SURFACE_MESH" ) add_item(scene_polyhedron_and_sm_item_k_ring_selection Scene_polyhedron_item_k_ring_selection.cpp) - target_link_libraries(scene_polyhedron_and_sm_item_k_ring_selection scene_polyhedron_item scene_surface_mesh_item) + target_link_libraries(scene_polyhedron_and_sm_item_k_ring_selection PUBLIC scene_polyhedron_item scene_surface_mesh_item) add_item(scene_poly_item_k_ring_selection Plugins/PMP/Scene_facegraph_item_k_ring_selection.cpp) - target_link_libraries(scene_poly_item_k_ring_selection scene_polyhedron_item) + target_link_libraries(scene_poly_item_k_ring_selection PUBLIC scene_polyhedron_item) add_item(scene_sm_item_k_ring_selection Plugins/PMP/Scene_facegraph_item_k_ring_selection.cpp) - target_link_libraries(scene_sm_item_k_ring_selection scene_surface_mesh_item) + target_link_libraries(scene_sm_item_k_ring_selection PUBLIC scene_surface_mesh_item) target_compile_definitions(scene_sm_item_k_ring_selection PUBLIC "-DUSE_SURFACE_MESH" ) add_item(scene_polyhedron_selection_item Scene_polyhedron_selection_item.cpp) - target_link_libraries(scene_polyhedron_selection_item scene_polyhedron_item_decorator scene_poly_item_k_ring_selection) + target_link_libraries(scene_polyhedron_selection_item PUBLIC scene_polyhedron_item_decorator scene_poly_item_k_ring_selection) add_item(scene_surface_mesh_selection_item Scene_polyhedron_selection_item.cpp) - target_link_libraries(scene_surface_mesh_selection_item scene_surface_mesh_item_decorator scene_sm_item_k_ring_selection) + target_link_libraries(scene_surface_mesh_selection_item PUBLIC scene_surface_mesh_item_decorator scene_sm_item_k_ring_selection) target_compile_definitions(scene_surface_mesh_selection_item PUBLIC "-DUSE_SURFACE_MESH" ) add_item(scene_polyhedron_shortest_path_item Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp) - target_link_libraries(scene_polyhedron_shortest_path_item scene_polyhedron_item_decorator scene_polyhedron_item scene_polylines_item) + target_link_libraries(scene_polyhedron_shortest_path_item PUBLIC scene_polyhedron_item_decorator scene_polyhedron_item scene_polylines_item) add_item(scene_sm_shortest_path_item Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp) - target_link_libraries(scene_sm_shortest_path_item scene_surface_mesh_item_decorator scene_surface_mesh_item scene_polylines_item) + target_link_libraries(scene_sm_shortest_path_item PUBLIC scene_surface_mesh_item_decorator scene_surface_mesh_item scene_polylines_item) if(EIGEN3_FOUND ) add_item(scene_textured_polyhedron_item Scene_textured_polyhedron_item.cpp texture.cpp) - qt5_use_modules( scene_textured_polyhedron_item Svg ) add_item(scene_textured_surface_mesh_item Scene_textured_surface_mesh_item.cpp texture.cpp) - qt5_use_modules( scene_textured_surface_mesh_item Svg ) - qt5_wrap_ui( editionUI_FILES Plugins/Surface_mesh_deformation/Deform_mesh.ui ) add_item(scene_edit_polyhedron_item Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp - ${editionUI_FILES}) - target_link_libraries(scene_edit_polyhedron_item scene_polyhedron_item scene_surface_mesh_item scene_polyhedron_and_sm_item_k_ring_selection - scene_basic_objects) + ${editionUI_FILES}) + target_link_libraries(scene_edit_polyhedron_item PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polyhedron_and_sm_item_k_ring_selection + scene_basic_objects) endif() add_item(scene_implicit_function_item Scene_implicit_function_item.cpp ) - target_link_libraries(scene_implicit_function_item scene_color_ramp) + target_link_libraries(scene_implicit_function_item PUBLIC scene_color_ramp) add_item(scene_polygon_soup_item Scene_polygon_soup_item.cpp) - target_link_libraries(scene_polygon_soup_item scene_polyhedron_item scene_surface_mesh_item) + target_link_libraries(scene_polygon_soup_item PUBLIC scene_polyhedron_item scene_surface_mesh_item) add_item(scene_nef_polyhedron_item Scene_nef_polyhedron_item.cpp) - target_link_libraries(scene_nef_polyhedron_item scene_polyhedron_item scene_surface_mesh_item) + target_link_libraries(scene_nef_polyhedron_item PUBLIC scene_polyhedron_item scene_surface_mesh_item) find_package(LASLIB) if (LASLIB_FOUND) @@ -305,13 +295,16 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) include_directories(${LASLIB_INCLUDE_DIR}) include_directories(${LASZIP_INCLUDE_DIR}) add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp) - target_link_libraries( scene_points_with_normal_item gl_splat ${LASLIB_LIBRARIES}) + target_link_libraries( scene_points_with_normal_item PUBLIC gl_splat ${LASLIB_LIBRARIES}) else() add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp) - target_link_libraries( scene_points_with_normal_item gl_splat ) + target_link_libraries( scene_points_with_normal_item PUBLIC gl_splat ) + endif() + if(TBB_FOUND) + CGAL_target_use_TBB(scene_points_with_normal_item) endif() - target_link_libraries( demo_framework gl_splat) + target_link_libraries( demo_framework PUBLIC gl_splat) @@ -332,26 +325,27 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) File_loader_dialog_moc.cpp ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} ${FileLoaderDialogUI_files} ${MainWindowUI_files} ${PreferencesUI_FILES} ${statisticsUI_FILES}) - target_link_libraries(polyhedron_demo demo_framework point_dialog) - qt5_use_modules(polyhedron_demo Gui OpenGL Xml Widgets Script Svg ) + target_link_libraries(polyhedron_demo PUBLIC + demo_framework point_dialog Qt5::Gui Qt5::OpenGL Qt5::Widgets Qt5::Script) add_executable ( Polyhedron_3 Polyhedron_3.cpp ) - target_link_libraries( Polyhedron_3 polyhedron_demo ) + target_link_libraries( Polyhedron_3 PRIVATE polyhedron_demo ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 ) + cgal_add_compilation_test(polyhedron_demo) if( POLYHEDRON_QTSCRIPT_DEBUGGER ) if(TARGET Qt5::ScriptTools) - qt5_use_modules(polyhedron_demo ScriptTools) + target_link_libraries(polyhedron_demo PUBLIC Qt5::ScriptTools) else() message(STATUS "POLYHEDRON_QTSCRIPT_DEBUGGER is set to TRUE but the Qt5 ScriptTools library was not found.") endif() endif() - target_link_libraries( Polyhedron_3 demo_framework ) + target_link_libraries( Polyhedron_3 PRIVATE demo_framework ) # Link with CGAL - target_link_libraries( Polyhedron_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + target_link_libraries( Polyhedron_3 PUBLIC ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) - # Link with libQGLViewer, OpenGL - target_link_libraries( Polyhedron_3 ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY}) + # Link with libQGLViewer + target_link_libraries( Polyhedron_3 PUBLIC ${QGLVIEWER_LIBRARIES}) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 ) @@ -366,14 +360,23 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/${SUB_DIR}") ENDFOREACH() + add_subdirectory( implicit_functions ) + + # # Exporting # if(TARGET CGAL_Qt5) - export(TARGETS CGAL CGAL_Qt5 FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_) + export(TARGETS CGAL CGAL_Qt5 CGAL_ImageIO FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_) else() export(TARGETS FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_) endif() + if(TARGET CGAL_Qt5_moc_and_resources) + export( + TARGETS CGAL_Qt5_moc_and_resources + NAMESPACE Polyhedron_ + APPEND FILE polyhedron_demo_targets.cmake) + endif() export( TARGETS demo_framework diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt index 1dfd56f2e66..367251c51fe 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt @@ -1,4 +1,7 @@ include( polyhedron_demo_macros ) polyhedron_demo_plugin(cut_plugin Cut_plugin ) -target_link_libraries(cut_plugin scene_polyhedron_item scene_surface_mesh_item scene_basic_objects scene_color_ramp) +target_link_libraries(cut_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_basic_objects scene_color_ramp) +if(TBB_FOUND) + CGAL_target_use_TBB(cut_plugin) +endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp index 4cf0a6ba089..8074d3c76d5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt index 78d186744e2..cc5cc80dd7b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt @@ -5,5 +5,5 @@ include( polyhedron_demo_macros ) Camera_positions_list ${cameraUI_FILES}) - target_link_libraries( camera_positions_plugin ${QGLVIEWER_LIBRARIES} demo_framework) + target_link_libraries( camera_positions_plugin PUBLIC ${QGLVIEWER_LIBRARIES} demo_framework) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt index d13c4722d85..a54a9832d13 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt @@ -8,12 +8,15 @@ if(EIGEN3_FOUND) if(OpenCV_FOUND) message(STATUS "Found OpenCV ${OpenCV_VERSION}") include_directories(${OpenCV_INCLUDE_DIRS}) - target_link_libraries(classification_plugin scene_points_with_normal_item scene_polylines_item scene_polygon_soup_item scene_color_ramp ${OpenCV_LIBS}) + target_link_libraries(classification_plugin PUBLIC scene_points_with_normal_item scene_polylines_item scene_polygon_soup_item scene_color_ramp ${OpenCV_LIBS}) target_compile_definitions(classification_plugin PUBLIC "-DCGAL_LINKED_WITH_OPENCV") else() - target_link_libraries(classification_plugin scene_points_with_normal_item scene_polylines_item scene_polygon_soup_item scene_color_ramp) + target_link_libraries(classification_plugin PUBLIC scene_points_with_normal_item scene_polylines_item scene_polygon_soup_item scene_color_ramp) message(STATUS "NOTICE: OpenCV was not found. Random forest predicate for classification will not be available.") endif() + if(TBB_FOUND) + CGAL_target_use_TBB(classification_plugin) + endif() else(EIGEN3_FOUND) message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Classification plugin will not be available.") diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt index beba465bedf..8c621c0b873 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt @@ -1,4 +1,4 @@ include( polyhedron_demo_macros ) polyhedron_demo_plugin(nef_plugin Nef_plugin) - target_link_libraries(nef_plugin scene_nef_polyhedron_item) + target_link_libraries(nef_plugin PUBLIC scene_nef_polyhedron_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt index 4c93c3097ee..a0f11636ede 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt @@ -1,6 +1,7 @@ include( polyhedron_demo_macros ) polyhedron_demo_plugin(convex_hull_plugin Convex_hull_plugin) -target_link_libraries(convex_hull_plugin scene_polyhedron_item scene_points_with_normal_item scene_polylines_item scene_polyhedron_selection_item scene_surface_mesh_item) +target_link_libraries(convex_hull_plugin PUBLIC scene_polyhedron_item scene_points_with_normal_item scene_polylines_item scene_polyhedron_selection_item scene_surface_mesh_item) + polyhedron_demo_plugin(kernel_plugin Kernel_plugin) -target_link_libraries(kernel_plugin scene_polyhedron_item scene_surface_mesh_item) +target_link_libraries(kernel_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt index f454d3ea496..37d87fc5580 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt @@ -2,4 +2,4 @@ include( polyhedron_demo_macros ) qt5_wrap_ui( display_propertyUI_FILES Display_property.ui ) polyhedron_demo_plugin(display_property_plugin Display_property_plugin ${display_propertyUI_FILES}) -target_link_libraries(display_property_plugin scene_surface_mesh_item scene_color_ramp) +target_link_libraries(display_property_plugin PUBLIC scene_surface_mesh_item scene_color_ramp) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt index 8b5b7db9c1f..a1fa6892011 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt @@ -1,38 +1,38 @@ include( polyhedron_demo_macros ) polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin) -target_link_libraries(gocad_plugin scene_polyhedron_item scene_surface_mesh_item) +target_link_libraries(gocad_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item) qt5_wrap_ui( funcUI_FILES Function_dialog.ui ) polyhedron_demo_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES}) -target_link_libraries(io_implicit_function_plugin scene_implicit_function_item) +target_link_libraries(io_implicit_function_plugin PUBLIC scene_implicit_function_item) polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin) -target_link_libraries(nef_io_plugin scene_nef_polyhedron_item) +target_link_libraries(nef_io_plugin PUBLIC scene_nef_polyhedron_item) polyhedron_demo_plugin(off_plugin OFF_io_plugin) -target_link_libraries(off_plugin scene_polyhedron_item scene_polygon_soup_item scene_points_with_normal_item) +target_link_libraries(off_plugin PUBLIC scene_polyhedron_item scene_polygon_soup_item scene_points_with_normal_item) polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin) -target_link_libraries(off_to_nef_plugin scene_nef_polyhedron_item) +target_link_libraries(off_to_nef_plugin PUBLIC scene_nef_polyhedron_item) polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin) -target_link_libraries(polylines_io_plugin scene_polylines_item) +target_link_libraries(polylines_io_plugin PUBLIC scene_polylines_item) polyhedron_demo_plugin(selection_io_plugin Selection_io_plugin) -target_link_libraries(selection_io_plugin scene_polyhedron_selection_item) +target_link_libraries(selection_io_plugin PUBLIC scene_polyhedron_selection_item) polyhedron_demo_plugin(selection_io_sm_plugin Selection_io_plugin) -target_link_libraries(selection_io_sm_plugin scene_surface_mesh_selection_item) +target_link_libraries(selection_io_sm_plugin PUBLIC scene_surface_mesh_selection_item) polyhedron_demo_plugin(stl_plugin STL_io_plugin) -target_link_libraries(stl_plugin scene_polyhedron_item scene_surface_mesh_item scene_polygon_soup_item) +target_link_libraries(stl_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polygon_soup_item) polyhedron_demo_plugin(surface_mesh_io_plugin Surface_mesh_io_plugin) -target_link_libraries(surface_mesh_io_plugin scene_surface_mesh_item scene_polygon_soup_item) +target_link_libraries(surface_mesh_io_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item) polyhedron_demo_plugin(surf_io_plugin Surf_io_plugin) -target_link_libraries(surf_io_plugin scene_polyhedron_item scene_surface_mesh_item) +target_link_libraries(surf_io_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item) @@ -43,12 +43,12 @@ if (VTK_FOUND) if ("${VTK_VERSION_MAJOR}" GREATER "5") if(VTK_LIBRARIES) polyhedron_demo_plugin(vtk_plugin VTK_io_plugin) - target_link_libraries(vtk_plugin scene_polyhedron_item scene_polylines_item scene_c3t3_item + target_link_libraries(vtk_plugin PUBLIC scene_polyhedron_item scene_polylines_item scene_c3t3_item vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML vtkFiltersCore vtkFiltersSources) polyhedron_demo_plugin(vtk_sm_plugin VTK_io_plugin) - target_link_libraries(vtk_sm_plugin scene_surface_mesh_item scene_polylines_item scene_c3t3_item + target_link_libraries(vtk_sm_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_c3t3_item vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML vtkFiltersCore vtkFiltersSources) target_compile_definitions(vtk_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) @@ -63,7 +63,7 @@ else() message(STATUS "NOTICE : the vtk IO plugin needs VTK 6.0 or greater and will not be compiled.") endif() polyhedron_demo_plugin(xyz_plugin XYZ_io_plugin) -target_link_libraries(xyz_plugin scene_points_with_normal_item) +target_link_libraries(xyz_plugin PUBLIC scene_points_with_normal_item) list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_rvalue_references has_cxx_rvalues) list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_variadic_templates has_cxx_variadic) @@ -74,12 +74,12 @@ else() set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) polyhedron_demo_plugin(ply_plugin PLY_io_plugin) - target_link_libraries(ply_plugin scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_polygon_soup_item) + target_link_libraries(ply_plugin PUBLIC scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_polygon_soup_item) target_compile_features(ply_plugin PRIVATE ${needed_cxx_features}) if (LASLIB_FOUND) polyhedron_demo_plugin(las_plugin LAS_io_plugin) - target_link_libraries(las_plugin scene_points_with_normal_item ${LASLIB_LIBRARIES}) + target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item ${LASLIB_LIBRARIES}) target_compile_features(las_plugin PRIVATE ${needed_cxx_features}) else() message(STATUS "NOTICE : the LAS IO plugin needs LAS libraries and will not be compiled.") diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt index 749469868f5..4efa4d8d677 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt @@ -3,7 +3,8 @@ include( polyhedron_demo_macros ) qt5_wrap_ui( mesh_2UI_FILES mesh_2_dialog.ui) polyhedron_demo_plugin(mesh_2_plugin Mesh_2_plugin ${mesh_2UI_FILES}) #if the plugin uses external libraries like scene_items -target_link_libraries(mesh_2_plugin scene_polyhedron_item - scene_surface_mesh_item - scene_polylines_item - scene_points_with_normal_item) +target_link_libraries(mesh_2_plugin PUBLIC + scene_polyhedron_item + scene_surface_mesh_item + scene_polylines_item + scene_points_with_normal_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 8e1847ebfa5..e7a67b7e9aa 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -10,7 +10,7 @@ if ( Boost_VERSION GREATER 103400 ) polyhedron_demo_plugin(mesh_3_plugin Mesh_3_plugin Mesh_3_plugin_cgal_code.cpp Meshing_thread.cpp split_polylines.cpp ${meshingUI_FILES}) - target_link_libraries(mesh_3_plugin scene_polyhedron_item scene_polygon_soup_item scene_polylines_item scene_implicit_function_item scene_image_item + target_link_libraries(mesh_3_plugin PUBLIC scene_polyhedron_item scene_polygon_soup_item scene_polylines_item scene_implicit_function_item scene_image_item scene_surface_mesh_item scene_c3t3_item ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ) set(VTK_LIBS "") @@ -34,22 +34,29 @@ if ( Boost_VERSION GREATER 103400 ) if(Boost_FILESYSTEM_FOUND) qt5_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui) polyhedron_demo_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} ${VOLUME_MOC_OUTFILES}) - target_link_libraries(io_image_plugin scene_image_item ${VTK_LIBS} ) + target_link_libraries(io_image_plugin PUBLIC scene_image_item ${VTK_LIBS} ) + target_link_libraries(io_image_plugin PUBLIC CGAL::CGAL_ImageIO) else() message( STATUS "NOTICE : the Io_image_plugin needs boost-filesystem to work and will not be compiled") endif() polyhedron_demo_plugin(mesh_3_optimization_plugin Optimization_plugin Optimization_plugin_cgal_code.cpp Optimizer_thread.cpp ${meshingUI_FILES}) - target_link_libraries(mesh_3_optimization_plugin scene_c3t3_item scene_polyhedron_item scene_surface_mesh_item scene_image_item scene_implicit_function_item ) + target_link_libraries(mesh_3_optimization_plugin PUBLIC scene_c3t3_item scene_polyhedron_item scene_surface_mesh_item scene_image_item scene_implicit_function_item ) polyhedron_demo_plugin(c3t3_io_plugin C3t3_io_plugin) - target_link_libraries(c3t3_io_plugin scene_c3t3_item) - else( Boost_VERSION GREATER 103400 ) - message(STATUS "warning: the plugin mesh_3_plugin requires Boost>=1.34.1 and will not be compiled.") - endif( Boost_VERSION GREATER 103400 ) - qt5_wrap_ui( ribUI_FILES Rib_dialog.ui) - polyhedron_demo_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin ${ribUI_FILES}) - target_link_libraries(c3t3_rib_exporter_plugin scene_c3t3_item) + target_link_libraries(c3t3_io_plugin PUBLIC scene_c3t3_item) +else( Boost_VERSION GREATER 103400 ) + message(STATUS "warning: the plugin mesh_3_plugin requires Boost>=1.34.1 and will not be compiled.") +endif( Boost_VERSION GREATER 103400 ) + +qt5_wrap_ui( ribUI_FILES Rib_dialog.ui) +polyhedron_demo_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin ${ribUI_FILES}) +target_link_libraries(c3t3_rib_exporter_plugin PUBLIC scene_c3t3_item) + +if(TBB_FOUND) + CGAL_target_use_TBB(mesh_3_plugin) + CGAL_target_use_TBB(mesh_3_optimization_plugin) +endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 02e15ba9f5c..09530431c3d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -373,7 +373,7 @@ public Q_SLOTS: void addVP(Volume_plane_thread* thread) { Volume_plane_interface* plane = thread->getItem(); - plane->init(); + plane->init(static_cast(QGLViewer::QGLViewerPool().first())); // add the interface for this Volume_plane int id = scene->addItem(plane); scene->changeGroup(plane, group); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h index 0c52162aaa2..317e2ff9988 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h @@ -22,12 +22,12 @@ using namespace CGAL::Three; #if !defined(NDEBUG) inline -void printGlError(unsigned int line) { - CGAL::Qt::opengl_check_errors(line); +void printGlError(CGAL::Three::Viewer_interface* viewer, unsigned int line) { + CGAL::Qt::opengl_check_errors(viewer, line); } #else inline -void printGlError(unsigned int) { +void printGlError(CGAL::Three::Viewer_interface*, unsigned int) { } #endif @@ -121,7 +121,7 @@ public: // uses a public init function to enable construction in // threads without gl-context - void init(); + void init(Viewer_interface* viewer); private: bool is_grabbing; @@ -438,11 +438,11 @@ void Volume_plane::draw(Viewer_interface *viewer) const { program_bordures.setUniformValue("f_matrix", f); program_bordures.release(); GLint renderMode; - glGetIntegerv(GL_RENDER_MODE, &renderMode); - printGlError(__LINE__); + viewer->glGetIntegerv(GL_RENDER_MODE, &renderMode); + printGlError(viewer, __LINE__); - glLineWidth(4.0f); + viewer->glLineWidth(4.0f); v_rec.resize(0); drawRectangle(*this); @@ -453,10 +453,10 @@ void Volume_plane::draw(Viewer_interface *viewer) const { program_bordures.setAttributeBuffer("vertex",GL_FLOAT,0,3); program_bordures.enableAttributeArray("vertex"); program_bordures.setUniformValue("color",this->color()); - glDrawArrays(GL_LINE_LOOP, 0, static_cast(v_rec.size()/3)); + viewer->glDrawArrays(GL_LINE_LOOP, 0, static_cast(v_rec.size()/3)); rectBuffer.release(); program_bordures.release(); - glLineWidth(1.0f); + viewer->glLineWidth(1.0f); program.bind(); int mvpLoc = program.uniformLocation("mvp_matrix"); @@ -477,20 +477,20 @@ void Volume_plane::draw(Viewer_interface *viewer) const { - printGlError(__LINE__); + printGlError(viewer, __LINE__); for(unsigned int i = 0; i < ebos.size(); ++i) { ebos[i].first.bind(); - glDrawElements(GL_TRIANGLES, ebos[i].second, GL_UNSIGNED_INT, 0); + viewer->glDrawElements(GL_TRIANGLES, ebos[i].second, GL_UNSIGNED_INT, 0); ebos[i].first.release(); } cbuffer.release(); - printGlError(__LINE__); + printGlError(viewer, __LINE__); program.release(); - printGlError(__LINE__); + printGlError(viewer, __LINE__); if(!are_buffers_filled) initializeBuffers(viewer); @@ -517,7 +517,7 @@ void Volume_plane::draw(Viewer_interface *viewer) const { } template -void Volume_plane::init() { +void Volume_plane::init(Viewer_interface* viewer) { is_grabbing = false; initShaders(); @@ -535,14 +535,14 @@ void Volume_plane::init() { assert(vertices.size() == (3 * adim_ * bdim_)); int maxi, maxv; - glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &maxi); - glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &maxv); + viewer->glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &maxi); + viewer->glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &maxv); assert((vertices.size( ) / 3) < (unsigned int)maxi); vVBO.create(); vVBO.bind(); vVBO.allocate(vertices.data(),static_cast(sizeof(float) * vertices.size())); vVBO.release(); - printGlError(__LINE__); + printGlError(viewer, __LINE__); // for each patch std::vector indices; @@ -594,7 +594,7 @@ void Volume_plane::init() { cbuffer.allocate(colors_.data(),static_cast(colors_.size()*sizeof(float))); cbuffer.release(); - printGlError(__LINE__); + printGlError(viewer, __LINE__); } template diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h index 2ab1a73f8c8..088c587b0a4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include using namespace CGAL::Three; @@ -22,7 +23,7 @@ public: delete mFrame_; } - virtual void init() = 0; + virtual void init(CGAL::Three::Viewer_interface*) = 0; virtual void setData(unsigned int adim, unsigned int bdim, unsigned int cdim, float xscale, float yscale, float zscale, std::vector &colors) =0; virtual unsigned int aDim() const = 0; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp index 0a327e7b7b4..300113f1f31 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp @@ -4,7 +4,6 @@ #include "Volume_plane_interface.h" #include -#include struct Volume_plane_intersection_priv { Volume_plane_intersection_priv(float x, float y, float z, Volume_plane_intersection* parent) @@ -118,7 +117,7 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const { d->initializeBuffers(viewer); } attribBuffers(viewer, PROGRAM_NO_SELECTION); - glDepthRange(0.0,0.9999); + viewer->glDepthRange(0.0,0.9999); if(d->b && d->c) { vaos[Volume_plane_intersection_priv::AArray]->bind(); @@ -186,7 +185,7 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const { vaos[Volume_plane_intersection_priv::CArray]->release(); } viewer->glLineWidth(1.0f); - glDepthRange(0.00001,1.0); + viewer->glDepthRange(0.00001,1.0); } Volume_plane_intersection::Volume_plane_intersection(float x, float y, float z) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt index e7f69876464..6f5771530c9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt @@ -1,11 +1,11 @@ include( polyhedron_demo_macros ) qt5_wrap_ui( clip_polyhedronUI_FILES Clip_polyhedron_plugin.ui ) polyhedron_demo_plugin(clip_polyhedron_plugin Clip_polyhedron_plugin ${clip_polyhedronUI_FILES}) - target_link_libraries(clip_polyhedron_plugin scene_surface_mesh_item scene_polyhedron_item scene_basic_objects) + target_link_libraries(clip_polyhedron_plugin PUBLIC scene_surface_mesh_item scene_polyhedron_item scene_basic_objects) polyhedron_demo_plugin(point_set_from_vertices_plugin Point_set_from_vertices_plugin) - target_link_libraries(point_set_from_vertices_plugin scene_polyhedron_item scene_surface_mesh_item scene_polygon_soup_item scene_points_with_normal_item) + target_link_libraries(point_set_from_vertices_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polygon_soup_item scene_points_with_normal_item) polyhedron_demo_plugin(surface_mesh_to_polyhedron_plugin Surface_mesh_to_polyhedron_plugin) - target_link_libraries(surface_mesh_to_polyhedron_plugin scene_polyhedron_item scene_surface_mesh_item) + target_link_libraries(surface_mesh_to_polyhedron_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt index 2dfcf9fcb0f..978cbfa2c0b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt @@ -1,25 +1,25 @@ include( polyhedron_demo_macros ) polyhedron_demo_plugin(pca_plugin Pca_plugin) -target_link_libraries(pca_plugin scene_polyhedron_item scene_surface_mesh_item scene_points_with_normal_item scene_basic_objects) +target_link_libraries(pca_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_points_with_normal_item scene_basic_objects) qt5_wrap_ui( transformUI_FILES Transformation_widget.ui ) polyhedron_demo_plugin(affine_transform_plugin Affine_transform_plugin ${transformUI_FILES}) -target_link_libraries(affine_transform_plugin scene_polyhedron_item scene_polyhedron_transform_item scene_points_with_normal_item) +target_link_libraries(affine_transform_plugin PUBLIC scene_polyhedron_item scene_polyhedron_transform_item scene_points_with_normal_item) polyhedron_demo_plugin(affine_transform_sm_plugin Affine_transform_plugin ${transformUI_FILES}) -target_link_libraries(affine_transform_sm_plugin scene_surface_mesh_item scene_sm_transform_item scene_points_with_normal_item) +target_link_libraries(affine_transform_sm_plugin PUBLIC scene_surface_mesh_item scene_sm_transform_item scene_points_with_normal_item) target_compile_definitions(affine_transform_sm_plugin PUBLIC "-DCGAL_USE_SURFACE_MESH" ) polyhedron_demo_plugin(edit_box_plugin Edit_box_plugin) -target_link_libraries(edit_box_plugin scene_edit_box_item scene_surface_mesh_item scene_polyhedron_item) +target_link_libraries(edit_box_plugin PUBLIC scene_edit_box_item scene_surface_mesh_item scene_polyhedron_item) qt5_wrap_ui( clipUI_FILES Clipping_box_widget.ui ) polyhedron_demo_plugin(clipping_box_plugin Clipping_box_plugin ${clipUI_FILES}) -target_link_libraries(clipping_box_plugin scene_edit_box_item ) +target_link_libraries(clipping_box_plugin PUBLIC scene_edit_box_item ) polyhedron_demo_plugin(create_bbox_mesh_plugin Create_bbox_mesh_plugin) -target_link_libraries(create_bbox_mesh_plugin scene_surface_mesh_item scene_polyhedron_item) +target_link_libraries(create_bbox_mesh_plugin PUBLIC scene_surface_mesh_item scene_polyhedron_item) qt5_wrap_ui( volumesUI_FILES Basic_generator_widget.ui) polyhedron_demo_plugin(basic_generator_plugin Basic_generator_plugin ${volumesUI_FILES}) -target_link_libraries(basic_generator_plugin scene_surface_mesh_item scene_polyhedron_item scene_points_with_normal_item scene_polylines_item) +target_link_libraries(basic_generator_plugin PUBLIC scene_surface_mesh_item scene_polyhedron_item scene_points_with_normal_item scene_polylines_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp index 2ec9232dba1..4d1a7471140 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp index cc1a973346e..00c09a184c8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp @@ -1279,8 +1279,8 @@ void Scene_edit_box_item_priv::picking(int& type, int& id, Viewer_interface *vie int deviceHeight = viewer->camera()->screenHeight(); QOpenGLFramebufferObject* fbo = new QOpenGLFramebufferObject(deviceWidth, deviceHeight,QOpenGLFramebufferObject::Depth); fbo->bind(); - glEnable(GL_DEPTH_TEST); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + viewer->glEnable(GL_DEPTH_TEST); + viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); QColor bgColor(viewer->backgroundColor()); //draws the image in the fbo viewer->setBackgroundColor(::Qt::white); @@ -1290,7 +1290,7 @@ void Scene_edit_box_item_priv::picking(int& type, int& id, Viewer_interface *vie const static int dataLength = rowLength * deviceHeight; GLubyte* buffer = new GLubyte[dataLength]; // Qt uses upper corner for its origin while GL uses the lower corner. - glReadPixels(picked_pixel.x(), deviceHeight-1-picked_pixel.y(), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + viewer->glReadPixels(picked_pixel.x(), deviceHeight-1-picked_pixel.y(), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, buffer); //decode ID and pick (don't forget the case nothing is picked if(!(buffer[0]==buffer[1] && buffer[1]==buffer[2])) { @@ -1392,8 +1392,8 @@ void Scene_edit_box_item::drawHl(Viewer_interface* viewer)const { viewer->glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor); viewer->glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + viewer->glEnable(GL_BLEND); + viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); vaos[Scene_edit_box_item_priv::S_Faces]->bind(); d->program = &d->transparent_face_program; d->program->bind(); @@ -1409,8 +1409,8 @@ void Scene_edit_box_item::drawHl(Viewer_interface* viewer)const viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast(d->hl_vertex.size()/3)); vaos[Scene_edit_box_item_priv::S_Faces]->release(); d->program->release(); - glPolygonOffset(offset_factor, offset_units); - glDisable(GL_BLEND); + viewer->glPolygonOffset(offset_factor, offset_units); + viewer->glDisable(GL_BLEND); } } @@ -1445,8 +1445,8 @@ void Scene_edit_box_item::drawTransparent(CGAL::Three::Viewer_interface*viewer)c // Specular QVector4D specular(0.0f, 0.0f, 0.0f, 1.0f); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + viewer->glEnable(GL_BLEND); + viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); vaos[Scene_edit_box_item_priv::Faces]->bind(); d->program = &d->transparent_face_program; d->program->bind(); @@ -1462,5 +1462,5 @@ void Scene_edit_box_item::drawTransparent(CGAL::Three::Viewer_interface*viewer)c viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast(d->vertex_faces.size()/3)); vaos[Scene_edit_box_item_priv::Faces]->release(); d->program->release(); - glDisable(GL_BLEND); + viewer->glDisable(GL_BLEND); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index 0c603e0ea30..f335f63cdfa 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -2,7 +2,7 @@ include( polyhedron_demo_macros ) if(EIGEN3_FOUND) polyhedron_demo_plugin(jet_fitting_plugin Jet_fitting_plugin) - target_link_libraries(jet_fitting_plugin scene_polyhedron_item scene_surface_mesh_item scene_polylines_item) + target_link_libraries(jet_fitting_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polylines_item) else(EIGEN3_FOUND) message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Jet fitting plugin will not be available.") @@ -13,23 +13,23 @@ if(EIGEN3_FOUND) qt5_wrap_ui( hole_fillingUI_FILES Hole_filling_widget.ui) polyhedron_demo_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES}) - target_link_libraries(hole_filling_plugin scene_polyhedron_item scene_polylines_item scene_polyhedron_selection_item) + target_link_libraries(hole_filling_plugin PUBLIC scene_polyhedron_item scene_polylines_item scene_polyhedron_selection_item) qt5_wrap_ui( hole_fillingUI_FILES Hole_filling_widget.ui) polyhedron_demo_plugin(hole_filling_sm_plugin Hole_filling_plugin ${hole_fillingUI_FILES}) - target_link_libraries(hole_filling_sm_plugin scene_surface_mesh_item scene_polylines_item scene_surface_mesh_selection_item) + target_link_libraries(hole_filling_sm_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_surface_mesh_selection_item) target_compile_definitions(hole_filling_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) qt5_wrap_ui( fairingUI_FILES Fairing_widget.ui) polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES}) - target_link_libraries(fairing_plugin scene_polyhedron_selection_item) + target_link_libraries(fairing_plugin PUBLIC scene_polyhedron_selection_item) polyhedron_demo_plugin(fairing_sm_plugin Fairing_plugin ${fairingUI_FILES}) - target_link_libraries(fairing_sm_plugin scene_surface_mesh_selection_item) + target_link_libraries(fairing_sm_plugin PUBLIC scene_surface_mesh_selection_item) target_compile_definitions(fairing_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin) - target_link_libraries(hole_filling_polyline_plugin scene_surface_mesh_item scene_polyhedron_item scene_polylines_item) + target_link_libraries(hole_filling_polyline_plugin PUBLIC scene_surface_mesh_item scene_polyhedron_item scene_polylines_item) else() message(STATUS "NOTICE: The hole filling and fairing plugins require Eigen 3.2 (or higher) and will not be available.") endif() @@ -39,22 +39,22 @@ endif() polyhedron_demo_plugin(orient_soup_plugin Orient_soup_plugin) -target_link_libraries(orient_soup_plugin scene_polygon_soup_item scene_polyhedron_item scene_surface_mesh_item) +target_link_libraries(orient_soup_plugin PUBLIC scene_polygon_soup_item scene_polyhedron_item scene_surface_mesh_item) polyhedron_demo_plugin(inside_out_plugin Inside_out_plugin) -target_link_libraries(inside_out_plugin scene_polyhedron_item scene_surface_mesh_item scene_polygon_soup_item) +target_link_libraries(inside_out_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polygon_soup_item) polyhedron_demo_plugin(join_and_split_polyhedra_plugin Join_and_split_polyhedra_plugin) -target_link_libraries(join_and_split_polyhedra_plugin scene_polyhedron_item scene_polyhedron_selection_item) +target_link_libraries(join_and_split_polyhedra_plugin PUBLIC scene_polyhedron_item scene_polyhedron_selection_item) polyhedron_demo_plugin(join_and_split_sm_plugin Join_and_split_polyhedra_plugin) -target_link_libraries(join_and_split_sm_plugin scene_surface_mesh_item scene_surface_mesh_selection_item) +target_link_libraries(join_and_split_sm_plugin PUBLIC scene_surface_mesh_item scene_surface_mesh_selection_item) target_compile_definitions(join_and_split_sm_plugin PUBLIC "-DUSE_SURFACE_MESH") qt5_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES Mean_curvature_flow_skeleton_plugin.ui) polyhedron_demo_plugin(mean_curvature_flow_skeleton_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES}) -target_link_libraries(mean_curvature_flow_skeleton_plugin +target_link_libraries(mean_curvature_flow_skeleton_plugin PUBLIC scene_polyhedron_item scene_points_with_normal_item scene_polylines_item @@ -66,6 +66,7 @@ target_link_libraries(mean_curvature_flow_skeleton_plugin qt5_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES Mean_curvature_flow_skeleton_plugin.ui) polyhedron_demo_plugin(mean_curvature_flow_skeleton_sm_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES}) target_link_libraries(mean_curvature_flow_skeleton_sm_plugin + PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_polylines_item @@ -76,79 +77,88 @@ target_compile_definitions(mean_curvature_flow_skeleton_sm_plugin PUBLIC "-DUSE_ qt5_wrap_ui( point_inside_polyhedronUI_FILES Point_inside_polyhedron_widget.ui) polyhedron_demo_plugin(point_inside_polyhedron_plugin Point_inside_polyhedron_plugin ${point_inside_polyhedronUI_FILES}) -target_link_libraries(point_inside_polyhedron_plugin scene_polyhedron_item scene_surface_mesh_item scene_points_with_normal_item) +target_link_libraries(point_inside_polyhedron_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_points_with_normal_item) qt5_wrap_ui( polyhedron_slicerUI_FILES Polyhedron_slicer_widget.ui) polyhedron_demo_plugin(polyhedron_slicer_plugin Polyhedron_slicer_plugin ${polyhedron_slicerUI_FILES}) -target_link_libraries(polyhedron_slicer_plugin scene_polyhedron_item scene_surface_mesh_item scene_basic_objects scene_polylines_item) +target_link_libraries(polyhedron_slicer_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_basic_objects scene_polylines_item) polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin) -target_link_libraries(polyhedron_stitching_plugin scene_polyhedron_item scene_surface_mesh_item scene_polylines_item) +target_link_libraries(polyhedron_stitching_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polylines_item) qt5_wrap_ui( selectionUI_FILES Selection_widget.ui) polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES}) -target_link_libraries(selection_plugin scene_polyhedron_selection_item scene_points_with_normal_item scene_polylines_item) +target_link_libraries(selection_plugin PUBLIC scene_polyhedron_selection_item scene_points_with_normal_item scene_polylines_item) qt5_wrap_ui( selectionUI_FILES Selection_widget.ui) polyhedron_demo_plugin(selection_sm_plugin Selection_plugin ${selectionUI_FILES}) -target_link_libraries(selection_sm_plugin scene_surface_mesh_selection_item scene_points_with_normal_item scene_polylines_item) +target_link_libraries(selection_sm_plugin PUBLIC scene_surface_mesh_selection_item scene_points_with_normal_item scene_polylines_item) target_compile_definitions(selection_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) polyhedron_demo_plugin(self_intersection_plugin Self_intersection_plugin) -target_link_libraries(self_intersection_plugin scene_polyhedron_item scene_polyhedron_selection_item ) +target_link_libraries(self_intersection_plugin PUBLIC scene_polyhedron_item scene_polyhedron_selection_item ) polyhedron_demo_plugin(self_intersection_sm_plugin Self_intersection_plugin) -target_link_libraries(self_intersection_sm_plugin scene_surface_mesh_selection_item scene_surface_mesh_item) +target_link_libraries(self_intersection_sm_plugin PUBLIC scene_surface_mesh_selection_item scene_surface_mesh_item) target_compile_definitions(self_intersection_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) polyhedron_demo_plugin(triangulate_facets_plugin Triangulate_facets_plugin) -target_link_libraries(triangulate_facets_plugin scene_polyhedron_item scene_surface_mesh_item) +target_link_libraries(triangulate_facets_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item) polyhedron_demo_plugin(corefinement_plugin Corefinement_plugin) -target_link_libraries(corefinement_plugin scene_surface_mesh_item scene_polyhedron_item) +target_link_libraries(corefinement_plugin PUBLIC scene_surface_mesh_item scene_polyhedron_item) polyhedron_demo_plugin(surface_intersection_plugin Surface_intersection_plugin) -target_link_libraries(surface_intersection_plugin scene_polyhedron_item scene_polylines_item) +target_link_libraries(surface_intersection_plugin PUBLIC scene_polyhedron_item scene_polylines_item) polyhedron_demo_plugin(surface_intersection_sm_plugin Surface_intersection_plugin) -target_link_libraries(surface_intersection_sm_plugin scene_surface_mesh_item scene_polylines_item) +target_link_libraries(surface_intersection_sm_plugin PUBLIC scene_surface_mesh_item scene_polylines_item) target_compile_definitions(surface_intersection_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin) -target_link_libraries(repair_polyhedron_plugin scene_surface_mesh_item scene_polyhedron_item) +target_link_libraries(repair_polyhedron_plugin PUBLIC scene_surface_mesh_item scene_polyhedron_item) qt5_wrap_ui( isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui) polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin ${isotropicRemeshingUI_FILES}) -target_link_libraries(isotropic_remeshing_plugin scene_polyhedron_item scene_polyhedron_selection_item) +target_link_libraries(isotropic_remeshing_plugin PUBLIC scene_polyhedron_item scene_polyhedron_selection_item) polyhedron_demo_plugin(isotropic_remeshing_sm_plugin Isotropic_remeshing_plugin ${isotropicRemeshingUI_FILES}) -target_link_libraries(isotropic_remeshing_sm_plugin scene_surface_mesh_item scene_surface_mesh_selection_item) +target_link_libraries(isotropic_remeshing_sm_plugin PUBLIC scene_surface_mesh_item scene_surface_mesh_selection_item) target_compile_definitions(isotropic_remeshing_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) +if(TBB_FOUND) + CGAL_target_use_TBB(isotropic_remeshing_sm_plugin) + CGAL_target_use_TBB(isotropic_remeshing_plugin) +endif() + polyhedron_demo_plugin(distance_plugin Distance_plugin) -target_link_libraries(distance_plugin scene_polyhedron_item scene_color_ramp) +target_link_libraries(distance_plugin PUBLIC scene_polyhedron_item scene_color_ramp) + +if(TBB_FOUND) + CGAL_target_use_TBB(distance_plugin) +endif() polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin) -target_link_libraries(detect_sharp_edges_plugin scene_polyhedron_item) +target_link_libraries(detect_sharp_edges_plugin PUBLIC scene_polyhedron_item) polyhedron_demo_plugin(detect_sharp_edges_sm_plugin Detect_sharp_edges_plugin) -target_link_libraries(detect_sharp_edges_sm_plugin scene_surface_mesh_item) +target_link_libraries(detect_sharp_edges_sm_plugin PUBLIC scene_surface_mesh_item) target_compile_definitions(detect_sharp_edges_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) polyhedron_demo_plugin(distance_sm_plugin Distance_plugin) -target_link_libraries(distance_sm_plugin scene_surface_mesh_item scene_color_ramp) +target_link_libraries(distance_sm_plugin PUBLIC scene_surface_mesh_item scene_color_ramp) target_compile_definitions(distance_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) qt5_wrap_ui( randomPerturbationUI_FILES Random_perturbation_dialog.ui) polyhedron_demo_plugin(random_perturbation_plugin Random_perturbation_plugin ${randomPerturbationUI_FILES}) -target_link_libraries(random_perturbation_plugin scene_polyhedron_item scene_polyhedron_selection_item) +target_link_libraries(random_perturbation_plugin PUBLIC scene_polyhedron_item scene_polyhedron_selection_item) polyhedron_demo_plugin(degenerated_faces_poly_plugin Degenerated_faces_plugin) -target_link_libraries(degenerated_faces_poly_plugin scene_polyhedron_item scene_polyhedron_selection_item) +target_link_libraries(degenerated_faces_poly_plugin PUBLIC scene_polyhedron_item scene_polyhedron_selection_item) polyhedron_demo_plugin(degenerated_faces_sm_plugin Degenerated_faces_plugin) -target_link_libraries(degenerated_faces_sm_plugin scene_surface_mesh_item scene_surface_mesh_selection_item) +target_link_libraries(degenerated_faces_sm_plugin PUBLIC scene_surface_mesh_item scene_surface_mesh_selection_item) target_compile_definitions(degenerated_faces_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp index 6e11245d65d..3de1bfd1318 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -7,7 +7,6 @@ #include #include #include "Messages_interface.h" -#include #include #include diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp index 47666ccf10f..bdea82e9c05 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp @@ -363,8 +363,8 @@ void Scene_alpha_shape_item::draw(CGAL::Three::Viewer_interface* viewer) const vaos[0]->bind(); program->setAttributeValue("colors", this->color()); - glDrawElements(GL_TRIANGLES, static_cast(indices.size()), - GL_UNSIGNED_INT, indices.data()); + viewer->glDrawElements(GL_TRIANGLES, static_cast(indices.size()), + GL_UNSIGNED_INT, indices.data()); program->release(); vaos[0]->release(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt index ee960521b4a..d538c96e658 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt @@ -2,21 +2,21 @@ include( polyhedron_demo_macros ) if(EIGEN3_FOUND) qt5_wrap_ui( surface_reconstructionUI_FILES Surface_reconstruction_plugin.ui) polyhedron_demo_plugin(surface_reconstruction_plugin Surface_reconstruction_plugin Surface_reconstruction_plugin_impl ${surface_reconstructionUI_FILES}) - target_link_libraries(surface_reconstruction_plugin scene_polygon_soup_item scene_polyhedron_item scene_surface_mesh_item scene_points_with_normal_item) + target_link_libraries(surface_reconstruction_plugin PUBLIC scene_polygon_soup_item scene_polyhedron_item scene_surface_mesh_item scene_points_with_normal_item) qt5_wrap_ui( point_set_normal_estimationUI_FILES Point_set_normal_estimation_plugin.ui) polyhedron_demo_plugin(point_set_normal_estimation_plugin Point_set_normal_estimation_plugin ${point_set_normal_estimationUI_FILES}) - target_link_libraries(point_set_normal_estimation_plugin scene_points_with_normal_item) + target_link_libraries(point_set_normal_estimation_plugin PUBLIC scene_points_with_normal_item) qt5_wrap_ui( features_detection_pluginUI_FILES Features_detection_plugin.ui) polyhedron_demo_plugin(features_detection_plugin Features_detection_plugin ${features_detection_pluginUI_FILES}) - target_link_libraries(features_detection_plugin scene_points_with_normal_item) + target_link_libraries(features_detection_plugin PUBLIC scene_points_with_normal_item) polyhedron_demo_plugin(point_set_smoothing_plugin Point_set_smoothing_plugin) - target_link_libraries(point_set_smoothing_plugin scene_points_with_normal_item) + target_link_libraries(point_set_smoothing_plugin PUBLIC scene_points_with_normal_item) polyhedron_demo_plugin(point_set_average_spacing_plugin Point_set_average_spacing_plugin) - target_link_libraries(point_set_average_spacing_plugin scene_points_with_normal_item) + target_link_libraries(point_set_average_spacing_plugin PUBLIC scene_points_with_normal_item) else(EIGEN3_FOUND) message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Surface reconstruction plugin will not be available.") @@ -29,43 +29,67 @@ endif() qt5_wrap_ui(point_set_bilateral_smoothingUI_FILES Point_set_bilateral_smoothing_plugin.ui) polyhedron_demo_plugin(point_set_bilateral_smoothing_plugin Point_set_bilateral_smoothing_plugin ${point_set_bilateral_smoothingUI_FILES}) - target_link_libraries(point_set_bilateral_smoothing_plugin scene_points_with_normal_item) + target_link_libraries(point_set_bilateral_smoothing_plugin PUBLIC scene_points_with_normal_item) qt5_wrap_ui( ps_outliers_removal_UI_FILES Point_set_outliers_removal_plugin.ui) polyhedron_demo_plugin(point_set_outliers_removal_plugin Point_set_outliers_removal_plugin ${ps_outliers_removal_UI_FILES}) - target_link_libraries(point_set_outliers_removal_plugin scene_points_with_normal_item) + target_link_libraries(point_set_outliers_removal_plugin PUBLIC scene_points_with_normal_item) qt5_wrap_ui( point_set_selectionUI_FILES Point_set_selection_widget.ui) polyhedron_demo_plugin(point_set_selection_plugin Point_set_selection_plugin ${point_set_selectionUI_FILES}) - target_link_libraries(point_set_selection_plugin scene_points_with_normal_item scene_polylines_item scene_edit_box_item) + target_link_libraries(point_set_selection_plugin PUBLIC scene_points_with_normal_item scene_polylines_item scene_edit_box_item) qt5_wrap_ui(point_set_shape_detectionUI_FILES Point_set_shape_detection_plugin.ui) polyhedron_demo_plugin(point_set_shape_detection_plugin Point_set_shape_detection_plugin ${point_set_shape_detectionUI_FILES}) - target_link_libraries(point_set_shape_detection_plugin scene_surface_mesh_item scene_polyhedron_item scene_points_with_normal_item scene_polygon_soup_item) + target_link_libraries(point_set_shape_detection_plugin PUBLIC scene_surface_mesh_item scene_polyhedron_item scene_points_with_normal_item scene_polygon_soup_item) qt5_wrap_ui(point_set_simplificationUI_FILES Point_set_simplification_plugin.ui) polyhedron_demo_plugin(point_set_simplification_plugin Point_set_simplification_plugin ${point_set_simplificationUI_FILES}) - target_link_libraries(point_set_simplification_plugin scene_points_with_normal_item) + target_link_libraries(point_set_simplification_plugin PUBLIC scene_points_with_normal_item) qt5_wrap_ui(point_set_upsamplingUI_FILES Point_set_upsampling_plugin.ui) polyhedron_demo_plugin(point_set_upsampling_plugin Point_set_upsampling_plugin ${point_set_upsamplingUI_FILES}) - target_link_libraries(point_set_upsampling_plugin scene_points_with_normal_item) + target_link_libraries(point_set_upsampling_plugin PUBLIC scene_points_with_normal_item) qt5_wrap_ui(point_set_wlopFILES Point_set_wlop_plugin.ui) polyhedron_demo_plugin(point_set_wlop_plugin Point_set_wlop_plugin ${point_set_wlopFILES}) - target_link_libraries(point_set_wlop_plugin scene_points_with_normal_item) + target_link_libraries(point_set_wlop_plugin PUBLIC scene_points_with_normal_item) polyhedron_demo_plugin(merge_point_sets_plugin Merge_point_sets_plugin) - target_link_libraries(merge_point_sets_plugin scene_points_with_normal_item) + target_link_libraries(merge_point_sets_plugin PUBLIC scene_points_with_normal_item) polyhedron_demo_plugin(point_set_interference_plugin Point_set_interference_plugin) - target_link_libraries(point_set_interference_plugin scene_points_with_normal_item) + target_link_libraries(point_set_interference_plugin PUBLIC scene_points_with_normal_item) qt5_wrap_ui( alpha_shapeUI_FILES Alpha_shape_widget.ui ) polyhedron_demo_plugin(alpha_shape_plugin Alpha_shape_plugin ${alpha_shapeUI_FILES}) - target_link_libraries(alpha_shape_plugin scene_points_with_normal_item scene_c3t3_item) + target_link_libraries(alpha_shape_plugin PUBLIC scene_points_with_normal_item scene_c3t3_item) qt5_wrap_ui( distanceUI_FILES Point_set_to_mesh_distance_widget.ui ) polyhedron_demo_plugin(point_set_to_mesh_distance_plugin Point_set_to_mesh_distance_plugin ${distanceUI_FILES}) - target_link_libraries(point_set_to_mesh_distance_plugin scene_points_with_normal_item scene_surface_mesh_item scene_polyhedron_item scene_color_ramp) + target_link_libraries(point_set_to_mesh_distance_plugin PUBLIC scene_points_with_normal_item scene_surface_mesh_item scene_polyhedron_item scene_color_ramp) + + if(TBB_FOUND) + foreach(plugin + surface_reconstruction_plugin + point_set_normal_estimation_plugin + features_detection_plugin + point_set_smoothing_plugin + point_set_average_spacing_plugin + point_set_bilateral_smoothing_plugin + point_set_outliers_removal_plugin + point_set_selection_plugin + point_set_shape_detection_plugin + point_set_simplification_plugin + point_set_upsampling_plugin + point_set_wlop_plugin + merge_point_sets_plugin + point_set_interference_plugin + alpha_shape_plugin + point_set_to_mesh_distance_plugin) + if(TARGET ${plugin}) + CGAL_target_use_TBB(${plugin}) + endif() + endforeach() + endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt index 5d5af0d0897..bc42a9f5411 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt @@ -2,4 +2,4 @@ include( polyhedron_demo_macros ) polyhedron_demo_plugin(subdivision_methods_plugin Subdivision_methods_plugin) -target_link_libraries(subdivision_methods_plugin scene_polyhedron_item scene_surface_mesh_item) +target_link_libraries(subdivision_methods_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt index 2843c19884f..a83aafb4cb6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt @@ -8,10 +8,10 @@ if(EIGEN3_FOUND) if(CGAL_Core_FOUND) qt5_wrap_ui( parameterizationUI_FILES Parameterization_widget.ui ARAP_dialog.ui OTE_dialog.ui) polyhedron_demo_plugin(parameterization_plugin Parameterization_plugin ${parameterizationUI_FILES}) - target_link_libraries(parameterization_plugin ${CGAL_Core_LIBRARY} ${CGAL_Core_3RD_PARTY_LIBRARIES} scene_polyhedron_item scene_textured_polyhedron_item scene_polyhedron_selection_item) + target_link_libraries(parameterization_plugin PUBLIC CGAL::CGAL_Core scene_polyhedron_item scene_textured_polyhedron_item scene_polyhedron_selection_item) polyhedron_demo_plugin(parameterization_sm_plugin Parameterization_plugin ${parameterizationUI_FILES}) - target_link_libraries(parameterization_sm_plugin ${CGAL_Core_LIBRARY} ${CGAL_Core_3RD_PARTY_LIBRARIES} scene_surface_mesh_item scene_textured_surface_mesh_item scene_surface_mesh_selection_item) + target_link_libraries(parameterization_sm_plugin PUBLIC CGAL::CGAL_Core scene_surface_mesh_item scene_textured_surface_mesh_item scene_surface_mesh_selection_item) target_compile_definitions(parameterization_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) else(CGAL_Core_FOUND) @@ -24,30 +24,30 @@ endif(EIGEN3_FOUND) qt5_wrap_ui( segmentationUI_FILES Mesh_segmentation_widget.ui) polyhedron_demo_plugin(mesh_segmentation_plugin Mesh_segmentation_plugin ${segmentationUI_FILES}) -target_link_libraries(mesh_segmentation_plugin scene_polyhedron_item scene_surface_mesh_item) +target_link_libraries(mesh_segmentation_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item) qt5_wrap_ui( mesh_plane_detectionUI_FILES Mesh_plane_detection_dialog.ui) polyhedron_demo_plugin(mesh_plane_detection_plugin Mesh_plane_detection_plugin ${mesh_plane_detectionUI_FILES}) -target_link_libraries(mesh_plane_detection_plugin scene_polyhedron_item) +target_link_libraries(mesh_plane_detection_plugin PUBLIC scene_polyhedron_item) qt5_wrap_ui( mesh_simplificationUI_FILES Mesh_simplification_dialog.ui) polyhedron_demo_plugin(mesh_simplification_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES}) -target_link_libraries(mesh_simplification_plugin scene_polyhedron_item scene_polyhedron_selection_item) +target_link_libraries(mesh_simplification_plugin PUBLIC scene_polyhedron_item scene_polyhedron_selection_item) polyhedron_demo_plugin(mesh_simplification_sm_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES}) -target_link_libraries(mesh_simplification_sm_plugin scene_surface_mesh_item scene_surface_mesh_selection_item) +target_link_libraries(mesh_simplification_sm_plugin PUBLIC scene_surface_mesh_item scene_surface_mesh_selection_item) target_compile_definitions(mesh_simplification_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) qt5_wrap_ui( remeshingUI_FILES Remeshing_dialog.ui) polyhedron_demo_plugin(remeshing_plugin Remeshing_plugin Remeshing_plugin_cgal_code.cpp Mesher_base.cpp ${remeshingUI_FILES}) -target_link_libraries(remeshing_plugin scene_polyhedron_item scene_polygon_soup_item scene_c2t3_item) +target_link_libraries(remeshing_plugin PUBLIC scene_polyhedron_item scene_polygon_soup_item scene_c2t3_item) polyhedron_demo_plugin(offset_meshing_plugin Offset_meshing_plugin ${remeshingUI_FILES}) -target_link_libraries(offset_meshing_plugin scene_polyhedron_item scene_polygon_soup_item scene_c2t3_item) +target_link_libraries(offset_meshing_plugin PUBLIC scene_polyhedron_item scene_polygon_soup_item scene_c2t3_item) qt5_wrap_ui( shortestPathUI_FILES Shortest_path_widget.ui ) polyhedron_demo_plugin(shortest_path_plugin Shortest_path_plugin ${shortestPathUI_FILES}) -target_link_libraries(shortest_path_plugin scene_polyhedron_item scene_polyhedron_shortest_path_item scene_basic_objects) +target_link_libraries(shortest_path_plugin PUBLIC scene_polyhedron_item scene_polyhedron_shortest_path_item scene_basic_objects) polyhedron_demo_plugin(shortest_path_sm_plugin Shortest_path_plugin ${shortestPathUI_FILES}) -target_link_libraries(shortest_path_sm_plugin scene_surface_mesh_item scene_sm_shortest_path_item scene_basic_objects) +target_link_libraries(shortest_path_sm_plugin PUBLIC scene_surface_mesh_item scene_sm_shortest_path_item scene_basic_objects) target_compile_definitions(shortest_path_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp index 9cc198328e7..f009acb60bf 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp index f0c73c1f9eb..ef1213b60df 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp @@ -186,7 +186,7 @@ void Scene_polyhedron_shortest_path_item::drawPoints(CGAL::Three::Viewer_interfa { d->initialize_buffers(viewer); } - glPointSize(4.0f); + viewer->glPointSize(4.0f); d->program = getShaderProgram(PROGRAM_NO_SELECTION); attribBuffers(viewer, PROGRAM_NO_SELECTION); vaos[Scene_polyhedron_shortest_path_item_priv::Selected_Edges]->bind(); @@ -195,7 +195,7 @@ void Scene_polyhedron_shortest_path_item::drawPoints(CGAL::Three::Viewer_interfa viewer->glDrawArrays(GL_POINTS, 0, static_cast(d->vertices.size() / 3)); d->program->release(); vaos[Scene_polyhedron_shortest_path_item_priv::Selected_Edges]->release(); - glPointSize(1.0f); + viewer->glPointSize(1.0f); } Scene_polyhedron_shortest_path_item* Scene_polyhedron_shortest_path_item::clone() const diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt index 44851f87498..cb951c59918 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt @@ -1,9 +1,9 @@ include( polyhedron_demo_macros ) if ( EIGEN3_FOUND AND "${EIGEN3_VERSION}" VERSION_GREATER "3.1.90" ) polyhedron_demo_plugin(edit_polyhedron_plugin Edit_polyhedron_plugin Deform_mesh.ui) - target_link_libraries(edit_polyhedron_plugin scene_polyhedron_item scene_edit_polyhedron_item scene_polyhedron_selection_item) + target_link_libraries(edit_polyhedron_plugin PUBLIC scene_polyhedron_item scene_edit_polyhedron_item scene_polyhedron_selection_item) polyhedron_demo_plugin(edit_sm_plugin Edit_polyhedron_plugin Deform_mesh.ui) - target_link_libraries(edit_sm_plugin scene_surface_mesh_item scene_edit_polyhedron_item scene_surface_mesh_selection_item) + target_link_libraries(edit_sm_plugin PUBLIC scene_surface_mesh_item scene_edit_polyhedron_item scene_surface_mesh_selection_item) target_compile_definitions(edit_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) else() message(STATUS "NOTICE: The polyhedron edit plugin require Eigen 3.2 (or higher) and will not be available.") diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 2ae419a24f3..dccbe7258b0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -1456,8 +1456,8 @@ void Scene_edit_polyhedron_item::drawTransparent(Viewer_interface *viewer) const viewer->camera()->getModelViewProjectionMatrix(d_mat); for (int i=0; i<16; ++i) mvp_mat.data()[i] = GLfloat(d_mat[i]); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + viewer->glEnable(GL_BLEND); + viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); vaos[Scene_edit_polyhedron_item_priv::Frame_plane]->bind(); d->program = &d->transparent_plane_program; d->program->bind(); @@ -1468,7 +1468,7 @@ void Scene_edit_polyhedron_item::drawTransparent(Viewer_interface *viewer) const viewer->glDrawElements(GL_TRIANGLES, (GLsizei) d->plane_idx.size(), GL_UNSIGNED_INT, d->plane_idx.data()); d->program->release(); vaos[Scene_edit_polyhedron_item_priv::Frame_plane]->release(); - glDisable(GL_BLEND); + viewer->glDisable(GL_BLEND); } } @@ -1572,7 +1572,7 @@ void Scene_edit_polyhedron_item_priv::draw_ROI_and_control_vertices(CGAL::Three: } void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::Viewer_interface* viewer) const { - CGAL::GL::Point_size point_size; point_size.set_point_size(5); + CGAL::GL::Point_size point_size(viewer); point_size.set_point_size(5); //Draw the points if(d->ui_widget->ShowROICheckBox->isChecked()) { diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 6b47b30fcdf..279b8f4f981 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -312,7 +312,7 @@ Scene::duplicate(Item_id index) return -1; } -void Scene::initializeGL() +void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer) { ms_splatting->init(); @@ -325,10 +325,10 @@ void Scene::initializeGL() GLfloat position[] = { 0.0f, 0.0f, 1.0f, 1.0f }; // Assign created components to GL_LIGHT0 - glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight); - glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight); - glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight); - glLightfv(GL_LIGHT0, GL_POSITION, position); + viewer->glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight); + viewer->glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight); + viewer->glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight); + viewer->glLightfv(GL_LIGHT0, GL_POSITION, position); gl_init = true; } @@ -380,11 +380,11 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) { QMap picked_item_IDs; if(with_names) - glEnable(GL_DEPTH_TEST); + viewer->glEnable(GL_DEPTH_TEST); if(!ms_splatting->viewer_is_set) ms_splatting->setViewer(viewer); if(!gl_init) - initializeGL(); + initializeGL(viewer); // Flat/Gouraud OpenGL drawing for(int index = 0; index < m_entries.size(); ++index) { @@ -404,8 +404,8 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) if(item.renderingMode() == Flat || item.renderingMode() == FlatPlusEdges || item.renderingMode() == Gouraud) { if(with_names) { - glClearDepth(1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + viewer->glClearDepth(1.0); + viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } viewer->glEnable(GL_LIGHTING); viewer->glPointSize(2.f); @@ -423,7 +423,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) // read depth buffer at pick location; float depth = 1.0; - glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); + viewer->glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); if (depth != 1.0) { //add object to list of picked objects; @@ -433,7 +433,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) } } } - glDepthFunc(GL_LEQUAL); + viewer->glDepthFunc(GL_LEQUAL); // Wireframe OpenGL drawing for(int index = 0; index < m_entries.size(); ++index) { @@ -453,8 +453,8 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) if((item.renderingMode() == Wireframe || item.renderingMode() == PointsPlusNormals ) && with_names) { - glClearDepth(1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + viewer->glClearDepth(1.0); + viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } if((!with_names && item.renderingMode() == FlatPlusEdges ) || item.renderingMode() == Wireframe) @@ -495,7 +495,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) // read depth buffer at pick location; float depth = 1.0; - glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); + viewer->glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); if (depth != 1.0) { //add object to list of picked objects; @@ -512,8 +512,8 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) if(item.visible()) { if(item.renderingMode() == Points && with_names) { - glClearDepth(1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + viewer->glClearDepth(1.0); + viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } if(item.renderingMode() == Points || (!with_names && item.renderingMode() == PointsPlusNormals) || @@ -531,7 +531,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) if(item.renderingMode() == Points && with_names) { // read depth buffer at pick location; float depth = 1.0; - glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); + viewer->glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); if (depth != 1.0) { //add object to list of picked objects; @@ -541,7 +541,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) if(!with_names) { - glDepthFunc(GL_LESS); + viewer->glDepthFunc(GL_LESS); // Splatting if(!with_names && ms_splatting->isSupported()) { @@ -594,8 +594,8 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) if(item.visible()) { if(with_names) { - glClearDepth(1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + viewer->glClearDepth(1.0); + viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } viewer->glEnable(GL_LIGHTING); viewer->glPointSize(2.f); @@ -612,7 +612,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) // read depth buffer at pick location; float depth = 1.0; - glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); + viewer->glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); if (depth != 1.0) { //add object to list of picked objects; diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index dc22b013fd4..ea399e3ce66 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -78,7 +78,7 @@ public: QList selectionIndices() const Q_DECL_OVERRIDE; int selectionAindex() const Q_DECL_OVERRIDE; int selectionBindex() const Q_DECL_OVERRIDE; - void initializeGL() Q_DECL_OVERRIDE; + void initializeGL(CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE; void setPickedPixel(const QPoint &p) Q_DECL_OVERRIDE {picked_pixel = p;} void draw(CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE; void drawWithNames(CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE; diff --git a/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h b/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h index 673baa94630..8458706740f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h @@ -7,7 +7,6 @@ #include #include #include -#include class SCENE_C2T3_ITEM_EXPORT Scene_c2t3_item : public CGAL::Three::Scene_item { diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index 740f3f59326..e3b7b94a5ea 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include @@ -957,7 +956,7 @@ void Scene_c3t3_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { if(renderingMode() == FlatPlusEdges) { GLint renderMode; - glGetIntegerv(GL_RENDER_MODE, &renderMode); + viewer->glGetIntegerv(GL_RENDER_MODE, &renderMode); if(renderMode == GL_SELECT) return; } Scene_c3t3_item* ncthis = const_cast(this); diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h index 984668b148a..7b7cc8f1710 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h @@ -11,7 +11,6 @@ #include #include -#include #include #include #include diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item.cpp b/Polyhedron/demo/Polyhedron/Scene_image_item.cpp index 692a5e5e427..30cd07c309c 100644 --- a/Polyhedron/demo/Polyhedron/Scene_image_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_image_item.cpp @@ -4,7 +4,6 @@ #include "Image_type.h" #include #include -#include #include #include diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item.h b/Polyhedron/demo/Polyhedron/Scene_image_item.h index 20eaafe3a04..faf1e4ab8ba 100644 --- a/Polyhedron/demo/Polyhedron/Scene_image_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_image_item.h @@ -4,7 +4,6 @@ #include #include "Image_type_fwd.h" #include "Scene_image_item_config.h" -#include #include #include diff --git a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp b/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp index ec8a71b5593..7b639574fb9 100644 --- a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp index b4dc04d15a2..0e5383a0319 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp @@ -1267,8 +1267,8 @@ void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const { d->program->setUniformValue("is_selected", true); else d->program->setUniformValue("is_selected", false); - glDrawElements(GL_TRIANGLES, static_cast(d->idx_faces.size()), - GL_UNSIGNED_INT, d->idx_faces.data()); + viewer->glDrawElements(GL_TRIANGLES, static_cast(d->idx_faces.size()), + GL_UNSIGNED_INT, d->idx_faces.data()); d->program->release(); vaos[Scene_polyhedron_item_priv::Gouraud_Facets]->release(); } @@ -1314,8 +1314,8 @@ void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const { else d->program->setUniformValue("is_selected", false); - glDrawElements(GL_TRIANGLES, static_cast(d->idx_faces.size()), - GL_UNSIGNED_INT, d->idx_faces.data()); + viewer->glDrawElements(GL_TRIANGLES, static_cast(d->idx_faces.size()), + GL_UNSIGNED_INT, d->idx_faces.data()); d->program->release(); vaos[Scene_polyhedron_item_priv::Gouraud_Facets]->release(); } @@ -1345,8 +1345,8 @@ void Scene_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) con d->program->setUniformValue("is_selected", true); else d->program->setUniformValue("is_selected", false); - glDrawElements(GL_LINES, static_cast(d->idx_lines.size()), - GL_UNSIGNED_INT, d->idx_lines.data()); + viewer->glDrawElements(GL_LINES, static_cast(d->idx_lines.size()), + GL_UNSIGNED_INT, d->idx_lines.data()); d->program->release(); vaos[Scene_polyhedron_item_priv::Edges]->release(); } @@ -1365,8 +1365,8 @@ void Scene_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) con else d->program->setAttributeValue("colors",QColor(0,0,0)); } - glDrawElements(GL_LINES, static_cast(d->idx_feature_lines.size()), - GL_UNSIGNED_INT, d->idx_feature_lines.data()); + viewer->glDrawElements(GL_LINES, static_cast(d->idx_feature_lines.size()), + GL_UNSIGNED_INT, d->idx_feature_lines.data()); d->program->release(); vaos[Scene_polyhedron_item_priv::Feature_edges]->release(); } diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp index 8ad01d5539a..a82f1face6d 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp @@ -640,7 +640,7 @@ void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer viewer->glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor); viewer->glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units); - glPolygonOffset(0.5f, 0.9f); + viewer->glPolygonOffset(0.5f, 0.9f); vaos[Scene_polyhedron_selection_item_priv::HLFacets]->bind(); d->program = getShaderProgram(PROGRAM_WITH_LIGHT); attribBuffers(viewer,PROGRAM_WITH_LIGHT); @@ -693,13 +693,13 @@ void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer d->program->release(); vaos[Scene_polyhedron_selection_item_priv::Facets]->release(); - glEnable(GL_POLYGON_OFFSET_LINE); + viewer->glEnable(GL_POLYGON_OFFSET_LINE); viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); - glPolygonOffset(0.0f, 1.5f); + viewer->glPolygonOffset(0.0f, 1.5f); drawEdges(viewer); - glDisable(GL_POLYGON_OFFSET_LINE); + viewer->glDisable(GL_POLYGON_OFFSET_LINE); viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_POINT); - glPolygonOffset(offset_factor, offset_units); + viewer->glPolygonOffset(offset_factor, offset_units); drawPoints(viewer); viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); } diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp index 6b5db890e10..847e23dfa82 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp @@ -2,7 +2,6 @@ #include "Scene_spheres_item.h" #include -#include #include #include #include diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index 99f129e22c6..8fd8db1dcc8 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -654,7 +654,7 @@ void Scene_surface_mesh_item_priv::initializeBuffers(CGAL::Three::Viewer_interfa void Scene_surface_mesh_item::draw(CGAL::Three::Viewer_interface *viewer) const { - glShadeModel(GL_SMOOTH); + viewer->glShadeModel(GL_SMOOTH); if(!are_buffers_filled) { d->compute_elements(); @@ -673,8 +673,8 @@ void Scene_surface_mesh_item::draw(CGAL::Three::Viewer_interface *viewer) const d->program->setAttributeValue("is_selected", false); if(!d->has_vcolors) d->program->setAttributeValue("colors", this->color()); - glDrawElements(GL_TRIANGLES, static_cast(d->idx_data_.size()), - GL_UNSIGNED_INT, d->idx_data_.data()); + viewer->glDrawElements(GL_TRIANGLES, static_cast(d->idx_data_.size()), + GL_UNSIGNED_INT, d->idx_data_.data()); vaos[Scene_surface_mesh_item_priv::Smooth_facets]->release(); } else @@ -686,7 +686,7 @@ void Scene_surface_mesh_item::draw(CGAL::Three::Viewer_interface *viewer) const d->program->setAttributeValue("is_selected", false); if(!d->has_fcolors) d->program->setAttributeValue("colors", this->color()); - glDrawArrays(GL_TRIANGLES,0,static_cast(d->nb_flat/3)); + viewer->glDrawArrays(GL_TRIANGLES,0,static_cast(d->nb_flat/3)); vaos[Scene_surface_mesh_item_priv::Flat_facets]->release(); } @@ -709,15 +709,15 @@ void Scene_surface_mesh_item::drawEdges(CGAL::Three::Viewer_interface *viewer) c d->program->setUniformValue("is_selected", true); else d->program->setUniformValue("is_selected", false); - glDrawElements(GL_LINES, static_cast(d->idx_edge_data_.size()), - GL_UNSIGNED_INT, d->idx_edge_data_.data()); + viewer->glDrawElements(GL_LINES, static_cast(d->idx_edge_data_.size()), + GL_UNSIGNED_INT, d->idx_edge_data_.data()); if(d->has_feature_edges) { d->program->setAttributeValue("colors", Qt::red); d->program->setUniformValue("is_selected", false); - glDrawElements(GL_LINES, static_cast(d->idx_feature_edge_data_.size()), - GL_UNSIGNED_INT, d->idx_feature_edge_data_.data()); + viewer->glDrawElements(GL_LINES, static_cast(d->idx_feature_edge_data_.size()), + GL_UNSIGNED_INT, d->idx_feature_edge_data_.data()); } vaos[Scene_surface_mesh_item_priv::Edges]->release(); d->program->release(); @@ -739,8 +739,8 @@ void Scene_surface_mesh_item::drawPoints(CGAL::Three::Viewer_interface *viewer) d->program->setAttributeValue("is_selected", true); else d->program->setAttributeValue("is_selected", false); - glDrawElements(GL_POINTS, static_cast(d->idx_edge_data_.size()), - GL_UNSIGNED_INT, d->idx_edge_data_.data()); + viewer->glDrawElements(GL_POINTS, static_cast(d->idx_edge_data_.size()), + GL_UNSIGNED_INT, d->idx_edge_data_.data()); vaos[Scene_surface_mesh_item_priv::Edges]->release(); d->program->release(); } diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp index 21ee04603e8..319f903df5c 100644 --- a/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp @@ -155,7 +155,7 @@ void Scene_textured_polyhedron_item_priv::initializeBuffers(CGAL::Three::Viewer_ viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + viewer->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); nb_facets = positions_facets.size(); positions_facets.resize(0); diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp index ec1f0322dd4..4a51f6c1a88 100644 --- a/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp @@ -134,7 +134,7 @@ void Scene_textured_surface_mesh_item_priv::initializeBuffers(CGAL::Three::Viewe viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + viewer->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); item->are_buffers_filled = true; } diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index e2904ffb239..a8fa406f39f 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -1,5 +1,4 @@ #include "Viewer.h" -#include #include #include #include diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt index 00c1bd837be..4b2382a5315 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt @@ -2,6 +2,8 @@ project( Mesh_3_implicit_functions ) +include( polyhedron_demo_macros ) + cmake_minimum_required(VERSION 3.1) if(NOT POLICY CMP0070 AND POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. @@ -23,7 +25,7 @@ set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL ScriptTools ) +find_package(Qt5 QUIET COMPONENTS Script OpenGL ScriptTools ) if(CGAL_Qt5_FOUND AND Qt5_FOUND) @@ -37,27 +39,6 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) include(AddFileDependencies) remove_definitions(-DQT_STATICPLUGIN) - # polyhedron_demo_plugin is a macro copied from demo/Polyhedron/CMakeLists.txt - macro(polyhedron_demo_plugin plugin_name plugin_implementation_base_name) - list_split(option ARGN_TAIL ${ARGN} ) - if(NOT ${option} STREQUAL "EXCLUDE_FROM_ALL") - set(other_sources ${ARGN}) - set(option "") - else() - set(other_sources ${ARGN_TAIL}) - endif() - qt5_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ${plugin_implementation_base_name}.moc ) - add_file_dependencies( ${plugin_implementation_base_name}.moc "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ) - - add_library(${plugin_name} MODULE ${option} ${plugin_implementation_base_name}.moc ${plugin_implementation_base_name}.cpp ${other_sources}) - qt5_use_modules(${plugin_name} Widgets Script OpenGL Gui Xml) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${plugin_name} ) - # Link with Qt - target_link_libraries( ${plugin_name} ${QT_LIBRARIES} ) - # Link with CGAL - target_link_libraries( ${plugin_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) - endmacro(polyhedron_demo_plugin) - polyhedron_demo_plugin(p_sphere_function_plugin Sphere_implicit_function) polyhedron_demo_plugin(p_tanglecube_function_plugin Tanglecube_implicit_function) polyhedron_demo_plugin(p_klein_function_plugin Klein_implicit_function) diff --git a/Polyhedron/demo/Polyhedron/opengl_tools.h b/Polyhedron/demo/Polyhedron/opengl_tools.h index 8279f54964f..8dfcdcfc0c5 100644 --- a/Polyhedron/demo/Polyhedron/opengl_tools.h +++ b/Polyhedron/demo/Polyhedron/opengl_tools.h @@ -27,6 +27,7 @@ #define CGAL_OPENGL_TOOLS_H # include +#include namespace CGAL { namespace GL { @@ -47,15 +48,16 @@ public: class Point_size { GLfloat ps; + CGAL::Three::Viewer_interface* viewer; public: - Point_size() { - ::glGetFloatv(GL_POINT_SIZE, &ps); + Point_size(CGAL::Three::Viewer_interface* viewer) : viewer(viewer) { + viewer->glGetFloatv(GL_POINT_SIZE, &ps); } ~Point_size() { set_point_size(ps); } void set_point_size(GLfloat v) { - ::glPointSize(v); + viewer->glPointSize(v); } }; // end class Point_size diff --git a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake index fe32b0522a1..852c81448cc 100644 --- a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake +++ b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake @@ -1,5 +1,5 @@ include(AddFileDependencies) -include (CGAL_Macros) +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) macro(polyhedron_demo_plugin plugin_name plugin_implementation_base_name) list_split(option ARGN_TAIL ${ARGN} ) @@ -23,22 +23,22 @@ include (CGAL_Macros) endif() add_library(${plugin_name} MODULE ${option} ${moc_file_name} ${plugin_implementation_base_name}.cpp ${other_sources}) - qt5_use_modules(${plugin_name} Widgets Script OpenGL Gui Xml ) set_property(TARGET ${plugin_name} PROPERTY LIBRARY_OUTPUT_DIRECTORY "${CGAL_POLYHEDRON_DEMO_PLUGINS_DIR}") + cgal_add_compilation_test(${plugin_name}) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${plugin_name} ) # Link with Qt - target_link_libraries( ${plugin_name} ${QT_LIBRARIES} ) + target_link_libraries( ${plugin_name} PUBLIC ${QT_LIBRARIES} ) # Link with the demo_framework if(TARGET demo_framework) - target_link_libraries( ${plugin_name} demo_framework) + target_link_libraries( ${plugin_name} PUBLIC demo_framework) else() - target_link_libraries( ${plugin_name} Polyhedron_demo_framework) + target_link_libraries( ${plugin_name} PUBLIC Polyhedron_demo_framework) endif() # Link with CGAL - target_link_libraries( ${plugin_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + target_link_libraries( ${plugin_name} PUBLIC ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) if(TARGET Polyhedron_3) add_dependencies( ${plugin_name} Polyhedron_3 ) endif() diff --git a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt index 53ed5c83d0c..3b076bd0f77 100644 --- a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt @@ -36,15 +36,14 @@ qt5_generate_moc( ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.cpp Poly # The executable itself. add_executable ( Polyline_simplification_2 ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.cpp Polyline_simplification_2.moc ${CDT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) -qt5_use_modules(Polyline_simplification_2 Xml Script OpenGL Widgets Svg) -# Link with Qt libraries -target_link_libraries( Polyline_simplification_2 ${QT_LIBRARIES} ) - -# Link with CGAL -target_link_libraries( Polyline_simplification_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +target_link_libraries( Polyline_simplification_2 PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyline_simplification_2 ) +include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) +cgal_add_compilation_test(Polyline_simplification_2) + else() message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.") diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index 507abf76f25..721a4e64f5f 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -23,15 +23,12 @@ include( ${CGAL_USE_FILE} ) # Find Qt5 itself find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL) -# Find OpenGL -find_package(OpenGL) - # Find QGLViewer if(Qt5_FOUND) find_package(QGLViewer ) endif(Qt5_FOUND) -if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +if(CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND) include_directories ( ${QGLVIEWER_INCLUDE_DIR} ) @@ -47,23 +44,20 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES PCA_demo.qrc ) - add_file_dependencies( PCA_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" - "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) - add_executable ( PCA_demo PCA_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules( PCA_demo Xml Script OpenGL) - # Link with Qt libraries - target_link_libraries( PCA_demo ${QT_LIBRARIES} ) + add_file_dependencies( PCA_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) + add_executable ( PCA_demo PCA_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - # Link with CGAL - target_link_libraries( PCA_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) - - # Link with libQGLViewer, OpenGL - target_link_libraries( PCA_demo ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + target_link_libraries( PCA_demo PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui + ${QGLVIEWER_LIBRARIES} ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS PCA_demo ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(PCA_demo) -else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +else (CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND) set(PCA_MISSING_DEPS "") @@ -75,14 +69,10 @@ else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) set(PCA_MISSING_DEPS "Qt5, ${PCA_MISSING_DEPS}") endif() - if(NOT OPENGL_FOUND) - set(PCA_MISSING_DEPS "OpenGL, ${PCA_MISSING_DEPS}") - endif() - if(NOT QGLVIEWER_FOUND) set(PCA_MISSING_DEPS "QGLViewer, ${PCA_MISSING_DEPS}") endif() message(STATUS "NOTICE: This demo requires ${PCA_MISSING_DEPS} and will not be compiled.") -endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp b/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp index 3663ff7baf4..7dee6686fed 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp +++ b/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp @@ -1,4 +1,5 @@ #include "Scene.h" +#include "Viewer.h" #include #include @@ -93,54 +94,54 @@ void Scene::update_bbox() << " facets)" << std::endl; } -void Scene::draw() +void Scene::draw(Viewer* viewer) { if(m_view_polyhedron) - render_polyhedron(); + render_polyhedron(viewer); - render_line(); - render_plane(); - render_centroid(); + render_line(viewer); + render_plane(viewer); + render_centroid(viewer); } -void Scene::render_plane() +void Scene::render_plane(Viewer* viewer) { - ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); - ::glLineWidth(3.0f); - ::glColor3ub(255,0,0); - ::glBegin(GL_QUADS); + viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + viewer->glLineWidth(3.0f); + viewer->glColor3ub(255,0,0); + viewer->glBegin(GL_QUADS); Point o = m_plane.projection(m_centroid); Point a = o + normalize(m_plane.base1()) + normalize(m_plane.base2()); Point b = o + normalize(m_plane.base1()) - normalize(m_plane.base2()); Point c = o - normalize(m_plane.base1()) - normalize(m_plane.base2()); Point d = o - normalize(m_plane.base1()) + normalize(m_plane.base2()); - ::glVertex3d(a.x(),a.y(),a.z()); - ::glVertex3d(b.x(),b.y(),b.z()); - ::glVertex3d(c.x(),c.y(),c.z()); - ::glVertex3d(d.x(),d.y(),d.z()); - ::glEnd(); + viewer->glVertex3d(a.x(),a.y(),a.z()); + viewer->glVertex3d(b.x(),b.y(),b.z()); + viewer->glVertex3d(c.x(),c.y(),c.z()); + viewer->glVertex3d(d.x(),d.y(),d.z()); + viewer->glEnd(); } -void Scene::render_line() +void Scene::render_line(Viewer* viewer) { - ::glLineWidth(3.0f); - ::glColor3ub(0,0,255); - ::glBegin(GL_LINES); + viewer->glLineWidth(3.0f); + viewer->glColor3ub(0,0,255); + viewer->glBegin(GL_LINES); Point o = m_line.projection(m_centroid); Point a = o + normalize(m_line.to_vector()); Point b = o - normalize(m_line.to_vector()); - ::glVertex3d(a.x(),a.y(),a.z()); - ::glVertex3d(b.x(),b.y(),b.z()); - ::glEnd(); + viewer->glVertex3d(a.x(),a.y(),a.z()); + viewer->glVertex3d(b.x(),b.y(),b.z()); + viewer->glEnd(); } -void Scene::render_centroid() +void Scene::render_centroid(Viewer* viewer) { - ::glPointSize(10.0f); - ::glColor3ub(0,128,0); - ::glBegin(GL_POINTS); - ::glVertex3d(m_centroid.x(),m_centroid.y(),m_centroid.z()); - ::glEnd(); + viewer->glPointSize(10.0f); + viewer->glColor3ub(0,128,0); + viewer->glBegin(GL_POINTS); + viewer->glVertex3d(m_centroid.x(),m_centroid.y(),m_centroid.z()); + viewer->glEnd(); } @@ -149,15 +150,15 @@ Vector Scene::normalize(const Vector& v) return v / std::sqrt(v*v); } -void Scene::render_polyhedron() +void Scene::render_polyhedron(Viewer *viewer) { // draw black edges if(m_pPolyhedron != NULL) { - ::glDisable(GL_LIGHTING); - ::glColor3ub(0,0,0); - ::glLineWidth(1.0f); - gl_render_edges(*m_pPolyhedron); + viewer->glDisable(GL_LIGHTING); + viewer->glColor3ub(0,0,0); + viewer->glLineWidth(1.0f); + gl_render_edges(*m_pPolyhedron, viewer); } } diff --git a/Principal_component_analysis/demo/Principal_component_analysis/Scene.h b/Principal_component_analysis/demo/Principal_component_analysis/Scene.h index 257fd571e65..eb9cb20b80a 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/Scene.h +++ b/Principal_component_analysis/demo/Principal_component_analysis/Scene.h @@ -1,11 +1,12 @@ #ifndef SCENE_H #define SCENE_H -#include + #include #include #include "types.h" +class Viewer; class Scene { @@ -47,11 +48,11 @@ public: void fit_triangles(); // rendering - void draw(); - void render_line(); - void render_plane(); - void render_centroid(); - void render_polyhedron(); + void draw(Viewer *viewer); + void render_line(Viewer *viewer); + void render_plane(Viewer* viewer); + void render_centroid(Viewer* viewer); + void render_polyhedron(Viewer* viewer); private: diff --git a/Principal_component_analysis/demo/Principal_component_analysis/Viewer.cpp b/Principal_component_analysis/demo/Principal_component_analysis/Viewer.cpp index 4b74ad3093c..32f8dc004a1 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/Viewer.cpp +++ b/Principal_component_analysis/demo/Principal_component_analysis/Viewer.cpp @@ -17,14 +17,16 @@ void Viewer::draw() QGLViewer::draw(); if(m_pScene != NULL) { - ::glClearColor(1.0f,1.0f,1.0f,0.0f); - m_pScene->draw(); + glClearColor(1.0f,1.0f,1.0f,1.0f); + m_pScene->draw(this); } } void Viewer::initializeGL() { QGLViewer::initializeGL(); + makeCurrent(); + initializeOpenGLFunctions(); setBackgroundColor(::Qt::white); } diff --git a/Principal_component_analysis/demo/Principal_component_analysis/Viewer.h b/Principal_component_analysis/demo/Principal_component_analysis/Viewer.h index 963b242c96e..5a8ac8f2e39 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/Viewer.h +++ b/Principal_component_analysis/demo/Principal_component_analysis/Viewer.h @@ -2,12 +2,14 @@ #define VIEWER_H #include #include +#include // forward declarations class QWidget; class Scene; -class Viewer : public QGLViewer { +class Viewer : public QGLViewer, +public QOpenGLFunctions_2_1{ Q_OBJECT diff --git a/Principal_component_analysis/demo/Principal_component_analysis/render_edges.h b/Principal_component_analysis/demo/Principal_component_analysis/render_edges.h index 899232d79d3..58e200f5984 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/render_edges.h +++ b/Principal_component_analysis/demo/Principal_component_analysis/render_edges.h @@ -1,15 +1,15 @@ #ifndef _GL_RENDER_EDGES_ #define _GL_RENDER_EDGES_ -#include +#include "Viewer.h" template -void gl_render_edges(Polyhedron& polyhedron) +void gl_render_edges(Polyhedron& polyhedron, Viewer* viewer) { typedef typename Polyhedron::Traits Kernel; typedef typename Kernel::Point_3 Point; - ::glBegin(GL_LINES); + viewer->glBegin(GL_LINES); typename Polyhedron::Edge_iterator he; for(he = polyhedron.edges_begin(); he != polyhedron.edges_end(); @@ -17,10 +17,10 @@ void gl_render_edges(Polyhedron& polyhedron) { const Point& a = he->vertex()->point(); const Point& b = he->opposite()->vertex()->point(); - ::glVertex3d(a.x(),a.y(),a.z()); - ::glVertex3d(b.x(),b.y(),b.z()); + viewer->glVertex3d(a.x(),a.y(),a.z()); + viewer->glVertex3d(b.x(),b.y(),b.z()); } - ::glEnd(); + viewer->glEnd(); } #endif // _GL_RENDER_EDGES_ diff --git a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt index 6a289eda421..bb3785edbd3 100644 --- a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt @@ -1,31 +1,15 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - project( Compact_container_benchmark ) -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.1) - -find_package(CGAL QUIET COMPONENTS Core ) +find_package(CGAL QUIET) if ( CGAL_FOUND ) - include( ${CGAL_USE_FILE} ) - find_package( TBB ) - - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - - include( CGAL_CreateSingleSourceCGALProgram ) - - include_directories (BEFORE "../../include") - create_single_source_cgal_program( "cc_benchmark.cpp" ) - + if(TBB_FOUND) + CGAL_target_use_TBB(cc_benchmark) + endif() else() - - message(STATUS "This program requires the CGAL library, and will not be compiled.") - + message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() diff --git a/STL_Extension/test/STL_Extension/CMakeLists.txt b/STL_Extension/test/STL_Extension/CMakeLists.txt index 22896684eb1..5b5d39ddaeb 100644 --- a/STL_Extension/test/STL_Extension/CMakeLists.txt +++ b/STL_Extension/test/STL_Extension/CMakeLists.txt @@ -15,11 +15,6 @@ if ( CGAL_FOUND ) find_package( TBB QUIET ) - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - include( CGAL_CreateSingleSourceCGALProgram ) include_directories (BEFORE "../../include") @@ -32,6 +27,9 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_composition.cpp" ) create_single_source_cgal_program( "test_Concatenate_iterator.cpp" ) create_single_source_cgal_program( "test_Concurrent_compact_container.cpp" ) + if(TBB_FOUND) + CGAL_target_use_TBB(test_Concurrent_compact_container) + endif() create_single_source_cgal_program( "test_dispatch_output.cpp" ) create_single_source_cgal_program( "test_Flattening_iterator.cpp" ) create_single_source_cgal_program( "test_Handle_with_policy.cpp" ) diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt index 33f0413b270..8da2fc16bb8 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt @@ -14,10 +14,7 @@ if ( CGAL_FOUND ) if( ACTIVATE_CONCURRENCY ) find_package( TBB ) - if( TBB_FOUND ) - include( ${TBB_USE_FILE} ) - list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} ) - else() + if( NOT TBB_FOUND ) message( STATUS "NOTICE: Intel TBB NOT found! The example is faster if TBB is linked." ) endif() endif() @@ -31,6 +28,12 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "scale_space_incremental.cpp" ) create_single_source_cgal_program( "scale_space_manifold.cpp" ) create_single_source_cgal_program( "scale_space_advancing_front.cpp" ) + if(ACTIVATE_CONCURRENCY AND TBB_FOUND) + CGAL_target_use_TBB(scale_space) + CGAL_target_use_TBB(scale_space_incremental) + CGAL_target_use_TBB(scale_space_manifold) + CGAL_target_use_TBB(scale_space_advancing_front) + endif() else() message( STATUS "NOTICE: The example needs Eigen 3.1 (or greater) and will not be compiled." ) endif() diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt index 513e6bc0d2e..a00d63cb99c 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt @@ -33,7 +33,7 @@ if ( CGAL_FOUND ) if ( OpenMesh_FOUND ) include( UseOpenMesh ) create_single_source_cgal_program( "all_roi_assign_example_with_OpenMesh.cpp" ) - target_link_libraries( all_roi_assign_example_with_OpenMesh ${OPENMESH_LIBRARIES} ) + target_link_libraries( all_roi_assign_example_with_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} ) else() message(STATUS "Example that use OpenMesh will not be compiled.") endif() diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt index 4f31a839f77..291b39ae8a1 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt @@ -27,7 +27,7 @@ if ( CGAL_FOUND ) if ( OpenMesh_FOUND ) include( UseOpenMesh ) create_single_source_cgal_program( "Cactus_deformation_session_OpenMesh.cpp" ) - target_link_libraries( Cactus_deformation_session_OpenMesh ${OPENMESH_LIBRARIES} ) + target_link_libraries( Cactus_deformation_session_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} ) else() message(STATUS "Example that use OpenMesh will not be compiled.") endif() diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt index faa1aec6750..30d27b2c15e 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt @@ -67,6 +67,6 @@ create_single_source_cgal_program( "extract_segmentation_into_mesh_example.cpp") if(OpenMesh_FOUND) create_single_source_cgal_program( "segmentation_from_sdf_values_OpenMesh_example.cpp" ) - target_link_libraries( segmentation_from_sdf_values_OpenMesh_example ${OPENMESH_LIBRARIES} ) + target_link_libraries( segmentation_from_sdf_values_OpenMesh_example PRIVATE ${OPENMESH_LIBRARIES} ) endif() diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt index 7bd9a0eee37..a25a6a49cac 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt @@ -1,3 +1,4 @@ + # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. @@ -27,7 +28,7 @@ if ( CGAL_FOUND ) if ( OpenMesh_FOUND ) include( UseOpenMesh ) create_single_source_cgal_program( "shortest_paths_OpenMesh.cpp" ) - target_link_libraries( shortest_paths_OpenMesh ${OPENMESH_LIBRARIES} ) + target_link_libraries( shortest_paths_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} ) else() message(STATUS "Examples that use OpenMesh will not be compiled.") endif() diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt index 1988b8adafc..c1251e12009 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt @@ -68,5 +68,5 @@ create_single_source_cgal_program( "edge_collapse_bounded_normal_change.cpp" ) if(OpenMesh_FOUND) create_single_source_cgal_program( "edge_collapse_OpenMesh.cpp" ) - target_link_libraries( edge_collapse_OpenMesh ${OPENMESH_LIBRARIES} ) + target_link_libraries( edge_collapse_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} ) endif() diff --git a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt index 87cc02645cd..36c68b41489 100644 --- a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt @@ -16,6 +16,10 @@ set(CMAKE_AUTOMOC ON) if(POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() +if(POLICY CMP0072) + # About the use of OpenGL + cmake_policy(SET CMP0072 NEW) +endif() set(PACKAGE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) @@ -36,10 +40,6 @@ include_directories( ./ ) # QGLViwer needs Qt5 configured with QtOpenGL and QtXml support -set( QT_USE_QTOPENGL TRUE ) -set( QT_USE_QTXML TRUE ) -set( QT_USE_QTMAIN TRUE ) - find_package(CGAL COMPONENTS ImageIO Qt5) if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND) @@ -97,8 +97,6 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND) add_executable ( ${prj} ${sources} ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules(${prj} OpenGL Xml Svg) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${prj} ) set(VTK_LIBS "") @@ -116,10 +114,17 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND) message(STATUS "For reading Dicom files install VTK first") endif() - # Link the executable to CGAL and third-party libraries - target_link_libraries( ${prj} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + target_link_libraries( ${prj} PRIVATE + CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_ImageIO + ${OPENGL_LIBRARIES} + ${QGLVIEWER_LIBRARIES} + ${VTK_LIBS} ) - target_link_libraries( ${prj} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${VTK_LIBS}) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(${prj}) + + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(${prj}) else( QGLVIEWER_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND ) message(STATUS "NOTICE: This demo needs libQGLViewer, and will not be compiled.") diff --git a/Surface_mesher/demo/Surface_mesher/polyhedral_surface.h b/Surface_mesher/demo/Surface_mesher/polyhedral_surface.h index d65fe638f7d..77be1894223 100644 --- a/Surface_mesher/demo/Surface_mesher/polyhedral_surface.h +++ b/Surface_mesher/demo/Surface_mesher/polyhedral_surface.h @@ -5,7 +5,6 @@ #include "surface.h" #include "viewer.h" -#include #include #include diff --git a/TDS_3/test/TDS_3/CMakeLists.txt b/TDS_3/test/TDS_3/CMakeLists.txt index 9a6961743ba..4d8b2ce5862 100644 --- a/TDS_3/test/TDS_3/CMakeLists.txt +++ b/TDS_3/test/TDS_3/CMakeLists.txt @@ -1,36 +1,18 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - - project( TDS_3_Tests ) -cmake_minimum_required(VERSION 2.8.11) - +cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) if ( CGAL_FOUND ) - include( ${CGAL_USE_FILE} ) + include_directories (BEFORE "./include") find_package( TBB QUIET ) - - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - - include( CGAL_CreateSingleSourceCGALProgram ) - - include_directories (BEFORE "../../include") - - include_directories (BEFORE "include") - create_single_source_cgal_program( "test_triangulation_tds_3.cpp" ) - + if(TBB_FOUND) + CGAL_target_use_TBB(test_triangulation_tds_3) + endif() else() - - message(STATUS "This program requires the CGAL library, and will not be compiled.") - + message(STATUS "This program requires the CGAL library, and will not be compiled.") endif() - diff --git a/Testsuite/include/CGAL/Testsuite/vc_debug_hook.h b/Testsuite/include/CGAL/Testsuite/vc_debug_hook.h index a56312cea66..4890e778d6a 100644 --- a/Testsuite/include/CGAL/Testsuite/vc_debug_hook.h +++ b/Testsuite/include/CGAL/Testsuite/vc_debug_hook.h @@ -47,11 +47,11 @@ namespace { switch(n) { - case SIGSEGV: std::fprintf(stderr,"Program recieved signal SIGSEGV: Segmentation Fault."); break ; - case SIGFPE : std::fprintf(stderr,"Program recieved signal SIGFPE: Floating Point Execption."); break ; - case SIGILL : std::fprintf(stderr,"Program recieved signal SIGILL: Illegal Instruction."); break ; + case SIGSEGV: std::fprintf(stderr,"In CGAL_handle_signal, Program received signal SIGSEGV: Segmentation Fault."); break ; + case SIGFPE : std::fprintf(stderr,"In CGAL_handle_signal, Program received signal SIGFPE: Floating Point Execption."); break ; + case SIGILL : std::fprintf(stderr,"In CGAL_handle_signal, Program received signal SIGILL: Illegal Instruction."); break ; default: - std::fprintf(stderr,"Program recieved signal %d", n); break ; + std::fprintf(stderr,"In CGAL_handle_signal, Program received signal %d", n); break ; } std::exit(128+n); diff --git a/Three/include/CGAL/Three/Scene_draw_interface.h b/Three/include/CGAL/Three/Scene_draw_interface.h index 35a030c9d8b..24a889b8011 100644 --- a/Three/include/CGAL/Three/Scene_draw_interface.h +++ b/Three/include/CGAL/Three/Scene_draw_interface.h @@ -42,7 +42,7 @@ public: /*! Is called by Viewer::initializeGL(). Allows all the initialization * of OpenGL code that needs a context. */ - virtual void initializeGL() = 0; + virtual void initializeGL(CGAL::Three::Viewer_interface*) = 0; //! \brief Draws the items. //! It is called by Viewer::draw(). diff --git a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt index 297ad7ded57..bef93004739 100644 --- a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt @@ -22,9 +22,7 @@ find_package(CGAL COMPONENTS Qt5) include(${CGAL_USE_FILE}) -find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL) - -find_package(OpenGL) +find_package(Qt5 QUIET COMPONENTS OpenGL) if(Qt5_FOUND) add_definitions(-DQT_NO_KEYWORDS) @@ -49,11 +47,7 @@ else( ACTIVATE_CONCURRENT_TRIANGULATION_3 ) endif( LINK_WITH_TBB ) endif() -if( TBB_FOUND ) - include(${TBB_USE_FILE}) -endif() - -if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) +if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND ) include_directories (${QGLVIEWER_INCLUDE_DIR}) include_directories (BEFORE ../../include ./ ) @@ -71,14 +65,21 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_ PreferenceDlg.cpp Scene.cpp ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}) - qt5_use_modules(T3_demo Xml Script OpenGL) add_to_cached_list( CGAL_EXECUTABLE_TARGETS T3_demo ) - target_link_libraries( T3_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) - target_link_libraries( T3_demo ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${TBB_LIBRARIES}) - target_link_libraries( T3_demo ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + target_link_libraries( T3_demo PRIVATE ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + target_link_libraries( T3_demo PRIVATE Qt5::OpenGL ${QGLVIEWER_LIBRARIES}) + if(TBB_FOUND) + CGAL_target_use_TBB(T3_demo) + endif() -else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(T3_demo) + + include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) + cgal_add_compilation_test(T3_demo) + +else( CGAL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND ) set(TRIANGULATION_3_MISSING_DEPS "") @@ -90,10 +91,6 @@ else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) set(TRIANGULATION_3_MISSING_DEPS "Qt5, ${TRIANGULATION_3_MISSING_DEPS}") endif() - if(NOT OPENGL_FOUND) - set(TRIANGULATION_3_MISSING_DEPS "OpenGL, ${TRIANGULATION_3_MISSING_DEPS}") - endif() - if(NOT QGLVIEWER_FOUND) set(TRIANGULATION_3_MISSING_DEPS "QGLViewer, ${TRIANGULATION_3_MISSING_DEPS}") endif() @@ -101,4 +98,4 @@ else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) message(STATUS "NOTICE: This demo requires ${TRIANGULATION_3_MISSING_DEPS}and will not be compiled.") -endif( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) +endif( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND ) diff --git a/Triangulation_3/demo/Triangulation_3/Viewer.cpp b/Triangulation_3/demo/Triangulation_3/Viewer.cpp index 38a1f9f02b5..53d65a38f96 100644 --- a/Triangulation_3/demo/Triangulation_3/Viewer.cpp +++ b/Triangulation_3/demo/Triangulation_3/Viewer.cpp @@ -58,23 +58,23 @@ void Viewer::init() GLfloat specular_color[4] = { 0.8f, 0.8f, 0.8f, 1.0 }; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular_color); // Set Smooth Shading - ::glShadeModel(GL_SMOOTH); + glShadeModel(GL_SMOOTH); // depth buffer setup - ::glClearDepth(1.0f); - ::glEnable(GL_DEPTH_TEST); - ::glDepthFunc(GL_LEQUAL); - ::glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + glClearDepth(1.0f); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // enable semi-transparent culling planes - ::glEnable(GL_BLEND); - ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // anti-aliasing, i.e. reduce jaggedness (if the OpenGL driver permits that) - ::glEnable(GL_POINT_SMOOTH); - ::glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); - ::glEnable(GL_LINE_SMOOTH); - ::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glEnable(GL_POINT_SMOOTH); + glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); + glEnable(GL_LINE_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); /* Add mouse and key description */ setKeyDescription( Qt::CTRL + Qt::Key_G, tr("Generate points") ); @@ -1234,7 +1234,7 @@ void Viewer::draw() // Insert point mode if( m_curMode == INSERT_PT) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Insert a point"), fontPrompt ); drawText( width()-200, 40, tr("Hold Left: Move the point"), fontPrompt ); drawText( width()-200, 60, tr("Return: Insert to DT"), fontPrompt ); @@ -1258,7 +1258,7 @@ void Viewer::draw() } else if( m_curMode == SELECT) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Select"), fontPrompt ); drawText( width()-200, 40, tr("Ctrl+Left: Add selection"), QFont("Arial", 14) ); @@ -1274,7 +1274,7 @@ void Viewer::draw() } else if( m_curMode == MOVE ) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Left Click: Select"), fontPrompt ); if(m_isMoving) drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt ); @@ -1288,7 +1288,7 @@ void Viewer::draw() } else if( m_curMode == FINDNB ) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt ); drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt ); rendering_program.bind(); @@ -1307,7 +1307,7 @@ void Viewer::draw() } else if(m_curMode == EMPTYSPH){ // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt ); drawText( width()-200, 40, tr("Press S: Show/Hide trackball"), fontPrompt ); drawText( width()-200, 60, tr("Shift+Wheel: Resize trackball"), fontPrompt ); @@ -1337,7 +1337,7 @@ void Viewer::draw() switch( m_curStep ) { case NEWPT: // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( 10, 20, tr("Highlight the next-to-insert point"), fontPrompt ); // Highlight the next-to-insert point rendering_program.bind(); @@ -1351,7 +1351,7 @@ void Viewer::draw() break; case CELL: // show the tetrahedron that contains the point // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( 10, 20, tr("Show the tetrahedron containing the point"), fontPrompt ); drawText( 10, 40, tr("(Only finite facets are drawn)"), fontPrompt ); // Highlight the next-to-insert vertex @@ -1373,7 +1373,7 @@ void Viewer::draw() break; case CONFLICT: // show the conflict region // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( 10, 20, tr("Show the conflict region"), fontPrompt ); // Highlight the next-to-insert vertex rendering_program.bind(); @@ -1432,7 +1432,7 @@ void Viewer::draw() if( m_curMode == INSERT_PT) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Insert a point"), fontPrompt ); drawText( width()-200, 40, tr("Hold Left: Move the point"), fontPrompt ); drawText( width()-200, 60, tr("Return: Insert to DT"), fontPrompt ); @@ -1457,7 +1457,7 @@ void Viewer::draw() } else if( m_curMode == SELECT) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Select"), fontPrompt ); drawText( width()-200, 40, tr("Ctrl+Left: Add selection"), QFont("Arial", 14) ); @@ -1473,7 +1473,7 @@ void Viewer::draw() } else if( m_curMode == MOVE ) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Left Click: Select"), fontPrompt ); if(m_isMoving) drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt ); @@ -1487,7 +1487,7 @@ void Viewer::draw() } else if( m_curMode == FINDNB ) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt ); drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt ); rendering_program_spheres.bind(); @@ -1507,7 +1507,7 @@ void Viewer::draw() } else if(m_curMode == EMPTYSPH){ // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt ); drawText( width()-200, 40, tr("Press S: Show/Hide trackball"), fontPrompt ); drawText( width()-200, 60, tr("Shift+Wheel: Resize trackball"), fontPrompt ); @@ -1539,7 +1539,7 @@ void Viewer::draw() switch( m_curStep ) { case NEWPT: // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( 10, 20, tr("Highlight the next-to-insert point"), fontPrompt ); // Highlight the next-to-insert point rendering_program_spheres.bind(); @@ -1552,7 +1552,7 @@ void Viewer::draw() break; case CELL: // show the tetrahedron that contains the point // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( 10, 20, tr("Show the tetrahedron containing the point"), fontPrompt ); drawText( 10, 40, tr("(Only finite facets are drawn)"), fontPrompt ); // Highlight the next-to-insert vertex @@ -1573,7 +1573,7 @@ void Viewer::draw() break; case CONFLICT: // show the conflict region // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( 10, 20, tr("Show the conflict region"), fontPrompt ); // Highlight the next-to-insert vertex rendering_program_spheres.bind(); @@ -1610,7 +1610,7 @@ void Viewer::draw() } if( m_curMode == INSERT_V ) { // Show prompt messages - ::glColor3d(0,0,0); + glColor3d(0,0,0); drawText( width()-200, 20, tr("Shift+Left: Insert a vertex"), fontPrompt ); drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt ); @@ -1680,35 +1680,35 @@ void Viewer::drawWithNames() for(int i=0; im_vhArray.size(); ++i) { // push a name for each point onto the name stack // note: it can NOT be used between glBegin and glEnd - ::glPushName( i ); + glPushName( i ); // draw the point - ::glBegin(GL_POINTS); + glBegin(GL_POINTS); Point_3& p = m_pScene->m_vhArray.at(i)->point(); - ::glVertex3f(p.x(), p.y(), p.z()); - ::glEnd(); + glVertex3f(p.x(), p.y(), p.z()); + glEnd(); // pop one name off the top of the name stack - ::glPopName(); + glPopName(); }//end-for-points // push a name for the newly inserted point if( m_curMode == INSERT_PT && m_hasNewPt ) { - ::glPushName( ::GLuint(-1) ); - ::glBegin(GL_POINTS); - ::glVertex3f(m_newPt.x(), m_newPt.y(), m_newPt.z()); - ::glEnd(); - ::glPopName(); + glPushName( GLuint(-1) ); + glBegin(GL_POINTS); + glVertex3f(m_newPt.x(), m_newPt.y(), m_newPt.z()); + glEnd(); + glPopName(); }//end-if-newPt } void Viewer::endSelection(const QPoint& /*point*/) { // flush GL buffers - ::glFlush(); + glFlush(); // reset GL_RENDER mode (was GL_SELECT) and get the number of selected points - size_t nSel = ::glRenderMode(GL_RENDER); + size_t nSel = glRenderMode(GL_RENDER); /* No selection */ if( nSel <= 0 ) { @@ -1722,7 +1722,7 @@ void Viewer::endSelection(const QPoint& /*point*/) /* Check whether the new point is clicked on */ else if( m_curMode == INSERT_PT ) { - if( m_hasNewPt && (selectBuffer())[3] == ::GLuint(-1) ) + if( m_hasNewPt && (selectBuffer())[3] == GLuint(-1) ) m_isMoving = true; }//end-if-inspt diff --git a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt index 32eebdcbae2..c9673ba28b7 100644 --- a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt @@ -1,29 +1,11 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - - project( Triangulation_3_Examples ) -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 2.8.12) find_package(CGAL QUIET) if ( CGAL_FOUND ) - - include( ${CGAL_USE_FILE} ) - - find_package( TBB QUIET ) - - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - - include( CGAL_CreateSingleSourceCGALProgram ) - - include_directories (BEFORE "../../include") - create_single_source_cgal_program( "adding_handles_3.cpp" ) create_single_source_cgal_program( "color.cpp" ) create_single_source_cgal_program( "copy_triangulation_3.cpp" ) @@ -33,14 +15,26 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "info_insert_with_pair_iterator_regular.cpp" ) create_single_source_cgal_program( "info_insert_with_transform_iterator.cpp" ) create_single_source_cgal_program( "info_insert_with_zip_iterator.cpp" ) - create_single_source_cgal_program( "parallel_insertion_and_removal_in_regular_3.cpp" ) - create_single_source_cgal_program( "parallel_insertion_in_delaunay_3.cpp" ) create_single_source_cgal_program( "regular_3.cpp" ) create_single_source_cgal_program( "regular_with_info_3.cpp" ) - create_single_source_cgal_program( "sequential_parallel.cpp" ) create_single_source_cgal_program( "simple_triangulation_3.cpp" ) create_single_source_cgal_program( "simplex.cpp" ) + find_package( TBB QUIET ) + + if( TBB_FOUND ) + include( CGAL_target_use_TBB ) + + create_single_source_cgal_program( "parallel_insertion_and_removal_in_regular_3.cpp" ) + create_single_source_cgal_program( "parallel_insertion_in_delaunay_3.cpp" ) + create_single_source_cgal_program( "sequential_parallel.cpp" ) + CGAL_target_use_TBB( parallel_insertion_and_removal_in_regular_3 ) + CGAL_target_use_TBB( parallel_insertion_in_delaunay_3 ) + CGAL_target_use_TBB( sequential_parallel ) + else() + message(STATUS "NOTICE: a few examples require TBB and will not be compiled.") + endif() + else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index b2fefe5017c..26494983c37 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -15,11 +15,6 @@ if ( CGAL_FOUND ) find_package( TBB QUIET ) - if( TBB_FOUND ) - include(${TBB_USE_FILE}) - list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES}) - endif() - include( CGAL_CreateSingleSourceCGALProgram ) include_directories (BEFORE "../../include") @@ -40,6 +35,15 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_static_filters.cpp" ) create_single_source_cgal_program( "test_triangulation_3.cpp" ) + if(TBB_FOUND) + foreach(target + test_delaunay_3 + test_regular_3 + test_regular_insert_range_with_info) + CGAL_target_use_TBB(${target}) + endforeach() + endif() + if(BUILD_TESTING) set_tests_properties( execution___of__test_delaunay_hierarchy_3