CMakeLists.txt 3.25 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 5 6

project(CGoGN)

SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/..)

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

Sylvain Thery's avatar
Sylvain Thery committed
10
# for shared or not shared
11 12 13 14 15
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_NUMERICAL ON CACHE BOOL "build CGoGN with Numerical libs support ")
SET ( WITH_ZINRI ON CACHE BOOL "build CGoGN with Zinri lib  ")
SET ( WITH_QT ON CACHE BOOL "build CGoGN with Qt lib  ")
Sylvain Thery's avatar
Sylvain Thery committed
16

thery's avatar
thery committed
17
find_package(OpenGL REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
18
find_package(Boost COMPONENTS regex thread REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
19 20 21
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
22

Pierre Kraemer's avatar
Pierre Kraemer committed
23

24 25 26 27 28 29
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
30

31 32
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")

Sylvain Thery's avatar
Sylvain Thery committed
33 34 35 36 37 38 39
# 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}
40
	${Boost_INCLUDE_DIRS} )
Sylvain Thery's avatar
Sylvain Thery committed
41 42 43 44 45 46 47 48

# define libs for external libs
SET (CGoGN_EXT_LIBS 
	${OPENGL_LIBRARY}
	${GLEW_LIBRARIES}
	${ZLIB_LIBRARIES}
	${LIBXML2_LIBRARIES}
	${Boost_REGEX_LIBRARY}
49 50 51
	${Boost_THREAD_LIBRARY} )

#optionnal libs
Sylvain Thery's avatar
Sylvain Thery committed
52
IF (WITH_ASSIMP)
53 54
	add_definitions(-DWITH_ASSIMP)	
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ThirdParty/Assimp/include)
55
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} assimp)
Sylvain Thery's avatar
Sylvain Thery committed
56 57
ENDIF (WITH_ASSIMP)

58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
IF (WITH_NUMERICAL)
#	add_definitions(-DWITH_NUMERICAL)
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} 	${CGoGN_ROOT_DIR}/ThirdParty/Numerical ${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig)
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} numerical)
ENDIF (WITH_NUMERICAL)

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)
ENDIF (WITH_ZINRI)

IF (WITH_QT)
	find_package(Qt4 REQUIRED)
	add_definitions(-DWITH_QT)
	SET(QT_USE_QTOPENGL TRUE)
	INCLUDE(${QT_USE_FILE})
	ADD_DEFINITIONS(${QT_DEFINITIONS})
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR})
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES})
ENDIF (WITH_QT)

Sylvain Thery's avatar
Sylvain Thery committed
80

Pierre Kraemer's avatar
Pierre Kraemer committed
81 82 83
# qq definition specifiques pour mac
IF(APPLE)
# attention a changer pour chercher la bonne version automatiquement
Sylvain Thery's avatar
Sylvain Thery committed
84
	SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "developer SDK")
Pierre Kraemer's avatar
Pierre Kraemer committed
85
	SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
86 87
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
	SET(CMAKE_OSX_ARCHITECTURES x86_64)
Pierre Kraemer's avatar
Pierre Kraemer committed
88 89 90
ENDIF(APPLE)

IF(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
91 92
#	INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/)
#	LINK_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/lib/ ${boost_path}/lib)
Pierre Kraemer's avatar
Pierre Kraemer committed
93 94
	add_subdirectory(Release)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
Sylvain Thery's avatar
Sylvain Thery committed
95
#	if(CMAKE_CONFIGURATION_TYPES)
sylvain thery's avatar
sylvain thery committed
96
		set(CMAKE_CONFIGURATION_TYPES Release Debug)
thery's avatar
thery committed
97
		set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
Sylvain Thery's avatar
Sylvain Thery committed
98
#	endif()
Pierre Kraemer's avatar
Pierre Kraemer committed
99 100 101 102 103 104
ELSE(WIN32)
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
	add_subdirectory(Release)
	add_subdirectory(Debug)
	add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
ENDIF(WIN32)
105