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