mirror of https://github.com/CGAL/cgal
Update CMakeLists.txt to allow drawing of lcc example
This commit is contained in:
parent
6d01411003
commit
c7a4236281
|
|
@ -1,29 +0,0 @@
|
||||||
# This file must be included in your CMakeLists.txt to use the basic viewer
|
|
||||||
# You need to link the libraries in your executable by using
|
|
||||||
# TARGET_LINK_LIBRARIES( myexec ${BASIC_VIEWER_LIBRARIES})
|
|
||||||
|
|
||||||
if ( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND)
|
|
||||||
message(STATUS "NOTICE: Libraries for basic viewer not found "
|
|
||||||
"(CGAL, Qt5, QGLViewer).")
|
|
||||||
endif( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND)
|
|
||||||
|
|
||||||
include( ${CGAL_USE_FILE} )
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
||||||
|
|
||||||
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS OpenGL Xml)
|
|
||||||
find_package(QGLViewer REQUIRED)
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
add_definitions(${QT_DEFINITIONS})
|
|
||||||
add_definitions(-DQT_NO_KEYWORDS)
|
|
||||||
|
|
||||||
set (BASIC_VIEWER_LIBRARIES ${QT_LIBRARIES} )
|
|
||||||
|
|
||||||
set(BASIC_VIEWER_MODULES Xml OpenGL)
|
|
||||||
|
|
||||||
ADD_DEFINITIONS("-DCGAL_USE_BASIC_VIEWER")
|
|
||||||
message(STATUS "Libraries for lcc_viewer found. You need to link them "
|
|
||||||
"in your executable by using "
|
|
||||||
"TARGET_LINK_LIBRARIES( myexec \${BASIC_VIEWER_LIBRARIES})")
|
|
||||||
|
|
||||||
set(USE_BASIC_VIEWER true)
|
|
||||||
|
|
@ -9,13 +9,8 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053)
|
||||||
cmake_policy(SET CMP0053 OLD)
|
cmake_policy(SET CMP0053 OLD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If you want to visualize a linear cell complex, you can use the following viewer
|
|
||||||
# based on qt. Just uncomment the following line, plus the line find_package(CGALBasicViewer) below
|
|
||||||
find_package(CGAL COMPONENTS Qt5)
|
find_package(CGAL COMPONENTS Qt5)
|
||||||
|
|
||||||
# If you don't want to visualize, use the following line (otherwise comment it)
|
|
||||||
# find_package(CGAL QUIET)
|
|
||||||
|
|
||||||
# For Gprof.
|
# For Gprof.
|
||||||
# ADD_DEFINITIONS("-pg")
|
# ADD_DEFINITIONS("-pg")
|
||||||
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
||||||
|
|
@ -25,7 +20,6 @@ find_package(CGAL COMPONENTS Qt5)
|
||||||
|
|
||||||
if ( CGAL_FOUND )
|
if ( CGAL_FOUND )
|
||||||
include(${CGAL_USE_FILE})
|
include(${CGAL_USE_FILE})
|
||||||
find_package(CGALBasicViewer)
|
|
||||||
|
|
||||||
include( CGAL_CreateSingleSourceCGALProgram )
|
include( CGAL_CreateSingleSourceCGALProgram )
|
||||||
include_directories(BEFORE ../../include)
|
include_directories(BEFORE ../../include)
|
||||||
|
|
@ -42,10 +36,22 @@ if ( CGAL_FOUND )
|
||||||
create_single_source_cgal_program("linear_cell_complex_3_operations.cpp")
|
create_single_source_cgal_program("linear_cell_complex_3_operations.cpp")
|
||||||
|
|
||||||
create_single_source_cgal_program("display_linear_cell_complex.cpp")
|
create_single_source_cgal_program("display_linear_cell_complex.cpp")
|
||||||
if (USE_BASIC_VIEWER)
|
if(CGAL_Qt5_FOUND)
|
||||||
target_link_libraries(display_linear_cell_complex ${BASIC_VIEWER_LIBRARIES})
|
find_package(Qt5 REQUIRED COMPONENTS OpenGL Xml)
|
||||||
qt5_use_modules(display_linear_cell_complex ${BASIC_VIEWER_MODULES})
|
find_package(QGLViewer REQUIRED)
|
||||||
endif(USE_BASIC_VIEWER)
|
find_package(OpenGL REQUIRED)
|
||||||
|
add_definitions(${QT_DEFINITIONS})
|
||||||
|
add_definitions(-DQT_NO_KEYWORDS)
|
||||||
|
include_directories( ${QGLVIEWER_INCLUDE_DIR} )
|
||||||
|
add_definitions(${QGLVIEWER_DEFINITIONS})
|
||||||
|
|
||||||
|
target_link_libraries(display_linear_cell_complex CGAL::CGAL_Qt5
|
||||||
|
${QT_LIBRARIES}
|
||||||
|
${QGLVIEWER_LIBRARIES}
|
||||||
|
${OPENGL_gl_LIBRARY})
|
||||||
|
target_compile_definitions(display_linear_cell_complex PRIVATE CGAL_USE_BASIC_VIEWER)
|
||||||
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
||||||
message(STATUS "This program requires the CGAL library, "
|
message(STATUS "This program requires the CGAL library, "
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,12 @@ void draw(const LCC& alcc,
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class LCC>
|
||||||
|
void draw(const LCC& alcc,
|
||||||
|
const char* title="LCC Viewer",
|
||||||
|
bool nofill=false)
|
||||||
|
{ return draw<LCC, DefaultColorFunctorLCC>(alcc, title, nofill); }
|
||||||
|
|
||||||
} // End namespace CGAL
|
} // End namespace CGAL
|
||||||
|
|
||||||
#else // CGAL_USE_BASIC_VIEWER
|
#else // CGAL_USE_BASIC_VIEWER
|
||||||
|
|
@ -219,9 +225,18 @@ namespace CGAL
|
||||||
|
|
||||||
template<class LCC, class ColorFunctor>
|
template<class LCC, class ColorFunctor>
|
||||||
void draw(const LCC&,
|
void draw(const LCC&,
|
||||||
const char*="LCC Viewer",
|
const char* ="LCC Viewer",
|
||||||
bool=false,
|
bool=false,
|
||||||
const ColorFunctor&=ColorFunctor())
|
const ColorFunctor& =ColorFunctor())
|
||||||
|
{
|
||||||
|
std::cerr<<"Impossible to draw a Linear_cell_complex because CGAL_USE_BASIC_VIEWER is not defined."
|
||||||
|
<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class LCC>
|
||||||
|
void draw(const LCC&,
|
||||||
|
const char* ="LCC Viewer",
|
||||||
|
bool=false)
|
||||||
{
|
{
|
||||||
std::cerr<<"Impossible to draw a Linear_cell_complex because CGAL_USE_BASIC_VIEWER is not defined."
|
std::cerr<<"Impossible to draw a Linear_cell_complex because CGAL_USE_BASIC_VIEWER is not defined."
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
|
|
@ -231,15 +246,4 @@ void draw(const LCC&,
|
||||||
|
|
||||||
#endif // CGAL_USE_BASIC_VIEWER
|
#endif // CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
namespace CGAL
|
|
||||||
{
|
|
||||||
|
|
||||||
template<class LCC>
|
|
||||||
void draw(const LCC& alcc,
|
|
||||||
const char* title="LCC Viewer",
|
|
||||||
bool nofill=false)
|
|
||||||
{ return draw<LCC, DefaultColorFunctorLCC>(alcc, title, nofill); }
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
|
||||||
|
|
||||||
#endif // CGAL_LCC_VIEWER_QT_H
|
#endif // CGAL_LCC_VIEWER_QT_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue