Commit 518492e3 authored by Sylvain Thery's avatar Sylvain Thery

simplification CMakeLists

parent b1665fe5
...@@ -12,11 +12,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) ...@@ -12,11 +12,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
qt_wrap_cpp( frame_manip_moc frame_manip.h ) qt_wrap_cpp( frame_manip_moc frame_manip.h )
add_executable( frame_manip frame_manip.cpp ${frame_manip_moc} ) add_executable( frame_manip frame_manip.cpp ${frame_manip_moc} )
target_link_libraries( frame_manip ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} ) target_link_libraries( frame_manip ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
#need to define that we use Qt (only once per cmake directory!)
qt_use_modules(frame_manip Gui OpenGL Xml Svg) qt_use_cgogn_modules(frame_manip)
#IF(${CGoGN_DESIRED_QT_VERSION} STREQUAL "5")
# qt_use_modules(frame_manip Widgets)
#ENDIF()
qt_wrap_cpp( texturesExample_moc texturesExample.h ) qt_wrap_cpp( texturesExample_moc texturesExample.h )
add_executable( texturesExample texturesExample.cpp ${texturesExample_moc} ) add_executable( texturesExample texturesExample.cpp ${texturesExample_moc} )
......
...@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8) ...@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8)
project(SandBox) project(SandBox)
add_executable(multi_att multi_att.cpp) add_executable(multi_att multi_att.cpp)
target_link_libraries(multi_att ${CGoGN_LIBS} ${CGoGN_EXT_LIBS}) target_link_libraries(multi_att ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
...@@ -17,7 +15,7 @@ IF (CGoGN_WITH_QT) ...@@ -17,7 +15,7 @@ IF (CGoGN_WITH_QT)
qt_wrap_cpp(tilings_moc tilings.h) qt_wrap_cpp(tilings_moc tilings.h)
add_executable(tilings tilings.cpp ${tilings_moc}) add_executable(tilings tilings.cpp ${tilings_moc})
target_link_libraries(tilings ${CGoGN_LIBS} ${CGoGN_EXT_LIBS}) target_link_libraries(tilings ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
qt_use_modules(tilings Gui OpenGL Xml Svg) qt_use_cgogn_modules(tilings)
qt_wrap_ui( test_traversor2_ui test_traversor2.ui ) qt_wrap_ui( test_traversor2_ui test_traversor2.ui )
qt_wrap_cpp(test_traversor2_moc test_traversor2.h) qt_wrap_cpp(test_traversor2_moc test_traversor2.h)
......
...@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 2.8) ...@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 2.8)
project(Tutos) project(Tutos)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")
endif()
#define exec to compile #define exec to compile
IF (CGoGN_WITH_QT) IF (CGoGN_WITH_QT)
...@@ -17,7 +11,7 @@ IF (CGoGN_WITH_QT) ...@@ -17,7 +11,7 @@ IF (CGoGN_WITH_QT)
add_executable( tuto1 tuto1.cpp ${tuto1_moc}) add_executable( tuto1 tuto1.cpp ${tuto1_moc})
target_link_libraries( tuto1 target_link_libraries( tuto1
${CGoGN_LIBS} ${CGoGN_EXT_LIBS} ) ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
qt_use_modules(tuto1 Gui OpenGL Xml Svg) qt_use_cgogn_modules(tuto1)
qt_wrap_ui( tuto2_ui tuto2.ui ) qt_wrap_ui( tuto2_ui tuto2.ui )
qt_wrap_cpp(tuto2_moc tuto2.h) qt_wrap_cpp(tuto2_moc tuto2.h)
......
...@@ -18,7 +18,7 @@ INCLUDE(${CGoGN_ROOT_DIR}/cmake_modules/functions.cmake) ...@@ -18,7 +18,7 @@ INCLUDE(${CGoGN_ROOT_DIR}/cmake_modules/functions.cmake)
SET ( CGoGN_WITH_ASSIMP OFF CACHE BOOL "build CGoGN with Assimp" ) SET ( CGoGN_WITH_ASSIMP OFF CACHE BOOL "build CGoGN with Assimp" )
SET ( CGoGN_WITH_ZINRI OFF CACHE BOOL "build CGoGN with Zinri lib" ) SET ( CGoGN_WITH_ZINRI OFF CACHE BOOL "build CGoGN with Zinri lib" )
SET ( CGoGN_WITH_QT ON CACHE BOOL "build CGoGN with Qt lib" ) SET ( CGoGN_WITH_QT ON CACHE BOOL "build CGoGN with Qt lib" )
SET ( CGoGN_DESIRED_QT_VERSION "4" CACHE STRING "4: QT4/ 5 not yet implemented" ) SET ( CGoGN_DESIRED_QT_VERSION "4" CACHE STRING "4: QT4/5" )
SET ( CGoGN_WITH_GLEWMX OFF CACHE BOOL "use multi-contex GLEW (for VRJuggler)" ) SET ( CGoGN_WITH_GLEWMX OFF CACHE BOOL "use multi-contex GLEW (for VRJuggler)" )
SET ( CGoGN_USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not work on mac)" ) SET ( CGoGN_USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not work on mac)" )
...@@ -32,7 +32,7 @@ SET ( CGoGN_ONELIB OFF CACHE BOOL "build CGoGN in one lib" ) ...@@ -32,7 +32,7 @@ SET ( CGoGN_ONELIB OFF CACHE BOOL "build CGoGN in one lib" )
IF (WIN32) IF (WIN32)
SET ( CMAKE_CONFIGURATION_TYPES Release Debug) SET ( CMAKE_CONFIGURATION_TYPES Release Debug)
SET ( CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE) SET ( CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
SET ( CGoGN_WITH_QTCREATOR OFF CACHE BOOL "use QtCreator to compile" ) SET ( CGoGN_WITH_QTCREATOR OFF CACHE BOOL "use QtCreator to compile (Experimental" )
ENDIF () ENDIF ()
SET ( BUILD_SHARED_LIBS ON CACHE BOOL "if used all library are build as shared type (.so/.dylib/.dll)" ) SET ( BUILD_SHARED_LIBS ON CACHE BOOL "if used all library are build as shared type (.so/.dylib/.dll)" )
...@@ -71,20 +71,12 @@ IF (CGoGN_WITH_QT) ...@@ -71,20 +71,12 @@ IF (CGoGN_WITH_QT)
ELSE () ELSE ()
FIND_PACKAGE(DevIL REQUIRED) FIND_PACKAGE(DevIL REQUIRED)
ENDIF() ENDIF()
IF (NOT WIN32)
FIND_PACKAGE(SuiteSparse REQUIRED) IF (WIN32)
ELSE()
set(SUITESPARSE_SUITESPARSECONFIG_INCLUDE_DIR ${CGoGN_ROOT_DIR}/windows_dependencies/include) set(SUITESPARSE_SUITESPARSECONFIG_INCLUDE_DIR ${CGoGN_ROOT_DIR}/windows_dependencies/include)
set(SUITESPARSE_USE_LAPACK_BLAS ON) set(SUITESPARSE_USE_LAPACK_BLAS ON)
find_package(SuiteSparse QUIET NO_MODULE)
if(NOT SUITESPARSE_FOUND)
set(SUITESPARSE_VERBOSE ON)
find_package(SuiteSparse REQUIRED) # 2nd: Use FindSuiteSparse.cmake module
endif()
ENDIF() ENDIF()
MESSAGE (STATUS ${SUITESPARSE_LIBRARIES}) FIND_PACKAGE(SuiteSparse REQUIRED)
MESSAGE (STATUS ${SUITESPARSE_INCLUDE_DIRS})
# #
# ThirdParty # ThirdParty
...@@ -247,7 +239,6 @@ include_directories( ...@@ -247,7 +239,6 @@ include_directories(
${CGoGN_SRC_DIR}/include ${CGoGN_SRC_DIR}/include
${CGoGN_EXT_INCLUDES} ) ${CGoGN_EXT_INCLUDES} )
# #
# save some infos for schnapps and apps # save some infos for schnapps and apps
# #
...@@ -292,34 +283,7 @@ add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps) ...@@ -292,34 +283,7 @@ add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
# #
# Add custom clean targets for cleaning without cleaning dependencies # Add custom clean targets for cleaning without cleaning dependencies
# #
if (WIN32) if (NOT WIN32)
# add_custom_target(clean_cgogn
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# add_custom_command(TARGET clean_cgogn PRE_BUILD
# COMMAND del /q CCoGN
# COMMAND cmake ..
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
# COMMENT "cleaning CGoGN libs")
#
# add_custom_target(clean_apps
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# add_custom_command(TARGET clean_apps PRE_BUILD
# COMMAND del /q Apps
# COMMAND cmake ..
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
# COMMENT "cleaning Apps")
#
# add_custom_target(clean_cgogn_apps
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# add_custom_command(TARGET clean_cgogn_apps PRE_BUILD
# COMMAND del /q CGoGN
# COMMAND del /q Apps
# COMMAND cmake ..
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
# COMMENT "cleaning Apps")
ELSE()
add_custom_target(clean_cgogn add_custom_target(clean_cgogn
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command(TARGET clean_cgogn PRE_BUILD add_custom_command(TARGET clean_cgogn PRE_BUILD
......
...@@ -9,18 +9,14 @@ ...@@ -9,18 +9,14 @@
# cmake_minimum_required(VERSION 2.8) # cmake_minimum_required(VERSION 2.8)
# project(Pipo) # project(Pipo)
# #
# set(QT_USE_QTCORE TRUE) # for Qt # LoadQtPackage()
# set(QT_USE_QTOPENGL TRUE) # for Qt & OpenGL (!!)
# set(QT_USE_QTXML TRUE) # for QGLViewer
# find_package(Qt REQUIRED)
# include(${QT_USE_FILE})
# #
# set(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir") # set(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir")
# include(${CGoGN_ROOT_DIR}/apps_cmake.txt) # include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
# #
# include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) # include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
# QT4_WRAP_UI( pipo_ui pipo.ui ) # qt_wrap_ui( pipo_ui pipo.ui )
# QT4_WRAP_CPP( pipo_moc pipo.h ) # qt_wrap_cpp( pipo_moc pipo.h )
# add_executable( pipo pipo.cpp ${pipo_ui} ${pipo_moc} ) # add_executable( pipo pipo.cpp ${pipo_ui} ${pipo_moc} )
# target_link_libraries( pipo ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} ) # target_link_libraries( pipo ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
# #
...@@ -80,7 +76,14 @@ ELSE() ...@@ -80,7 +76,14 @@ ELSE()
SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE} ) SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE} )
ENDIF() ENDIF()
# Qt version from CGoGN
file(READ ${CGoGN_SRC_DIR}/include/cgogn_qt.h CGoGN_DESIRED_QT_VERSION)
ADD_DEFINITIONS("-DCGOGN_QT_DESIRED_VERSION=${CGoGN_DESIRED_QT_VERSION}")
IF(CGoGN_DESIRED_QT_VERSION STREQUAL 5)
include(${CGoGN_ROOT_DIR}/cmake_modules/Qt_5x.cmake)
ELSE()
include(${CGoGN_ROOT_DIR}/cmake_modules/Qt_4x.cmake)
ENDIF()
# CGoGN compiled in one or several libs # CGoGN compiled in one or several libs
file(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_onelib.h ONELIB_STR) file(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_onelib.h ONELIB_STR)
......
...@@ -45,6 +45,11 @@ macro(qt_use_modules _target _link_type) ...@@ -45,6 +45,11 @@ macro(qt_use_modules _target _link_type)
endif() endif()
endmacro() endmacro()
# macro that include module need by cgogn
macro(qt_use_cgogn_modules _target )
qt_use_modules(${_target} Gui OpenGL Xml Svg)
endmacro()
# aliases to make it work across Qt4/Qt5 # aliases to make it work across Qt4/Qt5
macro(qt_add_resources) macro(qt_add_resources)
qt4_add_resources(${ARGN}) qt4_add_resources(${ARGN})
......
...@@ -4,11 +4,16 @@ find_package(Qt5Core REQUIRED) ...@@ -4,11 +4,16 @@ find_package(Qt5Core REQUIRED)
#Qt5Widgets required for qt5_wrap_ui #Qt5Widgets required for qt5_wrap_ui
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
# aliases # aliases (module Widgets included by default)
macro(qt_use_modules) macro(qt_use_modules)
qt5_use_modules(${ARGN} Widgets) qt5_use_modules(${ARGN} Widgets)
endmacro() endmacro()
# macro that include module need by cgogn
macro(qt_use_cgogn_modules)
qt5_use_modules(${ARGN} Gui OpenGL Xml Svg Widgets)
endmacro()
macro(qt_wrap_cpp) macro(qt_wrap_cpp)
qt5_wrap_cpp(${ARGN}) qt5_wrap_cpp(${ARGN})
endmacro() endmacro()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment