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