CMakeLists.txt 4.83 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

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

19 20
SET( CGoGN_SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
SET( CGoGN_ASSERT_ACTIVED OFF CACHE BOOL "assertion activated")
21

22 23 24 25 26

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
find_package(Qt4 REQUIRED)
27
#find_package(QGLViewer REQUIRED)
28
find_package(PythonLibs 2.7 REQUIRED)
29
find_package(SuiteSparse REQUIRED)
30
#find_package(SuperLU REQUIRED)
31

32

33 34
add_definitions(-DWITH_QT)

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 44
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

Sylvain Thery's avatar
Sylvain Thery committed
45 46 47
# PythonQt dependency
ADD_SUBDIRECTORY(${CGoGN_ROOT_DIR}/ThirdParty/PythonQt ThirdParty_PythonQt)

48

Sylvain Thery's avatar
Sylvain Thery committed
49 50 51 52
# for GLM
add_definitions(-DGLM_FORCE_RADIANS)

# CGoGN compiled in one or several libs
53
file(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_onelib.h ONELIB_STR)
54
IF (ONELIB_STR EQUAL 1)
Sylvain Thery's avatar
Sylvain Thery committed
55 56 57 58
	SET(CGoGN_LIBS cgogn)
ELSE()
	SET(CGoGN_LIBS topology algo container utils)
ENDIF()
59

Sylvain Thery's avatar
Sylvain Thery committed
60
# use GL core profile 3.3
61 62 63 64 65
file(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_coreprofile.h COREPROFILE_STR)
IF (COREPROFILE_STR EQUAL 1)
	add_definitions(-DCGoGN_USE_OGL_CORE_PROFILE=1)
ENDIF()

66
add_definitions(-DCGOGN_ASSERT_BOOL=${CGoGN_ASSERT_ACTIVED})
67

68 69
IF(CGoGN_SLOT_DEBUG_MODE)
	add_definitions(-DCGoGN_SLOT_DEBUG_MODE=1)
70
ENDIF()
71

72

73 74 75
# define includes of external libs 
SET (EXT_INCLUDES 
	${CGoGN_ROOT_DIR}/ThirdParty/include
76
	${CGoGN_ROOT_DIR}/ThirdParty/OpenNL/src
77 78 79 80
	${OPENGL_INCLUDE_DIR}
	${GLEW_INCLUDE_DIRS}
	${ZLIB_INCLUDE_DIRS}
	${QT_INCLUDE_DIR}
81
	${CGoGN_ROOT_DIR}/ThirdParty/libQGLViewer/
82
	${PYTHON_INCLUDE_DIRS}
83
	${SUITESPARSE_INCLUDE_DIRS}
84
	${CGoGN_ROOT_DIR}/ThirdParty/TinyXml2
85 86 87 88 89
)

# define libs for external libs
SET (EXT_LIBS 
	PythonQt
90
	nl
91
	QGLViewer
92 93 94 95 96
	${OPENGL_LIBRARY}
	${GLEW_LIBRARIES}
	${ZLIB_LIBRARIES}
	${QT_LIBRARIES}
	${PYTHON_LIBRARIES}
97
	${SUITESPARSE_LIBRARIES}
98
	tinyxml2
99 100 101
)


Sylvain Thery's avatar
Sylvain Thery committed
102
if(APPLE)
Thery Sylvain's avatar
Thery Sylvain committed
103
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")	
Sylvain Thery's avatar
Sylvain Thery committed
104
	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
Sylvain Thery's avatar
Sylvain Thery committed
105
endif()
106

107 108 109 110
if(CMAKE_COMPILER_IS_GNUCXX)
		SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
		SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-local-typedefs")
endif(CMAKE_COMPILER_IS_GNUCXX)
111

Pierre Kraemer's avatar
Pierre Kraemer committed
112

Pierre Kraemer's avatar
Pierre Kraemer committed
113

114
SET(SCHNApps_ROOT_DIR ${CGoGN_ROOT_DIR}/SCHNApps)
Sylvain Thery's avatar
Sylvain Thery committed
115 116
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
117

Sylvain Thery's avatar
Sylvain Thery committed
118 119 120
# 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}\" )
121 122 123 124 125 126

file(
	GLOB_RECURSE
	SCHNApps_FILES
	${SCHNApps_ROOT_DIR}/src/*.cpp
	${SCHNApps_ROOT_DIR}/include/*.h
127
	${SCHNApps_ROOT_DIR}/include/*.hpp
128 129 130 131 132 133 134 135 136 137 138
)

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
139
	${SCHNApps_ROOT_DIR}/include/cellSelector.h
140
	${SCHNApps_ROOT_DIR}/include/plugin.h
Pierre Kraemer's avatar
Pierre Kraemer committed
141 142
	${SCHNApps_ROOT_DIR}/include/plugin_interaction.h
	${SCHNApps_ROOT_DIR}/include/plugin_processing.h
143
	${SCHNApps_ROOT_DIR}/include/view.h
Pierre Kraemer's avatar
Pierre Kraemer committed
144
	${SCHNApps_ROOT_DIR}/include/schnapps.h
145
	${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
Pierre Kraemer's avatar
Pierre Kraemer committed
146 147 148
	${SCHNApps_ROOT_DIR}/include/controlDock_cameraTab.h
	${SCHNApps_ROOT_DIR}/include/controlDock_pluginTab.h
	${SCHNApps_ROOT_DIR}/include/controlDock_mapTab.h
149
	${SCHNApps_ROOT_DIR}/include/colorComboBox.h
Sylvain Thery's avatar
Sylvain Thery committed
150
	${SCHNApps_ROOT_DIR}/include/dialogList.h
151 152 153 154
)



Pierre Kraemer's avatar
Pierre Kraemer committed
155
link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
Sylvain Thery's avatar
Sylvain Thery committed
156 157 158


INCLUDE_DIRECTORIES(
159 160
	${CGoGN_SRC_DIR}/include
	${CGoGN_ROOT_DIR}/ThirdParty/PythonQt/src/
Sylvain Thery's avatar
Sylvain Thery committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
	${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}
189
	pthread
Sylvain Thery's avatar
Sylvain Thery committed
190 191 192 193 194
)


ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)

Pierre Kraemer's avatar
Pierre Kraemer committed
195 196 197
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)