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

project(SCHNApps)

5

Sylvain Thery's avatar
Sylvain Thery committed
6
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11")
7

8
SET( CGoGN_SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
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})
	ELSE()
		SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/)
		SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin)
	ENDIF()
#	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/plugins_default_directory.h 
#	\#define\ PLUGINS_DEFAULT_DIRECTORY\ \"${SCHNApps_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE}\" )
	link_directories( ${CGoGN_ROOT_DIR}/bin/${ConfigurationName} )
ELSE()
	SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
#	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/plugins_default_directory.h 
#	\#define\ PLUGINS_DEFAULT_DIRECTORY\ \"${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE}\" )
	link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
ENDIF()



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

44 45 46 47 48

find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GLEW REQUIRED)
find_package(Qt4 REQUIRED)
49
#find_package(QGLViewer REQUIRED)
50
find_package(PythonLibs 2.7 REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
51
#find_package(SuiteSparse REQUIRED)
52
#find_package(SuperLU REQUIRED)
53

54

55 56
add_definitions(-DWITH_QT)

57
SET( QT_USE_QTOPENGL TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
58
SET( QT_USE_QTXML TRUE )
59 60 61
SET( QT_USE_QTDESIGNER TRUE )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTPLUGIN TRUE )
62
SET( QT_USE_QTSVG TRUE )
Pierre Kraemer's avatar
Pierre Kraemer committed
63

64
INCLUDE(${QT_USE_FILE})
65
#ADD_DEFINITIONS(${QT_DEFINITIONS})
66

Sylvain Thery's avatar
Sylvain Thery committed
67

68

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

77 78
# definitions from CGoGN
FILE(STRINGS ${CGoGN_SRC_DIR}/include/cgogn_defs.h CGoGN_DEFS)
79
IF(CGoGN_SLOT_DEBUG_MODE)
80
	LIST (APPEND CGoGN_DEFS -DCGoGN_SLOT_DEBUG_MODE=1)
81
ENDIF()
82
ADD_DEFINITIONS(${CGoGN_DEFS})
83

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

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


Sylvain Thery's avatar
Sylvain Thery committed
93
if(APPLE)
Thery Sylvain's avatar
Thery Sylvain committed
94
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")	
Sylvain Thery's avatar
Sylvain Thery committed
95
	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
Sylvain Thery's avatar
Sylvain Thery committed
96
endif()
97

98 99 100 101
if(CMAKE_COMPILER_IS_GNUCXX)
		SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
		SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-local-typedefs")
endif(CMAKE_COMPILER_IS_GNUCXX)
102

Pierre Kraemer's avatar
Pierre Kraemer committed
103

Pierre Kraemer's avatar
Pierre Kraemer committed
104

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

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

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

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

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

ADD_EXECUTABLE( SCHNApps
	${SCHNApps_FILES}
)

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

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