CMakeLists.txt 2.91 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 7 8 9 10 11

project(CGoGN)

# a decommenter si on veut voir ce qui se passe a la compilation
#set( CMAKE_VERBOSE_MAKEFILE 1 )

SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/..)

SET(CMAKE_MODULE_PATH " ${CMAKE_MODULE_PATH} ${CGoGN_ROOT_DIR}/cmake_modules/")

Sylvain Thery's avatar
Sylvain Thery committed
12 13 14 15 16 17 18 19 20 21

SET ( BUILD_SHARED_LIBRARIES OFF CACHE BOOL 
	"if used all library are build as shared type (.so /dylib/dll)."
)

IF ( BUILD_SHARED_LIBRARIES )
	SET (SHARED_OR_STATIC SHARED)
ENDIF ( BUILD_SHARED_LIBRARIES )


thery's avatar
thery committed
22 23
find_package(OpenGL REQUIRED)
find_package(Qt4 REQUIRED)
Sylvain Thery's avatar
Sylvain Thery committed
24 25
find_package(Boost COMPONENTS regex thread REQUIRED)

Pierre Kraemer's avatar
Pierre Kraemer committed
26

27 28 29 30 31 32 33 34
IF (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
ELSE (DEFINED ASSERTON)
	add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON)

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

Pierre Kraemer's avatar
Pierre Kraemer committed
35 36 37
# qq definition specifiques pour mac
IF(APPLE)
# attention a changer pour chercher la bonne version automatiquement
Sylvain Thery's avatar
Sylvain Thery committed
38
	SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING)
Pierre Kraemer's avatar
Pierre Kraemer committed
39
	SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
40 41
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
	SET(CMAKE_OSX_ARCHITECTURES x86_64)
Pierre Kraemer's avatar
Pierre Kraemer committed
42 43 44 45 46 47 48
ENDIF(APPLE)

IF(WIN32)
	SET(GLEW_LIBRARY glew32)
	SET(DEVIL_LIBRARIES DevIL ILU ILUT)
	SET(ZLIB_LIBRARIES zlib)
	SET(LIBXML2_LIBRARIES xml2)
49
	
Sylvain Thery's avatar
Sylvain Thery committed
50 51 52 53 54 55 56 57
#	MACRO(BOOST_LIBS lib_lists names)
#	SET (${lib_lists} "")
#	FOREACH(name ${names})
#		STRING(REGEX REPLACE "-mt" ${boost_extension} newname ${name})
#		SET (${lib_lists} ${${lib_lists}} ${newname} )
#	ENDFOREACH(name)
#	ENDMACRO(BOOST_LIBS)
#	set (BOOST_INCLUDE_PATH ${boost_path})
58
	
sylvain thery's avatar
sylvain thery committed
59
	INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/)
thery's avatar
thery committed
60
	LINK_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/lib/ ${boost_path}/lib)
Pierre Kraemer's avatar
Pierre Kraemer committed
61 62 63 64 65
	add_subdirectory(Release)
	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")
sylvain thery's avatar
sylvain thery committed
66 67 68

	if(CMAKE_CONFIGURATION_TYPES)
		set(CMAKE_CONFIGURATION_TYPES Release Debug)
thery's avatar
thery committed
69
		set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
sylvain thery's avatar
sylvain thery committed
70 71
	endif()
	
Pierre Kraemer's avatar
Pierre Kraemer committed
72 73 74 75 76 77 78 79 80 81 82
ELSE(WIN32)
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
	find_package(DevIL)
	find_package(ZLIB)
	find_package(LibXml2)
	SET(GLEW_LIBRARY GLEW)
	IF (IL_LIBRARIES)
		SET(DEVIL_LIBRARIES ${IL_LIBRARIES} ${ILU_LIBRARIES} ${ILUT_LIBRARIES})
	ELSE(IL_LIBRARIES)
		SET(DEVIL_LIBRARIES ${IL_LIBRARY} ${ILU_LIBRARY} ${ILUT_LIBRARY})
	ENDIF(IL_LIBRARIES)
83
	
Sylvain Thery's avatar
Sylvain Thery committed
84 85 86 87 88 89
#	MACRO(BOOST_LIBS lib_lists names)
#	SET (${lib_lists})
#	FOREACH(name ${names})
#		SET (${lib_lists} ${${lib_lists}} ${name} )
#	ENDFOREACH(name)
#	ENDMACRO(BOOST_LIBS)
thery's avatar
thery committed
90

Pierre Kraemer's avatar
Pierre Kraemer committed
91 92 93 94 95 96 97
	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)