CMakeLists.txt 2.87 KB
Newer Older
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}/..)

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

10 11 12
# for shared or not shared
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
13 14


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

Pierre Kraemer's avatar
Pierre Kraemer committed
22

23 24 25 26 27 28
IF (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
ELSE (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON)

29 30 31 32 33 34 35 36 37 38 39
SET ( WITH_ASSIMP ON CACHE BOOL "build CGoGN with Assimp ")
IF (WITH_ASSIMP)
	add_definitions(-DWITH_ASSIMP)
ENDIF (WITH_ASSIMP)

# FOR Qt4
SET(QT_USE_QTOPENGL TRUE)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})


40 41
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
# define includes of external libs 
SET(CGoGN_EXT_INCLUDES 
	${CGoGN_ROOT_DIR}/ThirdParty/Numerical
	${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig
	${CGoGN_ROOT_DIR}/ThirdParty/gzstream
	${CGoGN_ROOT_DIR}/ThirdParty/Zinri
	${CGoGN_ROOT_DIR}/ThirdParty/glm
	${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include
	${OPENGL_INCLUDE_DIR}
	${GLEW_INCLUDE_DIRS}
	${ZLIB_INCLUDE_DIRS}
	${LIBXML2_INCLUDE_DIR}
	${Boost_INCLUDE_DIRS} 
	${QT_INCLUDE_DIR} )

IF (WITH_ASSIMP)
	SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ThirdParty/Assimp/include)
ENDIF (WITH_ASSIMP)

# define libs for external libs
SET (CGoGN_EXT_LIBS 
	${OPENGL_LIBRARY}
	${GLEW_LIBRARIES}
	${ZLIB_LIBRARIES}
	${LIBXML2_LIBRARIES}
	${Boost_REGEX_LIBRARY}
	${Boost_THREAD_LIBRARY}
	${QT_LIBRARIES}
	gzstream)
	
IF (WITH_ASSIMP)
	SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} assimp)
ENDIF (WITH_ASSIMP)


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

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