-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
106 lines (87 loc) · 3.36 KB
/
CMakeLists.txt
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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#################################
# libkovan CMake Build File #
#################################
project(libkovan)
cmake_minimum_required(VERSION 2.8.0)
set(INCLUDE ${libkovan_SOURCE_DIR}/include)
set(SRC ${libkovan_SOURCE_DIR}/src)
set(PIXELTOASTER ${SRC}/pixeltoaster)
include_directories(${INCLUDE})
file(GLOB INCLUDES ${INCLUDE}/kovan/*.h ${INCLUDE}/kovan/*.hpp)
file(GLOB SOURCES ${SRC}/*.cpp ${PIXELTOASTER}/*.cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
#############################
# PixelToaster settings #
#############################
if(APPLE)
file(GLOB OBJC_SOURCES ${PIXELTOASTER}/*.mm)
elseif(WIN32)
add_definitions(-fno-check-new)
endif()
##################################
# Windows kiss-platform nonsense #
##################################
if(WIN32)
set(OPENCV_INSTALL_DIR ${CMAKE_SOURCE_DIR}/../opencv/build/)
set(ZBAR_INSTALL_DIR "C:/Program Files (x86)/ZBar")
include_directories(${CMAKE_SOURCE_DIR}/../prefix/include)
include_directories(${OPENCV_INSTALL_DIR}/include)
include_directories(${ZBAR_INSTALL_DIR}/include)
link_directories(${CMAKE_SOURCE_DIR}/../prefix/lib)
link_directories(${OPENCV_INSTALL_DIR}/x86/vc11/lib)
link_directories(${ZBAR_INSTALL_DIR}/lib)
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -g")
elseif(WIN32)
set(SOURCES ${SOURCES} ${CMAKE_SOURCE_DIR}/compat/mingw.cpp)
elseif(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
# add_definitions(-O3)
add_library(kovan SHARED ${SOURCES} ${OBJC_SOURCES} ${INCLUDES})
if(WIN32)
# TODO: Make sure these are current
target_link_libraries(kovan opencv_core246 opencv_highgui246 opencv_imgproc246 libzbar-0)
target_link_libraries(kovan d3d9)
else()
target_link_libraries(kovan pthread opencv_core opencv_highgui opencv_imgproc zbar avcodec avformat avutil z swscale bz2)
endif()
if(APPLE)
find_library(OPENGL_LIBRARY OpenGL)
find_library(COCOA_LIBRARY Cocoa)
find_library(CORESERVICE_LIBRARY CoreServices)
target_link_libraries(kovan ${OPENGL_LIBRARY} ${COCOA_LIBRARY} ${CORESERVICE_LIBRARY})
endif()
if(KOVAN)
target_link_libraries(kovan i2c_wrapper)
add_definitions(-DKOVAN)
endif()
# add_definitions(-DARDRONE_DEBUG)
if(WIN32)
target_link_libraries(kovan ws2_32)
install(FILES ${INCLUDES} DESTINATION ${CMAKE_SOURCE_DIR}/../prefix/include/kovan)
install(TARGETS kovan
ARCHIVE DESTINATION ${CMAKE_SOURCE_DIR}/../prefix/lib
RUNTIME DESTINATION ${CMAKE_SOURCE_DIR}/../prefix/lib)
else()
install(FILES ${INCLUDES} DESTINATION include/kovan)
install(TARGETS kovan LIBRARY DESTINATION lib)
endif()
option(BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" ON)
if(BUILD_DOCUMENTATION)
FIND_PACKAGE(Doxygen)
if(NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
endif()
set(DOXYGEN_DIR ${PROJECT_SOURCE_DIR}/doxygen)
add_custom_target (Docs++ ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_DIR}/Doxyfile++ SOURCES ${DOXYGEN_DIR}/Doxyfile++
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_custom_target (Docs ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_DIR}/Doxyfile SOURCES ${DOXYGEN_DIR}/Doxyfile
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_custom_target(DocMetadata ALL
COMMAND ${CMAKE_COMMAND} -E copy ${DOXYGEN_DIR}/metadata.ini ${PROJECT_SOURCE_DIR}/doc)
endif()