CMakeLists.txt 5.07 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
# for shared or not shared
12 13 14 15 16
SET ( BUILD_SHARED_LIBS OFF CACHE BOOL "if used all library are build as shared type (.so/.dylib/.dll)" )

SET ( WITH_ASSIMP ON CACHE BOOL "build CGoGN with Assimp" )
SET ( WITH_ZINRI ON CACHE BOOL "build CGoGN with Zinri lib" )
SET ( WITH_QT ON CACHE BOOL "build CGoGN with Qt lib" )
Thery Sylvain's avatar
Thery Sylvain committed
17
SET ( DESIRED_QT_VERSION "4" CACHE STRING "4: QT4/ 5 not yet implemented" )
Sylvain Thery's avatar
Sylvain Thery committed
18 19 20
SET ( DONOT_COMPILE_SANDBOX OFF CACHE BOOL "do not compile the SandBox directory" )


21

22
# for CGoGN MR
23 24
SET ( FORCE_MR "0" CACHE STRING "0: normal mode / 1 multires mode" )

25
#create one big lib
26 27 28
SET ( ONELIB OFF CACHE BOOL "build CGoGN in one lib" )

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

Sylvain Thery's avatar
Sylvain Thery committed
30 31

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

thery's avatar
thery committed
35
find_package(OpenGL REQUIRED)
36
find_package(Boost COMPONENTS regex thread system REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
37 38 39
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
40

41 42 43 44 45 46
IF (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
ELSE (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON)

47 48 49 50 51 52 53 54 55
IF (FORCE_MR EQUAL 0)
	file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_mr.h "0" )
ENDIF (FORCE_MR EQUAL 0)

IF (FORCE_MR EQUAL 1)
	add_definitions(-DCGoGN_FORCE_MR=1)
	file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_mr.h "1" )
ENDIF (FORCE_MR EQUAL 1)

56 57 58 59 60 61
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)

62 63 64 65 66 67 68
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)


69 70
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")

Sylvain Thery's avatar
Sylvain Thery committed
71
# define includes of external libs 
72 73
SET (CGoGN_EXT_INCLUDES
	${CGoGN_ROOT_DIR}/ThirdParty/include
Sylvain Thery's avatar
Sylvain Thery committed
74 75 76 77
	${OPENGL_INCLUDE_DIR}
	${GLEW_INCLUDE_DIRS}
	${ZLIB_INCLUDE_DIRS}
	${LIBXML2_INCLUDE_DIR}
78 79
	${Boost_INCLUDE_DIRS}
)
Sylvain Thery's avatar
Sylvain Thery committed
80 81

# define libs for external libs
82
SET (CGoGN_EXT_LIBS
83
    nl
Sylvain Thery's avatar
Sylvain Thery committed
84 85 86 87
	${OPENGL_LIBRARY}
	${GLEW_LIBRARIES}
	${ZLIB_LIBRARIES}
	${LIBXML2_LIBRARIES}
88
	${Boost_SYSTEM_LIBRARY}
Sylvain Thery's avatar
Sylvain Thery committed
89
	${Boost_REGEX_LIBRARY}
90 91
	${Boost_THREAD_LIBRARY}
)
92

93 94 95 96 97 98 99 100 101
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
102 103
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${SUITESPARSE_INCLUDE_DIRS})
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${SUITESPARSE_LIBRARIES})
104 105
ENDIF(WIN32)

unknown's avatar
unknown committed
106

107
#optionnal libs
Sylvain Thery's avatar
Sylvain Thery committed
108
IF (WITH_ASSIMP)
109
	add_definitions(-DWITH_ASSIMP)	
110
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} assimp)
111
	INSTALL (DIRECTORY ThirdParty/Assimp/include  DESTINATION .)
Sylvain Thery's avatar
Sylvain Thery committed
112 113
ENDIF (WITH_ASSIMP)

114 115 116
IF (WITH_ZINRI)
	add_definitions(-DWITH_ZINRI)
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} Zinri)
117
	INSTALL (DIRECTORY ThirdParty/Zinri/ DESTINATION include FILES_MATCHING PATTERN "*.h")
118 119 120
ENDIF (WITH_ZINRI)

IF (WITH_QT)
121
	add_definitions(-DWITH_QT)
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
122
	find_package(Qt REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
123
	SET(QT_USE_QTCORE TRUE)
124 125
	SET(QT_USE_QTOPENGL TRUE)
	SET(QT_USE_QTSVG TRUE)
Sylvain Thery's avatar
Sylvain Thery committed
126
	SET(QT_USE_QTXML TRUE )
127 128
	INCLUDE(${QT_USE_FILE})
	ADD_DEFINITIONS(${QT_DEFINITIONS})
Sylvain Thery's avatar
Sylvain Thery committed
129 130 131
	find_package(QGLViewer REQUIRED)
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR} ${QGLVIEWER_INCLUDE_DIR} )
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
132 133
ENDIF (WITH_QT)

134 135 136 137
IF (WITH_GLEWMX)
	ADD_DEFINITIONS(-DGLEW_MX)
ENDIF (WITH_GLEWMX)

138

Pierre Kraemer's avatar
Pierre Kraemer committed
139
# qq definition specifiques pour mac
Thery Sylvain's avatar
Thery Sylvain committed
140 141 142 143 144
#IF(APPLE)
#	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
#	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
145 146 147 148

IF(WIN32)
	add_subdirectory(Release)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
unknown's avatar
unknown committed
149 150 151
	set(CMAKE_CONFIGURATION_TYPES Release Debug)
	set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
#	set(CMAKE_CONFIGURATION_TYPES "Release Debug" CACHE STRING "Only Release or Debug" FORCE)
Pierre Kraemer's avatar
Pierre Kraemer committed
152
ELSE(WIN32)
153 154 155
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC")
#	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -fPIC")
	SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Woverride-init -fPIC")
Pierre Kraemer's avatar
Pierre Kraemer committed
156 157 158 159
	add_subdirectory(Release)
	add_subdirectory(Debug)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
ENDIF(WIN32)
160

161
INSTALL (DIRECTORY ${CGoGN_ROOT_DIR}/include ${CGoGN_ROOT_DIR}/lib ${CGoGN_ROOT_DIR}/bin DESTINATION .)
162
INSTALL (DIRECTORY ThirdParty/glm  DESTINATION include)
163 164
INSTALL (DIRECTORY cmake_modules  DESTINATION .)
INSTALL (FILES apps_cmake.txt  DESTINATION .)