CMakeLists.txt 2.96 KB
Newer Older
Sylvain Thery's avatar
Sylvain Thery committed
1
cmake_minimum_required(VERSION 2.8)
2
include(ExternalProject)
3

Pierre Kraemer's avatar
Pierre Kraemer committed
4 5
project(CGoGN_ThirdParty)

6 7


8
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/..)
unknown's avatar
unknown committed
9 10

IF(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
11
	
unknown's avatar
unknown committed
12 13 14
ENDIF(WIN32)

IF (${CMAKE_CURRENT_BINARY_DIR} MATCHES "(.*)Debug")
Sylvain Thery's avatar
Sylvain Thery committed
15 16 17 18
	set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Debug/Release" FORCE)
ELSE()
	set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Debug/Release" FORCE)	
ENDIF()
unknown's avatar
unknown committed
19 20

IF(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
21
	set(CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies")
unknown's avatar
unknown committed
22
	INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/)
unknown's avatar
unknown committed
23
	INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/suitesparse)
Sylvain Thery's avatar
Sylvain Thery committed
24 25 26 27 28 29 30 31 32 33
	SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib)
	set(CMAKE_CONFIGURATION_TYPES Release Debug)
#	SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
#	SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "" FORCE)
#	MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES)
ELSE()
	SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
ENDIF()
IF(WIN32)
	
unknown's avatar
unknown committed
34 35
ENDIF(WIN32)

Sylvain Thery's avatar
Sylvain Thery committed
36

unknown's avatar
unknown committed
37

Sylvain Thery's avatar
Sylvain Thery committed
38 39
# for shared or not shared
SET (BUILD_SHARED_LIBS OFF CACHE BOOL 
40
	"if used all library are build as shared type (.so/.dylib/.dll)")
Sylvain Thery's avatar
Sylvain Thery committed
41

42
SET (WITH_TINYXML2 ON CACHE BOOL "get & build tinyxml2")
Sylvain Thery's avatar
Sylvain Thery committed
43
SET (WITH_ASSIMP OFF CACHE BOOL "build with Assimp")
44
SET (WITH_ZINRI ON CACHE BOOL "build with Zinri libs")
Thery Sylvain's avatar
Thery Sylvain committed
45
SET (WITH_PYTHONQT ON CACHE BOOL "build PythonQt (for Schnapps)")
Sylvain Thery's avatar
Sylvain Thery committed
46

47 48 49
IF (APPLE)
	SET(CMAKE_OSX_ARCHITECTURES x86_64)
ENDIF(APPLE)
50 51 52

add_subdirectory(Tools Tools/build)

Thery Sylvain's avatar
Thery Sylvain committed
53 54 55 56
IF (WITH_PYTHONQT)
	add_subdirectory(PythonQt PythonQt/build)
	INSTALL (DIRECTORY PythonQt/src/ DESTINATION ${CGoGN_ROOT_DIR}/ThirdParty/include/PythonQt FILES_MATCHING PATTERN "*.h")
ENDIF (WITH_PYTHONQT)
57

58 59 60
add_subdirectory(OpenNL OpenNL/build)
INSTALL (DIRECTORY OpenNL/src/NL/ DESTINATION ${CGoGN_ROOT_DIR}/ThirdParty/include/NL FILES_MATCHING PATTERN "*.h")

61 62 63
add_subdirectory(tetgen tetgen/build)
INSTALL (DIRECTORY tetgen/ DESTINATION ${CGoGN_ROOT_DIR}/ThirdParty/include/tetgen FILES_MATCHING PATTERN "*.h")

64 65
IF (WITH_ZINRI)
	add_subdirectory(Zinri Zinri/build)
66
	INSTALL (DIRECTORY Zinri/ DESTINATION ${CGoGN_ROOT_DIR}/ThirdParty/include/Zinri FILES_MATCHING PATTERN "*.h")
67 68
ENDIF(WITH_ZINRI)

Sylvain Thery's avatar
Sylvain Thery committed
69
IF (WITH_ASSIMP)
70
	add_subdirectory(Assimp Assimp/build)
71
	INSTALL (DIRECTORY Assimp/include/ DESTINATION ${CGoGN_ROOT_DIR}/ThirdParty/include/Assimp)
Sylvain Thery's avatar
Sylvain Thery committed
72
ENDIF (WITH_ASSIMP)
73

74 75 76 77 78 79 80 81 82 83 84
IF (WITH_TINYXML2)
	ExternalProject_Add(
		Tinyxml2
		PREFIX ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2
		GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
		CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:string=${CMAKE_BUILD_TYPE}"
		CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CGoGN_ROOT_DIR}/ThirdParty/TinyXml2"
		BUILD_COMMAND make
		INSTALL_COMMAND make install
	)
	INSTALL (DIRECTORY TinyXml2/include/ DESTINATION ${CGoGN_ROOT_DIR}/ThirdParty/include)
Sylvain Thery's avatar
Sylvain Thery committed
85 86 87 88
	FILE(GLOB_RECURSE tinyLib_files ${CGoGN_ROOT_DIR}/ThirdParty/TinyXml2/lib/*.so.* ${CGoGN_ROOT_DIR}/ThirdParty/TinyXml2/lib/*.a )
	INSTALL (FILES ${tinyLib_files} DESTINATION ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})

ENDIF (WITH_TINYXML2)