CMakeLists.txt 3.93 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
SET( CGoGN_SCHNApps_USE_DOUBLE OFF CACHE BOOL "build with doubled instead of floats" )
Sylvain Thery's avatar
Sylvain Thery committed
7 8 9
IF(WIN32)
	SET ( CGoGN_WITH_QTCREATOR OFF CACHE BOOL "use QtCreator to compile" )
ENDIF(WIN32)
10

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

16
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)
17
SET (CGoGN_SRC_DIR ${CGoGN_ROOT_DIR}/CGoGN)
18

19 20 21
INCLUDE(${CGoGN_ROOT_DIR}/cmake_modules/functions.cmake)

setBuildType()
22

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


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

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

53 54 55 56

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
57
find_package(PythonLibs 2.7 REQUIRED)
58

Sylvain Thery's avatar
Sylvain Thery committed
59

60

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

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

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

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

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


Sylvain Thery's avatar
Sylvain Thery committed
90

91

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

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

Pierre Kraemer's avatar
Pierre Kraemer committed
106

107

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

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

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

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

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

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

ADD_EXECUTABLE( SCHNApps
	${SCHNApps_FILES}
)

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

142
qt_use_modules(SCHNApps Core Gui OpenGL Xml Svg)
Sylvain Thery's avatar
Sylvain Thery committed
143

144 145 146
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)