CMakeLists.txt 5.51 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3 4
cmake_minimum_required(VERSION 2.8)

project(SCHNApps)

Sylvain Thery's avatar
Sylvain Thery committed
5 6 7 8 9 10 11
IF (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug|Release"))
	IF (${CMAKE_CURRENT_BINARY_DIR} MATCHES "(.*)Debug|(.*)debug|(.*)DEBUG")
		SET(CMAKE_BUILD_TYPE "Debug")
	ELSE()
		SET(CMAKE_BUILD_TYPE "Release")
	ENDIF()
ENDIF()
12

Sylvain Thery's avatar
Sylvain Thery committed
13
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11")
14 15 16 17

SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)

18
SET( SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
19 20
SET( USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not work on mac)" )

21

22 23

find_package(OpenGL REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
24
find_package(Boost COMPONENTS regex system REQUIRED)
25 26 27 28 29
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
find_package(Qt4 REQUIRED)
find_package(QGLViewer REQUIRED)
30
find_package(PythonLibs 2.7 REQUIRED)
31
find_package(SuiteSparse REQUIRED)
32
#find_package(SuperLU REQUIRED)
33

34

35
SET( QT_USE_QTOPENGL TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
36
SET( QT_USE_QTXML TRUE )
37 38 39
SET( QT_USE_QTDESIGNER TRUE )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTPLUGIN TRUE )
40
SET( QT_USE_QTSVG TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
41

42 43
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
Sylvain Thery's avatar
Sylvain Thery committed
44
add_definitions(-DGLM_FORCE_RADIANS)
45

Sylvain Thery's avatar
Sylvain Thery committed
46 47
#MESSAGE HERE FOR MORE EASY READING (MESSAGE AT THE END)
MESSAGE("Build type = " ${CMAKE_BUILD_TYPE} " (for change -DCMAKE_BUILD_TYPE=Release|Debug)" )
48 49 50

file(STRINGS ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h ONELIB_STR)
IF (ONELIB_STR EQUAL 1)
Sylvain Thery's avatar
Sylvain Thery committed
51 52 53 54
	SET(CGoGN_LIBS cgogn)
ELSE()
	SET(CGoGN_LIBS topology algo container utils)
ENDIF()
55

56
IF(DEFINED ASSERTON)
57
	add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
58
ELSE(DEFINED ASSERTON)
59 60 61
	add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON)

62 63 64
IF(SLOT_DEBUG_MODE)
	add_definitions(-DSLOT_DEBUG_MODE=1)
ENDIF()
65

66 67 68 69
IF(USE_OGL_CORE_PROFILE)
	add_definitions(-DUSE_OGL_CORE_PROFILE=1)
ENDIF()

70 71 72 73 74 75 76 77 78 79 80
# define includes of external libs 
SET (EXT_INCLUDES 
	${CGoGN_ROOT_DIR}/ThirdParty/include
	${OPENGL_INCLUDE_DIR}
	${GLEW_INCLUDE_DIRS}
	${ZLIB_INCLUDE_DIRS}
	${LIBXML2_INCLUDE_DIR}
	${Boost_INCLUDE_DIRS}
	${QT_INCLUDE_DIR}
	${QGLVIEWER_INCLUDE_DIR}
	${PYTHON_INCLUDE_DIRS}
81
	${SUITESPARSE_INCLUDE_DIRS}
82
#	${SUPERLU_INCLUDE_DIRS}
83 84 85 86 87
)

# define libs for external libs
SET (EXT_LIBS 
	PythonQt
88
	nl
89 90 91 92 93 94 95 96 97
	${OPENGL_LIBRARY}
	${GLEW_LIBRARIES}
	${ZLIB_LIBRARIES}
	${LIBXML2_LIBRARIES}
	${Boost_SYSTEM_LIBRARY}
	${Boost_REGEX_LIBRARY}
	${QT_LIBRARIES}
	${QGLVIEWER_LIBRARIES}
	${PYTHON_LIBRARIES}
98
	${SUITESPARSE_LIBRARIES}
99
#	${SUPERLU_LIBRARIES}
100 101 102 103 104 105
)




# qq definition specifiques pour mac
Sylvain Thery's avatar
Sylvain Thery committed
106
#IF(APPLE)
107
# attention a changer pour chercher la bonne version automatiquement
Sylvain Thery's avatar
Sylvain Thery committed
108 109 110 111 112 113 114
#	SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "developer SDK")
#	SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
#	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
#	SET(CMAKE_OSX_ARCHITECTURES x86_64)
#ENDIF(APPLE)

if(APPLE)
Thery Sylvain's avatar
Thery Sylvain committed
115
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")	
Sylvain Thery's avatar
Sylvain Thery committed
116
	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
Sylvain Thery's avatar
Sylvain Thery committed
117
endif()
118

119 120 121 122 123 124 125
if(CMAKE_COMPILER_IS_GNUCXX)
	execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
	if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
		SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
		SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-local-typedefs")
	endif(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
endif(CMAKE_COMPILER_IS_GNUCXX)
126

Pierre Kraemer's avatar
Pierre Kraemer committed
127

Pierre Kraemer's avatar
Pierre Kraemer committed
128

129
SET(SCHNApps_ROOT_DIR ${CGoGN_ROOT_DIR}/SCHNApps)
Sylvain Thery's avatar
Sylvain Thery committed
130 131
SET(EXECUTABLE_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE})
SET(LIBRARY_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
Pierre Kraemer's avatar
Pierre Kraemer committed
132

Sylvain Thery's avatar
Sylvain Thery committed
133 134 135
# for application auto selection of plugin directory
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/plugins_default_directory.h 
\#define\ PLUGINS_DEFAULT_DIRECTORY\ \"${SCHNApps_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE}\" )
136 137 138 139 140 141

file(
	GLOB_RECURSE
	SCHNApps_FILES
	${SCHNApps_ROOT_DIR}/src/*.cpp
	${SCHNApps_ROOT_DIR}/include/*.h
142
	${SCHNApps_ROOT_DIR}/include/*.hpp
143 144 145 146 147 148 149 150 151 152 153
)

file(
	GLOB_RECURSE
	SCHNApps_UI_FILES
	${SCHNApps_ROOT_DIR}/forms/*.ui
)

SET(SCHNApps_QOBJECT_FILES
	${SCHNApps_ROOT_DIR}/include/camera.h
	${SCHNApps_ROOT_DIR}/include/mapHandler.h
154
	${SCHNApps_ROOT_DIR}/include/cellSelector.h
155
	${SCHNApps_ROOT_DIR}/include/plugin.h
Pierre Kraemer's avatar
Pierre Kraemer committed
156 157
	${SCHNApps_ROOT_DIR}/include/plugin_interaction.h
	${SCHNApps_ROOT_DIR}/include/plugin_processing.h
158
	${SCHNApps_ROOT_DIR}/include/view.h
Pierre Kraemer's avatar
Pierre Kraemer committed
159
	${SCHNApps_ROOT_DIR}/include/schnapps.h
160
	${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
Pierre Kraemer's avatar
Pierre Kraemer committed
161 162 163
	${SCHNApps_ROOT_DIR}/include/controlDock_cameraTab.h
	${SCHNApps_ROOT_DIR}/include/controlDock_pluginTab.h
	${SCHNApps_ROOT_DIR}/include/controlDock_mapTab.h
164
	${SCHNApps_ROOT_DIR}/include/colorComboBox.h
Sylvain Thery's avatar
Sylvain Thery committed
165
	${SCHNApps_ROOT_DIR}/include/dialogList.h
166 167 168 169
)



Pierre Kraemer's avatar
Pierre Kraemer committed
170
link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
Sylvain Thery's avatar
Sylvain Thery committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202


INCLUDE_DIRECTORIES(
	${CGoGN_ROOT_DIR}/include
	${SCHNApps_ROOT_DIR}/include
	${EXT_INCLUDES}
	${CMAKE_CURRENT_SOURCE_DIR}
	${CMAKE_CURRENT_BINARY_DIR}
)

QT4_WRAP_UI( UIC_FILES
	${SCHNApps_UI_FILES}
)

QT4_WRAP_CPP( MOC_FILES
	${SCHNApps_QOBJECT_FILES}
)

QT4_ADD_RESOURCES( RCC_FILES
	${SCHNApps_ROOT_DIR}/resources/resources.qrc
)

ADD_EXECUTABLE( SCHNApps
	${SCHNApps_FILES}
	${UIC_FILES}
	${MOC_FILES}
	${RCC_FILES}
)

TARGET_LINK_LIBRARIES( SCHNApps
	${CGoGN_LIBS}
	${EXT_LIBS}
203
	pthread
Sylvain Thery's avatar
Sylvain Thery committed
204 205 206 207 208
)


ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)

Pierre Kraemer's avatar
Pierre Kraemer committed
209 210 211
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)