Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

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

project(CGoGN)

5
#SET ( CMAKE_VERBOSE_MAKEFILE 1 )
untereiner's avatar
untereiner committed
6

7
SET ( CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR} )
Pierre Kraemer's avatar
Pierre Kraemer committed
8

9
SET ( CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/ )
Sylvain Thery's avatar
Sylvain Thery committed
10

Sylvain Thery's avatar
Sylvain Thery committed
11
12
13
14
15
16
17
18
19
20


IF (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug|Release"))
	IF (${CMAKE_CURRENT_BINARY_DIR} MATCHES "(.*)Debug|(.*)debug|(.*)DEBUG")
		SET(CMAKE_BUILD_TYPE "Debug")
	ELSE()
		SET(CMAKE_BUILD_TYPE "Release")
	ENDIF()
ENDIF()

Sylvain Thery's avatar
Sylvain Thery committed
21
# for shared or not shared
22
23
SET ( BUILD_SHARED_LIBS OFF CACHE BOOL "if used all library are build as shared type (.so/.dylib/.dll)" )

Sylvain Thery's avatar
Sylvain Thery committed
24
25
26
27
28
29
30
31
32
33
34
35
IF(EXISTS "${CGoGN_ROOT_DIR}/ThirdParty/include/Assimp")
	SET ( WITH_ASSIMP ON CACHE BOOL "build CGoGN with Assimp" )
ELSE()
	SET ( WITH_ASSIMP OFF CACHE BOOL "build CGoGN with Assimp" )
ENDIF()

IF(EXISTS "${CGoGN_ROOT_DIR}/ThirdParty/include/Zinri")
	SET ( WITH_ZINRI ON CACHE BOOL "build CGoGN with Zinri lib" )
ELSE()
	SET ( WITH_ZINRI OFF CACHE BOOL "build CGoGN with Zinri lib" )
ENDIF()

36
SET ( WITH_QT ON CACHE BOOL "build CGoGN with Qt lib" )
Thery Sylvain's avatar
Thery Sylvain committed
37
SET ( DESIRED_QT_VERSION "4" CACHE STRING "4: QT4/ 5 not yet implemented" )
Sylvain Thery's avatar
Sylvain Thery committed
38

Sylvain Thery's avatar
Sylvain Thery committed
39
40
41
42
43
SET ( COMPILE_EXAMPLES ON CACHE BOOL "compile examples" )
SET ( COMPILE_TUTOS ON CACHE BOOL "compile tutorials" )
SET ( COMPILE_TESTS ON CACHE BOOL "compile tests" )
SET ( COMPILE_BENCHES ON CACHE BOOL "compile benches" )
SET ( COMPILE_SANDBOX ON CACHE BOOL "compile all in sandbox" )
44
45


46
#create one big lib
47
48
49
SET ( ONELIB OFF CACHE BOOL "build CGoGN in one lib" )

SET ( WITH_GLEWMX OFF CACHE BOOL "use multi-contex GLEW" )
50

Sylvain Thery's avatar
Sylvain Thery committed
51
52

IF(WIN32)
53
	SET ( CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies" )
Sylvain Thery's avatar
Sylvain Thery committed
54
ENDIF(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
55

thery's avatar
thery committed
56
find_package(OpenGL REQUIRED)
57
find_package(Boost COMPONENTS regex REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
58
59
60
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
61

Sylvain Thery's avatar
Sylvain Thery committed
62
63
64
65
# MESSAGE HERE FOR MORE EASY USER READING
MESSAGE("Building type = " ${CMAKE_BUILD_TYPE} " (for change -DCMAKE_BUILD_TYPE=Release|Debug)" )


66
67
68
69
70
71
IF (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
ELSE (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON)

72
73
74
75
76
77
IF (ONELIB)
	file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h "1" )
ELSE (ONELIB)
	file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h "0" )
ENDIF (ONELIB)

78
79
80
81
82
83
84
IF (WITH_GLEWMX)
	file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_gmx.h "1" )
ELSE (WITH_GLEWMX)
	file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_gmx.h "0" )
ENDIF (WITH_GLEWMX)


85
86
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")

Sylvain Thery's avatar
Sylvain Thery committed
87
# define includes of external libs 
88
89
SET (CGoGN_EXT_INCLUDES
	${CGoGN_ROOT_DIR}/ThirdParty/include
Sylvain Thery's avatar
Sylvain Thery committed
90
91
92
93
	${OPENGL_INCLUDE_DIR}
	${GLEW_INCLUDE_DIRS}
	${ZLIB_INCLUDE_DIRS}
	${LIBXML2_INCLUDE_DIR}
94
95
	${Boost_INCLUDE_DIRS}
)
Sylvain Thery's avatar
Sylvain Thery committed
96
97

# define libs for external libs
98
SET (CGoGN_EXT_LIBS
99
    nl
Sylvain Thery's avatar
Sylvain Thery committed
100
101
102
103
104
	${OPENGL_LIBRARY}
	${GLEW_LIBRARIES}
	${ZLIB_LIBRARIES}
	${LIBXML2_LIBRARIES}
	${Boost_REGEX_LIBRARY}
105
)
106

107
108
109
110
111
112
113
114
115
IF(WIN32)
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${CGoGN_ROOT_DIR}/windows_dependencies/include/suitesparse)
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} 
		${CGoGN_ROOT_DIR}/windows_dependencies/lib/suitesparse.lib
		${CGoGN_ROOT_DIR}/windows_dependencies/lib/metis.lib
		${CGoGN_ROOT_DIR}/windows_dependencies/lib/liblapack.lib
		${CGoGN_ROOT_DIR}/windows_dependencies/lib/libblas.lib		)
