CMakeLists.txt 5.04 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)

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

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

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

Sylvain Thery's avatar
Sylvain Thery committed
12
# for shared or not shared
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  ")
17
SET ( WITH_NUMERICAL ON CACHE BOOL "build CGoGN with Numerical libs support ")
18
# for CGoGN MR
19
SET ( FORCE_MR "0" CACHE STRING "0: normal mode / 1 multires mode")
20 21
#create one big lib
SET ( ONELIB OFF CACHE BOOL "build CGoGN in one lib")
22 23
SET ( WITH_GLEWMX OFF CACHE BOOL "use multi-contex GLEW")

Sylvain Thery's avatar
Sylvain Thery committed
24 25 26 27

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

thery's avatar
thery committed
29
find_package(OpenGL REQUIRED)
30
find_package(Boost COMPONENTS regex thread system REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
31 32 33
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
34

Pierre Kraemer's avatar
Pierre Kraemer committed
35

36 37 38 39 40 41
IF (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
ELSE (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON)

Sylvain Thery's avatar
Sylvain Thery committed
42

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

52 53 54 55 56 57 58

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)

59 60 61 62 63 64 65 66 67

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)



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

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

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

#optionnal libs
Sylvain Thery's avatar
Sylvain Thery committed
90
IF (WITH_ASSIMP)
91
	add_definitions(-DWITH_ASSIMP)	
sylvain's avatar
sylvain committed
92
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include)	
93
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} assimp)
94
	INSTALL (DIRECTORY ThirdParty/Assimp/include  DESTINATION .)
Sylvain Thery's avatar
Sylvain Thery committed
95 96
ENDIF (WITH_ASSIMP)

97 98 99 100
IF (WITH_ZINRI)
	add_definitions(-DWITH_ZINRI)
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} 	${CGoGN_ROOT_DIR}/ThirdParty/Zinri)
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} Zinri)
101
	INSTALL (DIRECTORY ThirdParty/Zinri/ DESTINATION include FILES_MATCHING PATTERN "*.h")
102 103 104
ENDIF (WITH_ZINRI)

IF (WITH_QT)
105 106
	SET(QT_USE_QTOPENGL TRUE)
	SET(QT_USE_QTSVG TRUE)
107 108 109 110 111
	find_package(Qt4 REQUIRED)
	add_definitions(-DWITH_QT)
	INCLUDE(${QT_USE_FILE})
	ADD_DEFINITIONS(${QT_DEFINITIONS})
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR})
112
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} )
113 114
ENDIF (WITH_QT)

115 116 117 118
IF (WITH_GLEWMX)
	ADD_DEFINITIONS(-DGLEW_MX)
ENDIF (WITH_GLEWMX)

Sylvain Thery's avatar
Sylvain Thery committed
119 120 121 122 123
#IF (WITH_NUMERICAL)
#	add_definitions(-DWITH_NUMERICAL)
#	SET (CGoGN_NUMERICAL_INCLUDES  ${CGoGN_ROOT_DIR}/ThirdParty/Numerical ${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig)
#	SET (CGoGN_NUMERICAL_LIBS f2c  blas  numerical lapack)
#ENDIF (WITH_NUMERICAL)
Sylvain Thery's avatar
Sylvain Thery committed
124

125 126 127 128 129 130
IF (WITH_NUMERICAL)
	INSTALL(FILES ThirdParty/Numerical/UFconfig/UFconfig.h DESTINATION include )
	INSTALL(DIRECTORY ThirdParty/Numerical/ DESTINATION include FILES_MATCHING PATTERN "*.h")
	INSTALL(DIRECTORY ThirdParty/Numerical/ DESTINATION include FILES_MATCHING PATTERN "*.hpp")
ENDIF (WITH_NUMERICAL)

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

IF(WIN32)
	add_subdirectory(Release)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
unknown's avatar
unknown committed
144 145 146
	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
147
ELSE(WIN32)
148
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
149
	SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC")
Pierre Kraemer's avatar
Pierre Kraemer committed
150 151 152 153
	add_subdirectory(Release)
	add_subdirectory(Debug)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
ENDIF(WIN32)
154

155 156 157 158 159
INSTALL (DIRECTORY ${CGoGN_ROOT_DIR}/include ${CGoGN_ROOT_DIR}/lib ${CGoGN_ROOT_DIR}/bin DESTINATION .)
INSTALL (DIRECTORY ThirdParty/glm/glm  DESTINATION include)
INSTALL (DIRECTORY cmake_modules  DESTINATION .)
INSTALL (FILES apps_cmake.txt  DESTINATION .)