[302] | 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 | SET(FLAIR_INCLUDE_DIR
|
---|
| 28 | $ENV{FLAIR_ROOT}/flair-install/include/FlairCore
|
---|
| 29 | )
|
---|
| 30 | SET(FLAIR_LIBRARY_DIR
|
---|
| 31 | $ENV{FLAIR_ROOT}/flair-install/lib/${ARCH_DIR}
|
---|
| 32 | )
|
---|
| 33 |
|
---|
| 34 | SET(FLAIR_LIBRARIES
|
---|
| 35 | ${LIBXML2_LIBRARIES}
|
---|
[338] | 36 | udt pthread FileLib rt z
|
---|
[302] | 37 | )
|
---|
| 38 |
|
---|
| 39 | #auto select dependencies
|
---|
| 40 | IF (FLAIR_USE_SIMULATOR)
|
---|
| 41 | SET(FLAIR_USE_VRPN TRUE)
|
---|
| 42 | ENDIF (FLAIR_USE_SIMULATOR)
|
---|
| 43 |
|
---|
| 44 | #VRPN for motion capture
|
---|
| 45 | IF (FLAIR_USE_VRPN)
|
---|
| 46 | SET(FLAIR_LIBRARIES vrpn ${FLAIR_LIBRARIES})
|
---|
| 47 | ENDIF (FLAIR_USE_VRPN)
|
---|
| 48 |
|
---|
| 49 | #nmea for GPS
|
---|
| 50 | IF (FLAIR_USE_GPS)
|
---|
| 51 | SET(FLAIR_LIBRARIES nmea ${FLAIR_LIBRARIES})
|
---|
| 52 | ENDIF (FLAIR_USE_GPS)
|
---|
| 53 |
|
---|
| 54 | #core, will be replace by rt or nrt version at the end
|
---|
| 55 | SET(FLAIR_LIBRARIES FlairCore ${FLAIR_LIBRARIES})
|
---|
| 56 |
|
---|
| 57 | #vision filter lib
|
---|
| 58 | IF (FLAIR_USE_VISION_FILTER)
|
---|
| 59 | if(FOUND_HDS_DIR AND ("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon" OR "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "core2-64"))
|
---|
| 60 | message(${PROJECT_NAME} ": using libdspcv_gpp.a for vision filter")
|
---|
[342] | 61 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/HdsVisionFilter)
|
---|
| 62 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libHdsVisionFilter.a ${FLAIR_LIBRARY_DIR}/libdspcv_gpp.a ${FLAIR_LIBRARIES})
|
---|
[302] | 63 | else()
|
---|
| 64 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/FlairVisionFilter)
|
---|
| 65 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairVisionFilter.a ${FLAIR_LIBRARIES})
|
---|
| 66 | endif()
|
---|
| 67 | ENDIF (FLAIR_USE_VISION_FILTER)
|
---|
| 68 |
|
---|
| 69 | #sensor and actuator lib
|
---|
| 70 | IF (FLAIR_USE_SENSOR_ACTUATOR)
|
---|
| 71 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/FlairSensorActuator)
|
---|
| 72 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSensorActuator.a nmea ${FLAIR_LIBRARIES})
|
---|
[342] | 73 | if(FOUND_HDS_DIR)
|
---|
| 74 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/HdsSensorActuator)
|
---|
| 75 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libHdsSensorActuator.a ${FLAIR_LIBRARIES})
|
---|
| 76 | endif()
|
---|
[302] | 77 | ENDIF (FLAIR_USE_SENSOR_ACTUATOR)
|
---|
| 78 |
|
---|
| 79 | #filter lib
|
---|
| 80 | IF (FLAIR_USE_FILTER)
|
---|
| 81 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/FlairFilter)
|
---|
| 82 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairFilter.a iir ${FLAIR_LIBRARIES})
|
---|
| 83 | ENDIF (FLAIR_USE_FILTER)
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 | #meta lib
|
---|
| 87 | IF (FLAIR_USE_META)
|
---|
| 88 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/FlairMeta)
|
---|
| 89 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairMeta.a ${FLAIR_LIBRARIES})
|
---|
| 90 | ENDIF (FLAIR_USE_META)
|
---|
| 91 |
|
---|
| 92 | #simulator lib
|
---|
| 93 | IF (FLAIR_USE_SIMULATOR)
|
---|
| 94 | if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
|
---|
| 95 | SET(FLAIR_USE_SIMULATOR_GL FALSE)
|
---|
| 96 | endif()
|
---|
| 97 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR}
|
---|
| 98 | $ENV{FLAIR_ROOT}/flair-install/include/FlairSimulator
|
---|
| 99 | ${CMAKE_SYSROOT}/usr/include/irrlicht
|
---|
| 100 | )
|
---|
| 101 |
|
---|
| 102 | IF (FLAIR_USE_SIMULATOR_GL)
|
---|
| 103 | ADD_DEFINITIONS("-DGL")
|
---|
| 104 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_gl.a GL ${FLAIR_LIBRARIES} Irrlicht Xxf86vm)
|
---|
| 105 | else()
|
---|
| 106 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_nogl.a ${FLAIR_LIBRARIES})
|
---|
| 107 | endif()
|
---|
| 108 | ENDIF (FLAIR_USE_SIMULATOR)
|
---|
| 109 |
|
---|
| 110 | #set RT or NRT specific libraries
|
---|
| 111 | set(FLAIR_LIBRARIES_RT ${FLAIR_LIBRARIES} ${XENOMAI_LIBRARIES})
|
---|
| 112 |
|
---|
| 113 | list(FIND FLAIR_LIBRARIES_RT "FlairCore" POS)
|
---|
| 114 | if(POS GREATER -1)
|
---|
| 115 | list(REMOVE_AT FLAIR_LIBRARIES_RT ${POS})
|
---|
| 116 | list(INSERT FLAIR_LIBRARIES_RT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_rt.a")
|
---|
| 117 | endif()
|
---|
| 118 |
|
---|
| 119 | set(FLAIR_LIBRARIES_NRT ${FLAIR_LIBRARIES})
|
---|
| 120 |
|
---|
| 121 | list(FIND FLAIR_LIBRARIES_NRT "FlairCore" POS)
|
---|
| 122 | if(POS GREATER -1)
|
---|
| 123 | list(REMOVE_AT FLAIR_LIBRARIES_NRT ${POS})
|
---|
| 124 | list(INSERT FLAIR_LIBRARIES_NRT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_nrt.a")
|
---|
| 125 | endif()
|
---|
| 126 |
|
---|
[342] | 127 | #add arch specific uav lib lib
|
---|
[302] | 128 | if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon")
|
---|
| 129 | SET (PARROT_LIB -Wl,--whole-archive ${FLAIR_LIBRARY_DIR}/libFlairArdrone2.a ${FLAIR_LIBRARY_DIR}/libFlairBebop.a -Wl,--no-whole-archive)
|
---|
| 130 | set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
|
---|
| 131 | set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
|
---|
| 132 | endif()
|
---|
| 133 | if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
|
---|
| 134 | SET (PARROT_LIB -Wl,--whole-archive ${FLAIR_LIBRARY_DIR}/libFlairMinidrones.a ${FLAIR_LIBRARY_DIR}/libFlairMamboEdu.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()
|
---|
[342] | 138 | if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "cortexa8hf-neon")
|
---|
| 139 | SET (PARROT_LIB -Wl,--whole-archive ${FLAIR_LIBRARY_DIR}/libFlairBeagleBlue.a -Wl,--no-whole-archive)
|
---|
| 140 | set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT})
|
---|
| 141 | set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT})
|
---|
| 142 | endif()
|
---|