CMakeLists.txt 4.05 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()
35 36 37 38 39
	IF(APPLE)
		SET(EXECUTABLE_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE}/Contents/MacOS/ )
	ELSE()
		SET(EXECUTABLE_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE})
	ENDIF()
40
#	SET(LIBRARY_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
Sylvain Thery's avatar
Sylvain Thery committed
41 42 43 44
	link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
ENDIF()


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

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

57 58 59 60

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
61
find_package(PythonLibs 2.7 REQUIRED)
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
Sylvain Thery's avatar
Sylvain Thery committed
66
file(READ ${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 76

#and schnapps options
77
IF(CGoGN_SLOT_DEBUG_MODE)
78
	LIST (APPEND CGoGN_DEFS -DCGoGN_SLOT_DEBUG_MODE=1)
79
ENDIF()
80 81 82
IF (${CGoGN_SCHNApps_USE_DOUBLE})
	LIST (APPEND CGoGN_DEFS -DSCHNAPPS_USE_DOUBLE=1)
ENDIF()
83
ADD_DEFINITIONS(${CGoGN_DEFS})
84

85 86 87
# includes from CGoGN + python
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_includes.h EXT_INCLUDES)
LIST(APPEND EXT_INCLUDES ${PYTHON_INCLUDE_DIRS})
88

89 90 91
# libs from CGoGN + python + PythonQt
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_libs.h EXT_LIBS)
LIST(APPEND EXT_LIBS PythonQt ${PYTHON_LIBRARIES})
92 93


Sylvain Thery's avatar
Sylvain Thery committed
94

95

96
if(CMAKE_COMPILER_IS_GNUCXX)
97
	SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
Sylvain Thery's avatar
Sylvain Thery committed
98 99 100
endif()

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

Pierre Kraemer's avatar
Pierre Kraemer committed
110

111

112
INCLUDE_DIRECTORIES(
113 114
	${CGoGN_SRC_DIR}/include
	${CGoGN_ROOT_DIR}/ThirdParty/PythonQt/src/
115 116
	${SCHNApps_ROOT_DIR}/include
	${EXT_INCLUDES}
Sylvain Thery's avatar
Sylvain Thery committed
117
	${CMAKE_CURRENT_BINARY_DIR}/SCHNAppsLib
118 119
)

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

Sylvain Thery's avatar
Sylvain Thery committed
122
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)
123

Sylvain Thery's avatar
Sylvain Thery committed
124 125
INCLUDE_DIRECTORIES(
	${CMAKE_CURRENT_SOURCE_DIR}
126 127
)

Sylvain Thery's avatar
Sylvain Thery committed
128 129 130 131 132 133

# SCHNApps main application
file(
	GLOB_RECURSE
	SCHNApps_FILES
	${SCHNApps_ROOT_DIR}/src/main.cpp
134 135 136 137 138 139 140
)

ADD_EXECUTABLE( SCHNApps
	${SCHNApps_FILES}
)

TARGET_LINK_LIBRARIES( SCHNApps
Sylvain Thery's avatar
Sylvain Thery committed
141
	SCHNAppsLib
142 143 144 145
	${CGoGN_LIBS}
	${EXT_LIBS}
)

146
qt_use_modules(SCHNApps Core Gui OpenGL Xml Svg)
Sylvain Thery's avatar
Sylvain Thery committed
147

148 149 150
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)