apps_cmake.txt 3.45 KB
Newer Older
1
# A mettre juste apres la definition de CGoGN_ROOT_DIR a la racine du CGoGN_Apps
2
# include(${CGoGN_ROOT_DIR}/build/apps_cmake.txt)
3

4
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)
5

Sylvain Thery's avatar
Sylvain Thery committed
6
SET ( WITH_ASSIMP ON CACHE BOOL "need Assimp")
7 8
SET ( WITH_ZINRI ON CACHE BOOL "need Zinri lib")
SET ( WITH_QT ON CACHE BOOL "need Qt lib")
Sylvain Thery's avatar
Sylvain Thery committed
9

10 11 12 13 14 15
# for CGoGN MR
file(STRINGS ${CGoGN_ROOT_DIR}/include/cgogn_mr.h FORCE_MR)
IF (FORCE_MR EQUAL 1)
	add_definitions(-DCGoGN_FORCE_MR=1)
ENDIF (FORCE_MR EQUAL 1)

Pierre Kraemer's avatar
Pierre Kraemer committed
16
# for CGoGN in one lib or not
17 18 19 20 21 22 23 24 25
file(STRINGS ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h ONELIB_STR)
IF (ONELIB_STR EQUAL 1)
	SET(CGoGN_LIBS_D cgognD)
	SET(CGoGN_LIBS_R cgogn)
ELSE (ONELIB_STR EQUAL 1)
	SET(CGoGN_LIBS_D topologyD algoD containerD utilsD)
	SET(CGoGN_LIBS_R topology algo container utils)
ENDIF (ONELIB_STR EQUAL 1)

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

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

37 38 39 40 41 42
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
43 44 45
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")

# define includes of external libs 
46
SET(COMMON_INCLUDES 
47
	${CGoGN_ROOT_DIR}/ThirdParty/include
Sylvain Thery's avatar
Sylvain Thery committed
48 49 50 51
	${OPENGL_INCLUDE_DIR}
	${GLEW_INCLUDE_DIRS}
	${ZLIB_INCLUDE_DIRS}
	${LIBXML2_INCLUDE_DIR}
52 53
	${Boost_INCLUDE_DIRS}
)
Sylvain Thery's avatar
Sylvain Thery committed
54 55 56

# define libs for external libs
SET (COMMON_LIBS 
57
	nl
Sylvain Thery's avatar
Sylvain Thery committed
58 59 60 61
	${OPENGL_LIBRARY}
	${GLEW_LIBRARIES}
	${ZLIB_LIBRARIES}
	${LIBXML2_LIBRARIES}
62
	${Boost_SYSTEM_LIBRARY}
Sylvain Thery's avatar
Sylvain Thery committed
63
	${Boost_REGEX_LIBRARY}
64
	${Boost_THREAD_LIBRARY}
65
	${SUITESPARSE_LIBRARIES}
66
)
Sylvain Thery's avatar
Sylvain Thery committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80

#optionnal libs
IF (WITH_ASSIMP)
	add_definitions(-DWITH_ASSIMP)	
	SET (COMMON_LIBS ${COMMON_LIBS} assimp)
ENDIF (WITH_ASSIMP)

IF (WITH_ZINRI)
	add_definitions(-DWITH_ZINRI)
	SET (COMMON_LIBS ${COMMON_LIBS} Zinri)
ENDIF (WITH_ZINRI)

IF (WITH_QT)
	add_definitions(-DWITH_QT)
Sylvain Thery's avatar
Sylvain Thery committed
81 82
	find_package(Qt4 REQUIRED)
	SET(QT_USE_QTCORE TRUE)
Sylvain Thery's avatar
Sylvain Thery committed
83
	SET(QT_USE_QTOPENGL TRUE)
Sylvain Thery's avatar
Sylvain Thery committed
84 85
	SET(QT_USE_QTSVG TRUE)
	SET(QT_USE_QTXML TRUE )
Sylvain Thery's avatar
Sylvain Thery committed
86 87
	INCLUDE(${QT_USE_FILE})
	ADD_DEFINITIONS(${QT_DEFINITIONS})
Sylvain Thery's avatar
Sylvain Thery committed
88 89 90
	find_package(QGLViewer REQUIRED)
	SET (COMMON_INCLUDES ${COMMON_INCLUDES} ${QT_INCLUDE_DIR} ${QGLVIEWER_INCLUDE_DIR})
	SET (COMMON_LIBS ${COMMON_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES})
Sylvain Thery's avatar
Sylvain Thery committed
91 92
ENDIF (WITH_QT)

93 94
# qq definition specifiques pour mac
IF(APPLE)
Sylvain Thery's avatar
Sylvain Thery committed
95 96
# attention a changer pour chercher la bonne version automatiquement
	SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "developer SDK")
97 98 99 100 101
	SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
	SET(CMAKE_OSX_ARCHITECTURES x86_64)
ENDIF(APPLE)

102
# qq definition specifiques pour windows
103
IF(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
104 105 106
	set(CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies")
	set(CMAKE_CONFIGURATION_TYPES Release Debug)
	set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
107
ELSE(WIN32)
108
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra ")
109 110
ENDIF(WIN32)

Sylvain Thery's avatar
Sylvain Thery committed
111
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
Sylvain Thery's avatar
Sylvain Thery committed
112

113 114 115 116 117
IF(WIN32)
	link_directories( ${CGoGN_ROOT_DIR}/lib/ ${Boost_LIBRARY_DIRS} )
ELSE (WIN32)
	link_directories( ${CGoGN_ROOT_DIR}/lib/Debug ${CGoGN_ROOT_DIR}/lib/Release)
ENDIF (WIN32)