From 482560eb2d0d6092ddb818c84fbf0b8b97f8c6cc Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 2 Oct 2008 10:52:27 +0000 Subject: [PATCH] Conditional compilation, for that huge demo! --- Polyhedron/demo/Polyhedron/CMakeLists.txt | 197 +++++++++++++--------- 1 file changed, 119 insertions(+), 78 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index d376535ce19..a39204524d8 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -22,100 +22,141 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../../GraphicsView/src/CGALQt4) link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../GraphicsView/src/CGALQt4) endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../../GraphicsView/src/CGALQt4) -find_package(CGAL REQUIRED Qt4) +# Find CGAL and CGAL Qt4 +find_package(CGAL QUIET COMPONENTS Qt4) include( ${CGAL_USE_FILE} ) -find_package(Boost 1.34.1 COMPONENTS thread REQUIRED) +# Find Boost and Boost.Thread +find_package(Boost 1.34.1 QUIET COMPONENTS thread) +# Find Qt4 itself set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +find_package(Qt4 QUIET) +# Find OpenGL +find_package(OpenGL QUIET) + +# Find QGLViewer +if(QT_FOUND) + include(${QT_USE_FILE}) + find_package(QGLViewer QUIET ) +endif(QT_FOUND) + +# Find TAUCS (optionnal) find_package(TAUCS QUIET) -if(TAUCS_FOUND) - include_directories( ${TAUCS_INCLUDE_DIR} ) - add_definitions(-DCGAL_TAUCS_ENABLED) -else(TAUCS_FOUND) - message(STATUS "warning: TAUCS is not found. parametrization will not be available.") -endif(TAUCS_FOUND) -find_package(Qt4 REQUIRED) +if(CGAL_Qt4_FOUND AND Boost_FOUND AND Boost_THREAD_FOUND AND QT_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) -include(${QT_USE_FILE}) - -find_package(OpenGL REQUIRED) - -find_package(QGLViewer REQUIRED ) -include_directories( ${QGLVIEWER_INCLUDE_DIR} ) -qt4_wrap_ui( UI_FILES MainWindow.ui ) - -include(AddFileDependencies) - -qt4_generate_moc( MainWindow.h MainWindow_moc.cpp ) -add_file_dependencies( MainWindow_moc.cpp MainWindow.h ) - -qt4_generate_moc( Viewer.h Viewer_moc.cpp ) -add_file_dependencies( Viewer_moc.cpp Viewer.h ) - -qt4_generate_moc( Scene.h Scene_moc.cpp ) -add_file_dependencies( Scene_moc.cpp Scene.h ) - -qt4_add_resources ( RESOURCE_FILES Polyhedron_3.qrc ) - -if(ENABLE_FORWARD_DECL) - add_definitions(-DUSE_FORWARD_DECL) - add_executable ( Polyhedron_3 MainWindow.cpp - Polyhedron_3.cpp - Viewer.cpp - Scene.cpp - Scene_nef_polyhedron_operations.cpp - Scene_polyhedron_operations.cpp - Scene_nef_and_polyhedron_operations.cpp - Scene_rendering.cpp - Scene_nef_rendering.cpp - MainWindow_boolean_operations.cpp - MainWindow_convex_hull.cpp - MainWindow_curvature_estimation.cpp - MainWindow_inside_out.cpp - MainWindow_kernel.cpp - MainWindow_pca.cpp - MainWindow_remeshing.cpp - MainWindow_self_intersection.cpp - MainWindow_simplify.cpp - MainWindow_subdivision_methods.cpp - MainWindow_parameterization.cpp - MainWindow_moc.cpp - Scene_moc.cpp - Viewer_moc.cpp - texture.cpp - ${UI_FILES} ${RESOURCE_FILES} ) if(TAUCS_FOUND) - add_executable( Polyhedron_3 Scene_tex_rendering.cpp Scene_tex_polyhedron_operations.cpp ) + include_directories( ${TAUCS_INCLUDE_DIR} ) + add_definitions(-DCGAL_TAUCS_ENABLED) + else(TAUCS_FOUND) + message(STATUS "warning: TAUCS is not found. parametrization will not be available.") endif(TAUCS_FOUND) -else(ENABLE_FORWARD_DECL) - add_file_dependencies( Polyhedron_3.cpp MainWindow_moc.cpp Scene_moc.cpp Viewer_moc.cpp ) - add_executable ( Polyhedron_3 Polyhedron_3.cpp ${UI_FILES} ${RESOURCE_FILES} ) -endif(ENABLE_FORWARD_DECL) + + qt4_wrap_ui( UI_FILES MainWindow.ui ) + + include(AddFileDependencies) + + qt4_generate_moc( MainWindow.h MainWindow_moc.cpp ) + add_file_dependencies( MainWindow_moc.cpp MainWindow.h ) + + qt4_generate_moc( Viewer.h Viewer_moc.cpp ) + add_file_dependencies( Viewer_moc.cpp Viewer.h ) + + qt4_generate_moc( Scene.h Scene_moc.cpp ) + add_file_dependencies( Scene_moc.cpp Scene.h ) + + qt4_add_resources ( RESOURCE_FILES Polyhedron_3.qrc ) + + if(ENABLE_FORWARD_DECL) + add_definitions(-DUSE_FORWARD_DECL) + add_executable ( Polyhedron_3 MainWindow.cpp + Polyhedron_3.cpp + Viewer.cpp + Scene.cpp + Scene_nef_polyhedron_operations.cpp + Scene_polyhedron_operations.cpp + Scene_nef_and_polyhedron_operations.cpp + Scene_rendering.cpp + Scene_nef_rendering.cpp + MainWindow_boolean_operations.cpp + MainWindow_convex_hull.cpp + MainWindow_curvature_estimation.cpp + MainWindow_inside_out.cpp + MainWindow_kernel.cpp + MainWindow_pca.cpp + MainWindow_remeshing.cpp + MainWindow_self_intersection.cpp + MainWindow_simplify.cpp + MainWindow_subdivision_methods.cpp + MainWindow_parameterization.cpp + MainWindow_moc.cpp + Scene_moc.cpp + Viewer_moc.cpp + texture.cpp + ${UI_FILES} ${RESOURCE_FILES} ) + if(TAUCS_FOUND) + add_executable( Polyhedron_3 Scene_tex_rendering.cpp Scene_tex_polyhedron_operations.cpp ) + endif(TAUCS_FOUND) + else(ENABLE_FORWARD_DECL) + add_file_dependencies( Polyhedron_3.cpp MainWindow_moc.cpp Scene_moc.cpp Viewer_moc.cpp ) + add_executable ( Polyhedron_3 Polyhedron_3.cpp ${UI_FILES} ${RESOURCE_FILES} ) + endif(ENABLE_FORWARD_DECL) -# Link with Qt libraries -target_link_libraries( Polyhedron_3 ${QT_LIBRARIES} ) + # Link with Qt libraries + target_link_libraries( Polyhedron_3 ${QT_LIBRARIES} ) -# Link with CGAL -target_link_libraries( Polyhedron_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + # Link with CGAL + target_link_libraries( Polyhedron_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) -# Link with libQGLViewer, OpenGL -target_link_libraries( Polyhedron_3 ${QGLVIEWER_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ) + # Link with libQGLViewer, OpenGL + target_link_libraries( Polyhedron_3 ${QGLVIEWER_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ) -if(TAUCS_FOUND) -# Link with TAUCS - link_directories(Polyhedron_3 ${TAUCS_LIBRARIES_DIR}) - target_link_libraries(Polyhedron_3 ${TAUCS_LIBRARIES}) -endif(TAUCS_FOUND) + if(TAUCS_FOUND) + # Link with TAUCS + link_directories(Polyhedron_3 ${TAUCS_LIBRARIES_DIR}) + target_link_libraries(Polyhedron_3 ${TAUCS_LIBRARIES}) + endif(TAUCS_FOUND) -# Blas and Lapack, under Linux -if( NOT AUTO_LINK_ENABLED ) - add_definitions( -DCGAL_USE_F2C ) - target_link_libraries( Polyhedron_3 lapack blas ) -endif() + # Blas and Lapack, under Linux + if( NOT AUTO_LINK_ENABLED ) + add_definitions( -DCGAL_USE_F2C ) + target_link_libraries( Polyhedron_3 lapack blas ) + endif() + +else (CGAL_Qt4_FOUND AND Boost_FOUND AND Boost_THREAD_FOUND AND QT_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) + + set(POLYHEDRON_MISSING_DEPS "") + + if(NOT CGAL_Qt4_FOUND) + set(POLYHEDRON_MISSING_DEPS "the CGAL Qt4 library, ${POLYHEDRON_MISSING_DEPS}") + endif() + + if(NOT Boost_THREAD_FOUND) + set(POLYHEDRON_MISSING_DEPS "Boost Thread, ${POLYHEDRON_MISSING_DEPS}") + endif() + + if(NOT Boost_FOUND) + set(POLYHEDRON_MISSING_DEPS "Boost, ${POLYHEDRON_MISSING_DEPS}") + endif() + + if(NOT QT_FOUND) + set(POLYHEDRON_MISSING_DEPS "Qt4, ${POLYHEDRON_MISSING_DEPS}") + endif() + + if(NOT OPENGL_FOUND) + set(POLYHEDRON_MISSING_DEPS "OpenGL, ${POLYHEDRON_MISSING_DEPS}") + endif() + + if(NOT QGLVIEWER_FOUND) + set(POLYHEDRON_MISSING_DEPS "QGLViewer, ${POLYHEDRON_MISSING_DEPS}") + endif() + + message(STATUS "NOTICE: This demo requires ${POLYHEDRON_MISSING_DEPS}and will not be compiled.") + +endif (CGAL_Qt4_FOUND AND Boost_FOUND AND Boost_THREAD_FOUND AND QT_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)