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

project(SCHNApps)

5

6
SET( CGoGN_SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
7
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
Sylvain Thery's avatar
Sylvain Thery committed
8 9 10 11
IF(WIN32)
	SET ( CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies" )
ENDIF(WIN32)

12
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)
13
SET (CGoGN_SRC_DIR ${CGoGN_ROOT_DIR}/CGoGN)
14

15 16 17
INCLUDE(${CGoGN_ROOT_DIR}/cmake_modules/functions.cmake)

setBuildType()
18

Sylvain Thery's avatar
Sylvain Thery committed
19 20 21 22
SET(SCHNApps_ROOT_DIR ${CGoGN_ROOT_DIR}/SCHNApps)
IF(WIN32)
	IF (CGoGN_WITH_QTCREATOR)
		SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE})
Sylvain Thery's avatar
Sylvain Thery committed
23 24
		SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE})
		link_directories( ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE} )
Sylvain Thery's avatar
Sylvain Thery committed
25 26 27
	ELSE()
		SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/)
		SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin)
Sylvain Thery's avatar
Sylvain Thery committed
28
		link_directories( ${CGoGN_ROOT_DIR}/bin/${ConfigurationName} )
Sylvain Thery's avatar
Sylvain Thery committed
29 30 31 32 33 34 35 36 37 38 39
	ENDIF()
ELSE()
	SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
	link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
ENDIF()



# PythonQt third-party dependency
ADD_SUBDIRECTORY(${CGoGN_ROOT_DIR}/ThirdParty/PythonQt ThirdParty_PythonQt)

40 41 42 43 44

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
find_package(Qt4 REQUIRED)
45
#find_package(QGLViewer REQUIRED)
46
find_package(PythonLibs 2.7 REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
47
#find_package(SuiteSparse REQUIRED)
48
#find_package(SuperLU REQUIRED)
49

50

51 52
add_definitions(-DWITH_QT)

53
SET( QT_USE_QTOPENGL TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
54
SET( QT_USE_QTXML TRUE )
55 56 57
SET( QT_USE_QTDESIGNER TRUE )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTPLUGIN TRUE )
58
SET( QT_USE_QTSVG TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
59

60
INCLUDE(${QT_USE_FILE})
61
#ADD_DEFINITIONS(${QT_DEFINITIONS})
62

Sylvain Thery's avatar
Sylvain Thery committed
63

64

Sylvain Thery's avatar
Sylvain Thery committed
65
# CGoGN compiled in one or several libs
66
file(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_onelib.h ONELIB_STR)
67
IF (ONELIB_STR EQUAL 1)
68 69 70 71
	SET(CGoGN_LIBS cgogn)
ELSE()
	SET(CGoGN_LIBS topology algo container utils)
ENDIF()
72

73 74
# definitions from CGoGN
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_defs.h CGoGN_DEFS)
75
IF(CGoGN_SLOT_DEBUG_MODE)
76
	LIST (APPEND CGoGN_DEFS -DCGoGN_SLOT_DEBUG_MODE=1)
77
ENDIF()
78
ADD_DEFINITIONS(${CGoGN_DEFS})
79

80 81 82
# includes from CGoGN + python
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_includes.h EXT_INCLUDES)
LIST(APPEND EXT_INCLUDES ${PYTHON_INCLUDE_DIRS})
83

84 85 86
# libs from CGoGN + python + PythonQt
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_libs.h EXT_LIBS)
LIST(APPEND EXT_LIBS PythonQt ${PYTHON_LIBRARIES})
87 88


Sylvain Thery's avatar
Sylvain Thery committed
89

90

91
if(CMAKE_COMPILER_IS_GNUCXX)
Sylvain Thery's avatar
Sylvain Thery committed
92 93 94 95 96 97 98
	LIST(APPEND CMAKE_CXX_FLAGS "-Wno-unused-local-typedefs")
endif()

if(WIN32)
	LIST(APPEND CMAKE_CXX_FLAGS "/W3")
else()
	if(APPLE)
Thery Sylvain's avatar
Thery Sylvain committed
99 100 101
		LIST(APPEND CMAKE_CXX_FLAGS "-Wall -fPIC -std=c++11 -Wno-deprecated -Wno-overloaded-virtual")
	else()
		LIST(APPEND CMAKE_CXX_FLAGS "-Wall -fPIC -std=c++11")
Sylvain Thery's avatar
Sylvain Thery committed
102 103
	endif()
endif()
104

Pierre Kraemer's avatar
Pierre Kraemer committed
105

106

107
INCLUDE_DIRECTORIES(
108 109
	${CGoGN_SRC_DIR}/include
	${CGoGN_ROOT_DIR}/ThirdParty/PythonQt/src/
110 111
	${SCHNApps_ROOT_DIR}/include
	${EXT_INCLUDES}
Sylvain Thery's avatar
Sylvain Thery committed
112
	${CMAKE_CURRENT_BINARY_DIR}/SCHNAppsLib
113 114
)

Sylvain Thery's avatar
Sylvain Thery committed
115 116
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins/schnapps/ SCHNAppsLib)

Sylvain Thery's avatar
Sylvain Thery committed
117
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)
118

Sylvain Thery's avatar
Sylvain Thery committed
119 120
INCLUDE_DIRECTORIES(
	${CMAKE_CURRENT_SOURCE_DIR}
121 122
)

Sylvain Thery's avatar
Sylvain Thery committed
123 124 125 126 127 128

# SCHNApps main application
file(
	GLOB_RECURSE
	SCHNApps_FILES
	${SCHNApps_ROOT_DIR}/src/main.cpp
129 130 131 132 133 134 135
)

ADD_EXECUTABLE( SCHNApps
	${SCHNApps_FILES}
)

TARGET_LINK_LIBRARIES( SCHNApps
Sylvain Thery's avatar
Sylvain Thery committed
136
	SCHNAppsLib
137 138 139 140
	${CGoGN_LIBS}
	${EXT_LIBS}
)

141 142 143
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)