ELSE(WIN32)
	find_package(SuiteSparse REQUIRED)
unknown's avatar
unknown committed
116
117
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${SUITESPARSE_INCLUDE_DIRS})
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${SUITESPARSE_LIBRARIES})
118
119
ENDIF(WIN32)

unknown's avatar
unknown committed
120

121
#optionnal libs
Sylvain Thery's avatar
Sylvain Thery committed
122
IF (WITH_ASSIMP)
123
	add_definitions(-DWITH_ASSIMP)	
124
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} assimp)
Sylvain Thery's avatar
Sylvain Thery committed
125
#	INSTALL (DIRECTORY ThirdParty/Assimp/include  DESTINATION .)
Sylvain Thery's avatar
Sylvain Thery committed
126
127
ENDIF (WITH_ASSIMP)

128
129
130
IF (WITH_ZINRI)
	add_definitions(-DWITH_ZINRI)
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} Zinri)
Sylvain Thery's avatar
Sylvain Thery committed
131
#	INSTALL (DIRECTORY ThirdParty/Zinri/ DESTINATION include FILES_MATCHING PATTERN "*.h")
132
133
134
ENDIF (WITH_ZINRI)

IF (WITH_QT)
135
	add_definitions(-DWITH_QT)
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
136
	find_package(Qt REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
137
	SET(QT_USE_QTCORE TRUE)
138
139
	SET(QT_USE_QTOPENGL TRUE)
	SET(QT_USE_QTSVG TRUE)
Sylvain Thery's avatar
Sylvain Thery committed
140
	SET(QT_USE_QTXML TRUE )
141
142
	INCLUDE(${QT_USE_FILE})
	ADD_DEFINITIONS(${QT_DEFINITIONS})
Sylvain Thery's avatar
Sylvain Thery committed
143
144
	find_package(QGLViewer REQUIRED)
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR} ${QGLVIEWER_INCLUDE_DIR} )
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
145
        SET (CGoGN_EXT_LIBS ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${CGoGN_EXT_LIBS})
146
147
ENDIF (WITH_QT)

148
149
150
151
IF (WITH_GLEWMX)
	ADD_DEFINITIONS(-DGLEW_MX)
ENDIF (WITH_GLEWMX)

152

Pierre Kraemer's avatar
Pierre Kraemer committed
153
# qq definition specifiques pour mac
Thery Sylvain's avatar
Thery Sylvain committed
154
#IF(APPLE)
Sylvain Thery's avatar
Sylvain Thery committed
155
#	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")	
Thery Sylvain's avatar
Thery Sylvain committed
156
157
158
#	SET(CMAKE_OSX_ARCHITECTURES x86_64)
#	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} "-framework Foundation -framework cocoa" )
#ENDIF(APPLE)
Pierre Kraemer's avatar
Pierre Kraemer committed
159
160

IF(WIN32)
unknown's avatar
unknown committed
161
162
	set(CMAKE_CONFIGURATION_TYPES Release Debug)
	set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
Sylvain Thery's avatar
Sylvain Thery committed
163
ELSE()
Sylvain Thery's avatar
Sylvain Thery committed
164
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC -std=c++11")
165
	SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Woverride-init -fPIC")
Sylvain Thery's avatar
Sylvain Thery committed
166
167
168
169
170
171
172
	# remove the 60000+ "no unused local typedefs" warnings with GCC4.8+
	if(CMAKE_COMPILER_IS_GNUCXX)
		execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
		if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
			SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
			SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-local-typedefs")
		endif(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
Sylvain Thery's avatar
Sylvain Thery committed
173
174
175
176
177
178
	endif()
ENDIF()

add_subdirectory(Release)
add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)

179

Sylvain Thery's avatar
Sylvain Thery committed
180
181
182
183
#INSTALL (DIRECTORY ${CGoGN_ROOT_DIR}/include ${CGoGN_ROOT_DIR}/lib ${CGoGN_ROOT_DIR}/bin DESTINATION .)
#INSTALL (DIRECTORY ThirdParty/glm  DESTINATION include)
#INSTALL (DIRECTORY cmake_modules  DESTINATION .)
#INSTALL (FILES apps_cmake.txt  DESTINATION .)