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

project(SCHNApps)

5
SET( CGoGN_SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
6
7
8
SET( CGoGN_SCHNApps_USE_DOUBLE OFF CACHE BOOL "build with doubled instead of floats" )
SET ( CGoGN_WITH_QTCREATOR OFF CACHE BOOL "use QtCreator to compile" )

9
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
Sylvain Thery's avatar
Sylvain Thery committed
10
11
12
13
IF(WIN32)
	SET ( CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies" )
ENDIF(WIN32)

14
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)
15
SET (CGoGN_SRC_DIR ${CGoGN_ROOT_DIR}/CGoGN)
16

17
18
19
INCLUDE(${CGoGN_ROOT_DIR}/cmake_modules/functions.cmake)

setBuildType()
20

Sylvain Thery's avatar
Sylvain Thery committed
21
22
23
24
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
25
26
		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
27
	ELSE()
Sylvain Thery's avatar
Sylvain Thery committed
28
		SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin)
Sylvain Thery's avatar
Sylvain Thery committed
29
		SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin)
Sylvain Thery's avatar
Sylvain Thery committed
30
		link_directories( ${CGoGN_ROOT_DIR}/bin/${ConfigurationName} )
Sylvain Thery's avatar
Sylvain Thery committed
31
32
	ENDIF()
ELSE()
Sylvain Thery's avatar
Sylvain Thery committed
33
	SET(EXECUTABLE_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE})
34
#	SET(LIBRARY_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
Sylvain Thery's avatar
Sylvain Thery committed
35
36
37
38
	link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
ENDIF()


Sylvain Thery's avatar
Sylvain Thery committed
39
# choose same Qt version than in CGoGN
Sylvain Thery's avatar
Sylvain Thery committed
40
file(READ ${CGoGN_SRC_DIR}/include/cgogn_qt.h CGoGN_DESIRED_QT_VERSION)
Sylvain Thery's avatar
Sylvain Thery committed
41
42
43
44
45
46
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()
Sylvain Thery's avatar
Sylvain Thery committed
47
48
49
50

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

51
52
53
54

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
55
find_package(PythonLibs 2.7 REQUIRED)
56

Sylvain Thery's avatar
Sylvain Thery committed
57

58

Sylvain Thery's avatar
Sylvain Thery committed
59
# CGoGN compiled in one or several libs
Sylvain Thery's avatar
Sylvain Thery committed
60
file(READ ${CGoGN_SRC_DIR}/include/cgogn_onelib.h ONELIB_STR)
61
IF (ONELIB_STR EQUAL 1)
Sylvain Thery's avatar
Sylvain Thery committed
62
63
64
65
	SET(CGoGN_LIBS cgogn)
ELSE()
	SET(CGoGN_LIBS topology algo container utils)
ENDIF()
66

67
68
# definitions from CGoGN
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_defs.h CGoGN_DEFS)
69
70

#and schnapps options
71
IF(CGoGN_SLOT_DEBUG_MODE)
72
	LIST (APPEND CGoGN_DEFS -DCGoGN_SLOT_DEBUG_MODE=1)
73
ENDIF()
74
75
76
IF (${CGoGN_SCHNApps_USE_DOUBLE})
	LIST (APPEND CGoGN_DEFS -DSCHNAPPS_USE_DOUBLE=1)
ENDIF()
77
ADD_DEFINITIONS(${CGoGN_DEFS})
78

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

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


Sylvain Thery's avatar
Sylvain Thery committed
88

89

90
if(CMAKE_COMPILER_IS_GNUCXX)
91
	SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
Sylvain Thery's avatar
Sylvain Thery committed
92
93
94
endif()

if(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
95
	SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
Sylvain Thery's avatar
Sylvain Thery committed
96
97
else()
	if(APPLE)
Sylvain Thery's avatar
Sylvain Thery committed
98
		SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11 -Wno-deprecated -Wno-overloaded-virtual")
Thery Sylvain's avatar
Thery Sylvain committed
99
	else()
Sylvain Thery's avatar
Sylvain Thery committed
100
		SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11")
Sylvain Thery's avatar
Sylvain Thery committed
101
102
	endif()
endif()
103

Pierre Kraemer's avatar
Pierre Kraemer committed
104

Pierre Kraemer's avatar
Pierre Kraemer committed
105

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

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

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

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

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

# SCHNApps main application
file(
	GLOB_RECURSE
	SCHNApps_FILES
	${SCHNApps_ROOT_DIR}/src/main.cpp
Sylvain Thery's avatar
Sylvain Thery committed
128
129
130
131
132
133
134
)

ADD_EXECUTABLE( SCHNApps
	${SCHNApps_FILES}
)

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

Sylvain Thery's avatar
Sylvain Thery committed
140
141
qt_use_modules(SCHNApps Core Gui  OpenGL Xml Svg Designer)

Pierre Kraemer's avatar
Pierre Kraemer committed
142
143
144
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)