CMakeLists.txt 3.65 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_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
Sylvain Thery's avatar
Sylvain Thery committed
7 8 9 10
IF(WIN32)
	SET ( CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies" )
ENDIF(WIN32)

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

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

setBuildType()
17

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


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

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

48 49 50 51

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
52
find_package(PythonLibs 2.7 REQUIRED)
53

Sylvain Thery's avatar
Sylvain Thery committed
54

55

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

64 65
# definitions from CGoGN
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_defs.h CGoGN_DEFS)
66
IF(CGoGN_SLOT_DEBUG_MODE)
67
	LIST (APPEND CGoGN_DEFS -DCGoGN_SLOT_DEBUG_MODE=1)
68
ENDIF()
69
ADD_DEFINITIONS(${CGoGN_DEFS})
70

71 72 73
# includes from CGoGN + python
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_includes.h EXT_INCLUDES)
LIST(APPEND EXT_INCLUDES ${PYTHON_INCLUDE_DIRS})
74

75 76 77
# libs from CGoGN + python + PythonQt
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_ext_libs.h EXT_LIBS)
LIST(APPEND EXT_LIBS PythonQt ${PYTHON_LIBRARIES})
78 79


Sylvain Thery's avatar
Sylvain Thery committed
80

81

82
if(CMAKE_COMPILER_IS_GNUCXX)
Sylvain Thery's avatar
Sylvain Thery committed
83
	SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-Wno-unused-local-typedefs")
Sylvain Thery's avatar
Sylvain Thery committed
84 85 86
endif()

if(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
87
	SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
Sylvain Thery's avatar
Sylvain Thery committed
88 89
else()
	if(APPLE)
Sylvain Thery's avatar
Sylvain Thery committed
90
		SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11 -Wno-deprecated -Wno-overloaded-virtual")
Thery Sylvain's avatar
Thery Sylvain committed
91
	else()
Sylvain Thery's avatar
Sylvain Thery committed
92
		SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11")
Sylvain Thery's avatar
Sylvain Thery committed
93 94
	endif()
endif()
95

Pierre Kraemer's avatar
Pierre Kraemer committed
96

Pierre Kraemer's avatar
Pierre Kraemer committed
97

Sylvain Thery's avatar
Sylvain Thery committed
98
INCLUDE_DIRECTORIES(
99 100
	${CGoGN_SRC_DIR}/include
	${CGoGN_ROOT_DIR}/ThirdParty/PythonQt/src/
Sylvain Thery's avatar
Sylvain Thery committed
101 102
	${SCHNApps_ROOT_DIR}/include
	${EXT_INCLUDES}
Sylvain Thery's avatar
Sylvain Thery committed
103
	${CMAKE_CURRENT_BINARY_DIR}/SCHNAppsLib
Sylvain Thery's avatar
Sylvain Thery committed
104 105
)

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

Sylvain Thery's avatar
Sylvain Thery committed
108
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)
Sylvain Thery's avatar
Sylvain Thery committed
109

Sylvain Thery's avatar
Sylvain Thery committed
110 111
INCLUDE_DIRECTORIES(
	${CMAKE_CURRENT_SOURCE_DIR}
Sylvain Thery's avatar
Sylvain Thery committed
112 113
)

Sylvain Thery's avatar
Sylvain Thery committed
114 115 116 117 118 119

# SCHNApps main application
file(
	GLOB_RECURSE
	SCHNApps_FILES
	${SCHNApps_ROOT_DIR}/src/main.cpp
Sylvain Thery's avatar
Sylvain Thery committed
120 121 122 123 124 125 126
)

ADD_EXECUTABLE( SCHNApps
	${SCHNApps_FILES}
)

TARGET_LINK_LIBRARIES( SCHNApps
Sylvain Thery's avatar
Sylvain Thery committed
127
	SCHNAppsLib
Sylvain Thery's avatar
Sylvain Thery committed
128 129 130 131
	${CGoGN_LIBS}
	${EXT_LIBS}
)

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

Pierre Kraemer's avatar
Pierre Kraemer committed
134 135 136
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
	ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPlugins)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)