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

project(SCHNApps)

5

Sylvain Thery's avatar
Sylvain Thery committed
6
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11")
7

8
SET( CGoGN_SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
9 10
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)
11
SET (CGoGN_SRC_DIR ${CGoGN_ROOT_DIR}/CGoGN)
12

13 14 15
INCLUDE(${CGoGN_ROOT_DIR}/cmake_modules/functions.cmake)

setBuildType()
16

17 18 19 20 21

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
find_package(Qt4 REQUIRED)
22
#find_package(QGLViewer REQUIRED)
23
find_package(PythonLibs 2.7 REQUIRED)
24
find_package(SuiteSparse REQUIRED)
25
#find_package(SuperLU REQUIRED)
26

27

28 29
add_definitions(-DWITH_QT)

30
SET( QT_USE_QTOPENGL TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
31
SET( QT_USE_QTXML TRUE )
32 33 34
SET( QT_USE_QTDESIGNER TRUE )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTPLUGIN TRUE )
35
SET( QT_USE_QTSVG TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
36

37
INCLUDE(${QT_USE_FILE})
38
#ADD_DEFINITIONS(${QT_DEFINITIONS})
39

40
# PythonQt third-party dependency
Sylvain Thery's avatar
Sylvain Thery committed
41 42
ADD_SUBDIRECTORY(${CGoGN_ROOT_DIR}/ThirdParty/PythonQt ThirdParty_PythonQt)

43

Sylvain Thery's avatar
Sylvain Thery committed
44
# CGoGN compiled in one or several libs
45
file(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_onelib.h ONELIB_STR)
46
IF (ONELIB_STR EQUAL 1)
Sylvain Thery's avatar
Sylvain Thery committed
47 48 49 50
	SET(CGoGN_LIBS cgogn)
ELSE()
	SET(CGoGN_LIBS topology algo container utils)
ENDIF()
51

52 53
# definitions from CGoGN
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_defs.h CGoGN_DEFS)
54
IF(CGoGN_SLOT_DEBUG_MODE)
55
	LIST (APPEND CGoGN_DEFS -DCGoGN_SLOT_DEBUG_MODE=1)
56
ENDIF()
57
ADD_DEFINITIONS(${CGoGN_DEFS})
58

59 60 61
# includes from CGoGN + python
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_includes.h EXT_INCLUDES)
LIST(APPEND EXT_INCLUDES ${PYTHON_INCLUDE_DIRS})
62

63 64 65
# libs from CGoGN + python + PythonQt
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_libs.h EXT_LIBS)
LIST(APPEND EXT_LIBS PythonQt ${PYTHON_LIBRARIES})
66 67


Sylvain Thery's avatar
Sylvain Thery committed
68
if(APPLE)
Thery Sylvain's avatar
Thery Sylvain committed
69
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")	
Sylvain Thery's avatar
Sylvain Thery committed
70
	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
Sylvain Thery's avatar
Sylvain Thery committed
71
endif()
72

73 74 75 76
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)
77

Pierre Kraemer's avatar
Pierre Kraemer committed
78

Pierre Kraemer's avatar
Pierre Kraemer committed
79

80
SET(SCHNApps_ROOT_DIR ${CGoGN_ROOT_DIR}/SCHNApps)
Sylvain Thery's avatar
Sylvain Thery committed
81 82
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
83

Sylvain Thery's avatar
Sylvain Thery committed
84 85 86
# 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}\" )
87 88 89 90 91 92

file(
	GLOB_RECURSE
	SCHNApps_FILES
	${SCHNApps_ROOT_DIR}/src/*.cpp
	${SCHNApps_ROOT_DIR}/include/*.h
93
	${SCHNApps_ROOT_DIR}/include/*.hpp
94 95 96 97 98 99 100 101 102 103 104
)

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
105
	${SCHNApps_ROOT_DIR}/include/cellSelector.h
106
	${SCHNApps_ROOT_DIR}/include/plugin.h
Pierre Kraemer's avatar
Pierre Kraemer committed
107 108
	${SCHNApps_ROOT_DIR}/include/plugin_interaction.h
	${SCHNApps_ROOT_DIR}/include/plugin_processing.h
109
	${SCHNApps_ROOT_DIR}/include/view.h
Pierre Kraemer's avatar
Pierre Kraemer committed
110
	${SCHNApps_ROOT_DIR}/include/schnapps.h
111
	${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
Pierre Kraemer's avatar
Pierre Kraemer committed
112 113 114
	${SCHNApps_ROOT_DIR}/include/controlDock_cameraTab.h
	${SCHNApps_ROOT_DIR}/include/controlDock_pluginTab.h
	${SCHNApps_ROOT_DIR}/include/controlDock_mapTab.h
115
	${SCHNApps_ROOT_DIR}/include/colorComboBox.h
Sylvain Thery's avatar
Sylvain Thery committed
116
	${SCHNApps_ROOT_DIR}/include/dialogList.h
117 118 119 120
)



Pierre Kraemer's avatar
Pierre Kraemer committed
121
link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
Sylvain Thery's avatar
Sylvain Thery committed
122 123 124


INCLUDE_DIRECTORIES(
125 126
	${CGoGN_SRC_DIR}/include
	${CGoGN_ROOT_DIR}/ThirdParty/PythonQt/src/
Sylvain Thery's avatar
Sylvain Thery committed
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
	${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}
)


ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)

Pierre Kraemer's avatar
Pierre Kraemer committed
160 161 162
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)