CMakeLists.txt 4.44 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 17
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" )

18
# for CGoGN MR
19 20
SET ( FORCE_MR "0" CACHE STRING "0: normal mode / 1 multires mode" )

21
#create one big lib
22 23 24
SET ( ONELIB OFF CACHE BOOL "build CGoGN in one lib" )

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

Sylvain Thery's avatar
Sylvain Thery committed
26 27

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

thery's avatar
thery committed
31
find_package(OpenGL REQUIRED)
32
find_package(Boost COMPONENTS regex thread system REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
33 34 35
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
36
find_package(SuiteSparse REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
37
find_package(QGLViewer REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
38

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

45 46 47 48 49 50 51 52 53
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)

54 55 56 57 58 59
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)

60 61 62 63 64 65 66
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)


67 68
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")

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

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

#optionnal libs
Sylvain Thery's avatar
Sylvain Thery committed
95
IF (WITH_ASSIMP)
96
	add_definitions(-DWITH_ASSIMP)	
97
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} assimp)
98
	INSTALL (DIRECTORY ThirdParty/Assimp/include  DESTINATION .)
Sylvain Thery's avatar
Sylvain Thery committed
99 100
ENDIF (WITH_ASSIMP)

101 102 103
IF (WITH_ZINRI)
	add_definitions(-DWITH_ZINRI)
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} Zinri)
104
	INSTALL (DIRECTORY ThirdParty/Zinri/ DESTINATION include FILES_MATCHING PATTERN "*.h")
105 106 107
ENDIF (WITH_ZINRI)

IF (WITH_QT)
108
	add_definitions(-DWITH_QT)
Sylvain Thery's avatar
Sylvain Thery committed
109 110
	find_package(Qt4 REQUIRED)
	SET(QT_USE_QTCORE TRUE)
111 112
	SET(QT_USE_QTOPENGL TRUE)
	SET(QT_USE_QTSVG TRUE)
Sylvain Thery's avatar
Sylvain Thery committed
113
	SET(QT_USE_QTXML TRUE )
114 115 116
	INCLUDE(${QT_USE_FILE})
	ADD_DEFINITIONS(${QT_DEFINITIONS})
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR})
117
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} )
118 119
ENDIF (WITH_QT)

120 121 122 123
IF (WITH_GLEWMX)
	ADD_DEFINITIONS(-DGLEW_MX)
ENDIF (WITH_GLEWMX)

124

Pierre Kraemer's avatar
Pierre Kraemer committed
125 126 127
# qq definition specifiques pour mac
IF(APPLE)
# attention a changer pour chercher la bonne version automatiquement
Sylvain Thery's avatar
Sylvain Thery committed
128
	SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "developer SDK")
Pierre Kraemer's avatar
Pierre Kraemer committed
129
	SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
130 131
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
	SET(CMAKE_OSX_ARCHITECTURES x86_64)
Thery Sylvain's avatar
Thery Sylvain committed
132
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} "-framework Foundation -framework cocoa" )
Pierre Kraemer's avatar
Pierre Kraemer committed
133 134 135 136 137
ENDIF(APPLE)

IF(WIN32)
	add_subdirectory(Release)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
unknown's avatar
unknown committed
138 139 140
	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
141
ELSE(WIN32)
142
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
143
	SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC")
Pierre Kraemer's avatar
Pierre Kraemer committed
144 145 146 147
	add_subdirectory(Release)
	add_subdirectory(Debug)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
ENDIF(WIN32)
148

149
INSTALL (DIRECTORY ${CGoGN_ROOT_DIR}/include ${CGoGN_ROOT_DIR}/lib ${CGoGN_ROOT_DIR}/bin DESTINATION .)
150
INSTALL (DIRECTORY ThirdParty/glm  DESTINATION include)
151 152
INSTALL (DIRECTORY cmake_modules  DESTINATION .)
INSTALL (FILES apps_cmake.txt  DESTINATION .)