CMakeLists.txt 3.62 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
	ELSE()
Sylvain Thery's avatar
Sylvain Thery committed
26
		SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin)
Sylvain Thery's avatar
Sylvain Thery committed
27
		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
	ENDIF()
ELSE()
Sylvain Thery's avatar
Sylvain Thery committed
31 32
	SET(EXECUTABLE_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE})
	SET(LIBRARY_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
Sylvain Thery's avatar
Sylvain Thery committed
33 34 35 36 37 38 39 40
	link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
ENDIF()



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

41 42 43 44 45

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

51

52 53
add_definitions(-DWITH_QT)

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

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

Sylvain Thery's avatar
Sylvain Thery committed
64

65

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

74 75
# definitions from CGoGN
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_defs.h CGoGN_DEFS)
76
IF(CGoGN_SLOT_DEBUG_MODE)
77
	LIST (APPEND CGoGN_DEFS -DCGoGN_SLOT_DEBUG_MODE=1)
78
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)
Sylvain Thery's avatar
Sylvain Thery committed
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

Pierre Kraemer's avatar
Pierre Kraemer committed
107

Sylvain Thery's avatar
Sylvain Thery committed
108
INCLUDE_DIRECTORIES(
109 110
	${CGoGN_SRC_DIR}/include
	${CGoGN_ROOT_DIR}/ThirdParty/PythonQt/src/
Sylvain Thery's avatar
Sylvain Thery committed
111 112
	${SCHNApps_ROOT_DIR}/include
	${EXT_INCLUDES}
Sylvain Thery's avatar
Sylvain Thery committed
113
	${CMAKE_CURRENT_BINARY_DIR}/SCHNAppsLib
Sylvain Thery's avatar
Sylvain Thery committed
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)
Sylvain Thery's avatar
Sylvain Thery committed
119

Sylvain Thery's avatar
Sylvain Thery committed
120 121
INCLUDE_DIRECTORIES(
	${CMAKE_CURRENT_SOURCE_DIR}
Sylvain Thery's avatar
Sylvain Thery committed
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
Sylvain Thery's avatar
Sylvain Thery committed
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
Sylvain Thery's avatar
Sylvain Thery committed
138 139 140 141
	${CGoGN_LIBS}
	${EXT_LIBS}
)

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)