CMakeLists.txt 3.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
cmake_minimum_required(VERSION 2.8)

project(CGoGN_LIB)

# for shaders
include_directories( ${CMAKE_CURRENT_BINARY_DIR} 	)



file(
	GLOB_RECURSE
	files_topology
	${CGoGN_SRC_DIR}/src/Topology/*.cpp
	${CGoGN_SRC_DIR}/include/Topology/*.hpp
	${CGoGN_SRC_DIR}/include/Topology/*.h
)

file(
	GLOB_RECURSE
	files_container
	${CGoGN_SRC_DIR}/src/Container/*.cpp
	${CGoGN_SRC_DIR}/include/Container/*.hpp
	${CGoGN_SRC_DIR}/include/Container/*.h
)

file(
	GLOB_RECURSE
	files_algo
	${CGoGN_SRC_DIR}/src/Algo/*.cpp
	${CGoGN_SRC_DIR}/src/Algo/*.c
	${CGoGN_SRC_DIR}/include/Algo/*.hpp
	${CGoGN_SRC_DIR}/include/Algo/*.h
)

file(
	GLOB
	shaders_src
	${CGoGN_SRC_DIR}/include/Utils/*.frag
	${CGoGN_SRC_DIR}/include/Utils/*.vert
	${CGoGN_SRC_DIR}/include/Utils/*.geom	
	${CGoGN_SRC_DIR}/include/Utils/Shaders/*.frag
	${CGoGN_SRC_DIR}/include/Utils/Shaders/*.vert
	${CGoGN_SRC_DIR}/include/Utils/Shaders/*.geom
)


IF(WIN32)
Sylvain Thery's avatar
Sylvain Thery committed
48
	add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/bin/$(ConfigurationName)/shader_to_h ${shaders_src}
49 50 51 52 53 54 55
	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
	SOURCES ${shaders_src} )
ELSE()
	add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/bin/shader_to_h ${shaders_src}
	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
	SOURCES ${shaders_src} )
ENDIF()
Sylvain Thery's avatar
Sylvain Thery committed
56
add_dependencies(shader_target shader_to_h) #ensure that shader_to_h is compiled
57 58 59 60 61 62 63 64 65 66 67 68 69

file(
	GLOB		# WARNING NO MORE RECURSE TO AVOID TAKING QT FILES
	files_utils
	${CGoGN_SRC_DIR}/src/Utils/*.cpp
	${CGoGN_SRC_DIR}/include/Utils/*.hpp
	${CGoGN_SRC_DIR}/include/Utils/*.h

	${CGoGN_SRC_DIR}/src/Utils/Shaders/*.cpp
	${CGoGN_SRC_DIR}/include/Utils/Shaders/*.hpp
	${CGoGN_SRC_DIR}/include/Utils/Shaders/*.h
)

70
IF(CGoGN_WITH_QT)
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
	file(
		GLOB
		files_utils_qt
		${CGoGN_SRC_DIR}/src/Utils/Qt/*.cpp
		${CGoGN_SRC_DIR}/include/Utils/Qt/*.hpp
		${CGoGN_SRC_DIR}/include/Utils/Qt/*.h
	)
	file(
		GLOB
		utils_qt_headers
		${CGoGN_SRC_DIR}/include/Utils/Qt/qtgl.h
		${CGoGN_SRC_DIR}/include/Utils/Qt/qtSimple.h
		${CGoGN_SRC_DIR}/include/Utils/Qt/qtQGLV_glw.h
		${CGoGN_SRC_DIR}/include/Utils/Qt/qtQGLV.h
		${CGoGN_SRC_DIR}/include/Utils/Qt/qtpopup.h
		${CGoGN_SRC_DIR}/include/Utils/Qt/qthistodraw.h 
		${CGoGN_SRC_DIR}/include/Utils/Qt/qtcolorschooser.h
	)	
		
Sylvain Thery's avatar
Sylvain Thery committed
90
	qt_wrap_cpp(UTILS_QT_HEADERS_MOC ${utils_qt_headers})
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
	SET (files_utils_withQt ${files_utils} ${files_utils_qt} ${UTILS_QT_HEADERS_MOC})
ENDIF()

file(	GLOB_RECURSE
		files_geometry
		${CGoGN_SRC_DIR}/include/Geometry/*.h
		${CGoGN_SRC_DIR}/include/Geometry/*.hpp
)

file(	GLOB_RECURSE
		files_thirdParty
		${CGoGN_ROOT_DIR}/ThirdParty/include/*.h
		${CGoGN_ROOT_DIR}/ThirdParty/include/*.hpp
)

Sylvain Thery's avatar
Sylvain Thery committed
106
#link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
107

108 109
IF (CGoGN_ONELIB)
	IF(CGoGN_WITH_QT)
Sylvain Thery's avatar
Sylvain Thery committed
110
		add_definitions(-DCGoGN_QT_DLL_EXPORT)
111
		add_library( cgogn ${files_topology} ${files_container} ${files_algo} ${files_utils_withQt}) 
Sylvain Thery's avatar
Sylvain Thery committed
112
		qt_use_modules(cgogn Gui OpenGL Xml Svg)
113 114 115 116 117 118 119
	ELSE()
		add_library( cgogn ${files_topology} ${files_container} ${files_algo} ${files_utils} )
	ENDIF()
	add_dependencies(cgogn shader_target)
	target_link_libraries(cgogn ${CGoGN_EXT_LIBS})

ELSE()
120
	IF (CGoGN_WITH_QT)
Sylvain Thery's avatar
Sylvain Thery committed
121
		add_definitions(-DCGoGN_QT_DLL_EXPORT)
122
		add_library( utils ${files_utils_withQt} )
Sylvain Thery's avatar
Sylvain Thery committed
123
		qt_use_modules(utils Gui OpenGL Xml Svg)
124 125 126 127 128
	ELSE()
		add_library( utils ${files_utils} )
	ENDIF()
	target_link_libraries(utils ${CGoGN_EXT_LIBS})

Sylvain Thery's avatar
Sylvain Thery committed
129
	add_library( container ${files_container})
130 131
	target_link_libraries(container utils)

Sylvain Thery's avatar
Sylvain Thery committed
132
	add_library( topology ${files_topology})
133 134
	target_link_libraries(topology container)

Sylvain Thery's avatar
Sylvain Thery committed
135
	add_library( algo	${files_algo})
136 137 138 139 140 141 142
	target_link_libraries(algo utils topology)


	add_custom_target( Geometry 	SOURCES ${files_geometry} )
	add_custom_target( ThirdParty 	SOURCES ${files_thirdParty} )
	add_dependencies( utils shader_target )
ENDIF()