1 | if(DEFINED FLAIRUSEFILE_INCLUDED)
|
---|
2 | return()
|
---|
3 | endif()
|
---|
4 |
|
---|
5 | SET(FLAIRUSEFILE_INCLUDED true)
|
---|
6 |
|
---|
7 | find_package(LibXml2 REQUIRED)
|
---|
8 | find_package(Xenomai QUIET)
|
---|
9 |
|
---|
10 | if(NOT XENOMAI_FOUND)
|
---|
11 | warn("Xenomai not found, you will not be able to link a real time program")
|
---|
12 | endif()
|
---|
13 |
|
---|
14 | execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
---|
15 | OUTPUT_VARIABLE GCC_VERSION)
|
---|
16 |
|
---|
17 | if (GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3)
|
---|
18 | if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
|
---|
19 | ADD_DEFINITIONS("-std=c++11")
|
---|
20 | else()
|
---|
21 | ADD_DEFINITIONS("-std=c++0x")
|
---|
22 | endif()
|
---|
23 | else()
|
---|
24 | message(STATUS "GCC version < 4.3, c+11 is not supported!")
|
---|
25 | endif()
|
---|
26 |
|
---|
27 | #check if we have a flair-hds directory
|
---|
28 | if (DEFINED FOUND_HDS_DIR)
|
---|
29 | SET(FLAIRHDS_LIBRARY_DIR
|
---|
30 | $ENV{FLAIR_ROOT}/flair-hds/bin/lib/${ARCH_DIR}
|
---|
31 | )
|
---|
32 | endif()
|
---|
33 |
|
---|
34 | SET(FLAIR_INCLUDE_DIR
|
---|
35 | ${LIBXML2_INCLUDE_DIR}
|
---|
36 | ${CMAKE_SYSROOT}/usr/include/opencv1
|
---|
37 | ${FLAIR_DEV}/include/FlairCore
|
---|
38 | )
|
---|
39 | SET(FLAIR_LIBRARY_DIR
|
---|
40 | ${FLAIR_BIN}/lib/${ARCH_DIR}
|
---|
41 | )
|
---|
42 |
|
---|
43 | SET(FLAIR_LIBRARIES
|
---|
44 | ${LIBXML2_LIBRARIES}
|
---|
45 | udt pthread cv cxcore highgui FileLib rt z
|
---|
46 | )
|
---|
47 |
|
---|
48 | #auto select dependencies
|
---|
49 | IF (FLAIR_USE_SIMULATOR)
|
---|
50 | SET(FLAIR_USE_VRPN TRUE)
|
---|
51 | ENDIF (FLAIR_USE_SIMULATOR)
|
---|
52 |
|
---|
53 | #VRPN for motion capture
|
---|
54 | IF (FLAIR_USE_VRPN)
|
---|
55 | SET(FLAIR_LIBRARIES vrpn ${FLAIR_LIBRARIES})
|
---|
56 | ENDIF (FLAIR_USE_VRPN)
|
---|
57 |
|
---|
58 | #nmea for GPS
|
---|
59 | IF (FLAIR_USE_GPS)
|
---|
60 | SET(FLAIR_LIBRARIES nmea ${FLAIR_LIBRARIES})
|
---|
61 | ENDIF (FLAIR_USE_GPS)
|
---|
62 |
|
---|
63 | #core, will be replace by rt or nrt version at the end
|
---|
64 | SET(FLAIR_LIBRARIES FlairCore ${FLAIR_LIBRARIES})
|
---|
65 |
|
---|
66 | #vision filter lib
|
---|
67 | IF (FLAIR_USE_VISION_FILTER)
|
---|
68 | if(FOUND_HDS_DIR AND ("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon" OR "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "core2-64"))
|
---|
69 | message(${PROJECT_NAME} ": using libdspcv_gpp.a for vision filter")
|
---|
70 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-hds/dev/include/VisionFilter)
|
---|
71 | SET(FLAIR_LIBRARIES ${FLAIRHDS_LIBRARY_DIR}/libVisionFilter.a ${FLAIRHDS_LIBRARY_DIR}/libdspcv_gpp.a ${FLAIR_LIBRARIES})
|
---|
72 | else()
|
---|
73 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-dev/include/FlairVisionFilter)
|
---|
74 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairVisionFilter.a ${FLAIR_LIBRARIES})
|
---|
75 | endif()
|
---|
76 | ENDIF (FLAIR_USE_VISION_FILTER)
|
---|
77 |
|
---|
78 | #sensor and actuator lib
|
---|
79 | IF (FLAIR_USE_SENSOR_ACTUATOR)
|
---|
80 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} ${FLAIR_DEV}/include/FlairSensorActuator)
|
---|
81 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSensorActuator.a nmea ${FLAIR_LIBRARIES})
|
---|
82 | ENDIF (FLAIR_USE_SENSOR_ACTUATOR)
|
---|
83 |
|
---|
84 | #filter lib
|
---|
85 | IF (FLAIR_USE_FILTER)
|
---|
86 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} ${FLAIR_DEV}/include/FlairFilter)
|
---|
87 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairFilter.a iir ${FLAIR_LIBRARIES})
|
---|
88 | ENDIF (FLAIR_USE_FILTER)
|
---|
89 |
|
---|
90 |
|
---|
91 | #meta lib
|
---|
92 | IF (FLAIR_USE_META)
|
---|
93 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} ${FLAIR_DEV}/include/FlairMeta)
|
---|
94 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairMeta.a ${FLAIR_LIBRARIES})
|
---|
95 | ENDIF (FLAIR_USE_META)
|
---|
96 |
|
---|
97 | #simulator lib
|
---|
98 | IF (FLAIR_USE_SIMULATOR)
|
---|
99 | if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
|
---|
100 | SET(FLAIR_USE_SIMULATOR_GL FALSE)
|
---|
101 | endif()
|
---|
102 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR}
|
---|
103 | ${FLAIR_DEV}/include/FlairSimulator
|
---|
104 | ${CMAKE_SYSROOT}/usr/include/irrlicht
|
---|
105 | )
|
---|
106 |
|
---|
107 | IF (FLAIR_USE_SIMULATOR_GL)
|
---|
108 | ADD_DEFINITIONS("-DGL")
|
---|
109 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_gl.a GL ${FLAIR_LIBRARIES} Irrlicht Xxf86vm)
|
---|
110 | else()
|
---|
111 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_nogl.a ${FLAIR_LIBRARIES})
|
---|
112 | endif()
|
---|
113 | ENDIF (FLAIR_USE_SIMULATOR)
|
---|
114 |
|
---|
115 | #set RT or NRT specific libraries
|
---|
116 | set(FLAIR_LIBRARIES_RT ${FLAIR_LIBRARIES} ${XENOMAI_LIBRARIES})
|
---|
117 |
|
---|
118 | list(FIND FLAIR_LIBRARIES_RT "FlairCore" POS)
|
---|
119 | if(POS GREATER -1)
|
---|
120 | list(REMOVE_AT FLAIR_LIBRARIES_RT ${POS})
|
---|
121 | list(INSERT FLAIR_LIBRARIES_RT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_rt.a")
|
---|
122 | endif()
|
---|
123 |
|
---|
124 | set(FLAIR_LIBRARIES_NRT ${FLAIR_LIBRARIES})
|
---|
125 |
|
---|
126 | list(FIND FLAIR_LIBRARIES_NRT "FlairCore" POS)
|
---|
127 | if(POS GREATER -1)
|
---|
128 | list(REMOVE_AT FLAIR_LIBRARIES_NRT ${POS})
|
---|
129 | list(INSERT FLAIR_LIBRARIES_NRT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_nrt.a")
|
---|
130 | endif()
|
---|
131 |
|
---|
132 | #add ardrone2, bebop or minidrones lib
|
---|
133 | if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon")
|
---|
134 | SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairArdrone2.a ${FLAIRHDS_LIBRARY_DIR}/libFlairBebop.a -Wl,--no-whole-archive)
|
---|
135 | set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
|
---|
136 | set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
|
---|
137 | endif()
|
---|
138 | if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
|
---|
139 | SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairMinidrones.a ${FLAIRHDS_LIBRARY_DIR}/libFlairMamboEdu.a -Wl,--no-whole-archive)
|
---|
140 | set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
|
---|
141 | set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
|
---|
142 | endif()
|
---|