Successfully upgraded to Qt5.

This commit is contained in:
Maxime Gimeno 2015-04-01 13:57:23 +02:00
parent 2e47961cce
commit fdf425b21e
1 changed files with 18 additions and 13 deletions

View File

@ -2,6 +2,11 @@ set ( prj Surface_mesher )
project ( ${prj} )
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
@ -18,7 +23,7 @@ foreach(INC_DIR ${PACKAGE_ROOT}/include ${PACKAGE_ROOT}/../Mesh_2/include ${PACK
include_directories (BEFORE ${INC_DIR})
endif()
endforeach()
foreach(LIB_DIR ${PACKAGE_ROOT}/../CGAL_ImageIO/src/CGAL_ImageIO ${PACKAGE_ROOT}/../GraphicsView/src/CGALQt4)
foreach(LIB_DIR ${PACKAGE_ROOT}/../CGAL_ImageIO/src/CGAL_ImageIO ${PACKAGE_ROOT}/../GraphicsView/src/CGALQt5)
if (EXISTS ${LIB_DIR})
link_directories (${LIB_DIR})
endif()
@ -26,23 +31,22 @@ endforeach()
include_directories( ./ )
# QGLViwer needs Qt4 configured with QtOpenGL and QtXml support
# 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 Qt4)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND)
find_package(CGAL COMPONENTS ImageIO Qt5)
if ( CGAL_FOUND AND CGAL_Qt5_FOUND)
include( ${CGAL_USE_FILE} )
find_package(Qt4 )
find_package(Qt5 COMPONENTS OpenGL Xml )
find_package(QGLViewer )
find_package(OpenGL )
if ( QGLVIEWER_FOUND )
include( ${QT_USE_FILE})
include_directories( ${QGLVIEWER_INCLUDE_DIR} )
add_definitions(${QGLVIEWER_DEFINITIONS})
@ -77,17 +81,18 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND)
add_definitions(-DCGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE)
endif()
qt4_automoc( ${sources} )
qt4_generate_moc( "surface.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_surface.cpp" )
qt5_generate_moc( "surface.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_surface.cpp" )
set( sources ${sources} moc_surface.cpp)
qt4_wrap_ui( uis ui/values_list.ui ui/mainwindow.ui ui/optionsdialog.ui ui/raw_image.ui )
qt5_wrap_ui( uis ui/values_list.ui ui/mainwindow.ui ui/optionsdialog.ui ui/raw_image.ui )
qt4_add_resources( qrc_sources values_list.qrc surface_mesher.qrc )
qt5_add_resources( qrc_sources values_list.qrc surface_mesher.qrc )
add_executable ( ${prj} ${sources} ${uis} ${qrc_sources} )
qt5_use_modules(${prj} OpenGL Xml )
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${prj} )
@ -99,10 +104,10 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND)
else( QGLVIEWER_FOUND)
message(STATUS "NOTICE: This demo needs libQGLViewer, and will not be compiled.")
endif( QGLVIEWER_FOUND)
else(CGAL_FOUND AND CGAL_Qt4_FOUND)
else(CGAL_FOUND AND CGAL_Qt5_FOUND)
if(RUNNING_CGAL_AUTO_TEST)
# Just to avoid a warning from CMake if that variable is set on the command line...
endif()
message(STATUS "NOTICE: This demo needs Qt4, and will not be compiled.")
endif(CGAL_FOUND AND CGAL_Qt4_FOUND)
message(STATUS "NOTICE: This demo needs Qt5, and will not be compiled.")
endif(CGAL_FOUND AND CGAL_Qt5_FOUND)