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 |
|
---|
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 |
|
---|
30 | SET(FLAIR_INCLUDE_DIR
|
---|
31 | ${LIBXML2_INCLUDE_DIR}
|
---|
32 | ${CMAKE_SYSROOT}/usr/include/opencv
|
---|
33 | ${FLAIR_DEV}/include/FlairCore
|
---|
34 | )
|
---|
35 | SET(FLAIR_LIBRARY_DIR
|
---|
36 | ${FLAIR_BIN}/lib/${ARCH_DIR}
|
---|
37 | )
|
---|
38 |
|
---|
39 | SET(FLAIR_LIBRARIES
|
---|
40 | ${LIBXML2_LIBRARIES}
|
---|
41 | udt pthread cv cxcore highgui FileLib rt z
|
---|
42 | )
|
---|
43 |
|
---|
44 | #auto select dependencies
|
---|
45 | IF (FLAIR_USE_SIMULATOR)
|
---|
46 | SET(FLAIR_USE_VRPN TRUE)
|
---|
47 | ENDIF (FLAIR_USE_SIMULATOR)
|
---|
48 |
|
---|
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 |
|
---|
62 | #vision filter lib
|
---|
63 | IF (FLAIR_USE_VISION_FILTER)
|
---|
64 | if(FOUND_HDS_DIR)
|
---|
65 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-hds/dev/include/VisionFilter)
|
---|
66 | SET(FLAIR_LIBRARIES ${FLAIRHDS_LIBRARY_DIR}/libVisionFilter.a ${FLAIRHDS_LIBRARY_DIR}/libdspcv_gpp.a ${FLAIR_LIBRARIES})
|
---|
67 | else()
|
---|
68 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-dev/include/FlairVisionFilter)
|
---|
69 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairVisionFilter.a ${FLAIR_LIBRARIES})
|
---|
70 | endif()
|
---|
71 | ENDIF (FLAIR_USE_VISION_FILTER)
|
---|
72 |
|
---|
73 | #sensor and actuator lib
|
---|
74 | IF (FLAIR_USE_SENSOR_ACTUATOR)
|
---|
75 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} ${FLAIR_DEV}/include/FlairSensorActuator)
|
---|
76 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSensorActuator.a nmea ${FLAIR_LIBRARIES})
|
---|
77 | ENDIF (FLAIR_USE_SENSOR_ACTUATOR)
|
---|
78 |
|
---|
79 | #filter lib
|
---|
80 | IF (FLAIR_USE_FILTER)
|
---|
81 | SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} ${FLAIR_DEV}/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} ${FLAIR_DEV}/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 | ${FLAIR_DEV}/include/FlairSimulator
|
---|
99 | ${CMAKE_SYSROOT}/usr/include/irrlicht
|
---|
100 | ${FLAIR_DEV}/include/FlairSensorActuator
|
---|
101 | )
|
---|
102 |
|
---|
103 | SET(SIMU_LIBRARY ${FLAIR_LIBRARY_DIR}/libFlairSensorActuator.a)
|
---|
104 | IF (FLAIR_USE_SIMULATOR_GL)
|
---|
105 | ADD_DEFINITIONS("-DGL")
|
---|
106 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_gl.a
|
---|
107 | ${SIMU_LIBRARY} GL ${FLAIR_LIBRARIES} Irrlicht Xxf86vm)
|
---|
108 | else()
|
---|
109 | SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_nogl.a ${SIMU_LIBRARY} ${FLAIR_LIBRARIES})
|
---|
110 | endif()
|
---|
111 | ENDIF (FLAIR_USE_SIMULATOR)
|
---|
112 |
|
---|
113 | #set RT or NRT specific libraries
|
---|
114 | set(FLAIR_LIBRARIES_RT ${FLAIR_LIBRARIES} ${XENOMAI_LIBRARIES})
|
---|
115 |
|
---|
116 | list(FIND FLAIR_LIBRARIES_RT "FlairCore" POS)
|
---|
117 | if(POS GREATER -1)
|
---|
118 | list(REMOVE_AT FLAIR_LIBRARIES_RT ${POS})
|
---|
119 | list(INSERT FLAIR_LIBRARIES_RT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_rt.a")
|
---|
120 | endif()
|
---|
121 |
|
---|
122 | set(FLAIR_LIBRARIES_NRT ${FLAIR_LIBRARIES})
|
---|
123 |
|
---|
124 | list(FIND FLAIR_LIBRARIES_NRT "FlairCore" POS)
|
---|
125 | if(POS GREATER -1)
|
---|
126 | list(REMOVE_AT FLAIR_LIBRARIES_NRT ${POS})
|
---|
127 | list(INSERT FLAIR_LIBRARIES_NRT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_nrt.a")
|
---|
128 | endif()
|
---|
129 |
|
---|
130 | #add ardrone2 and bebop lib
|
---|
131 | if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
|
---|
132 | SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairArdrone2.a ${FLAIRHDS_LIBRARY_DIR}/libFlairBebop.a -Wl,--no-whole-archive)
|
---|
133 | set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
|
---|
134 | endif()
|
---|