source: flair-src/trunk/cmake-modules/FlairUseFile.cmake@ 397

Last change on this file since 397 was 397, checked in by Sanahuja Guillaume, 4 years ago

add ipc lib

File size: 5.5 KB
Line 
1if(DEFINED FLAIRUSEFILE_INCLUDED)
2 return()
3endif()
4
5SET(FLAIRUSEFILE_INCLUDED true)
6
7find_package(LibXml2 REQUIRED)
8find_package(Xenomai QUIET)
9
10if(NOT XENOMAI_FOUND)
11 warn("Xenomai not found, you will not be able to link a real time program")
12endif()
13
14execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
15 OUTPUT_VARIABLE GCC_VERSION)
16
17if (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()
23else()
24 message(STATUS "GCC version < 4.3, c+11 is not supported!")
25endif()
26
27SET(FLAIR_INCLUDE_DIR
28 $ENV{FLAIR_ROOT}/flair-install/include/FlairCore
29)
30SET(FLAIR_LIBRARY_DIR
31 $ENV{FLAIR_ROOT}/flair-install/lib/${ARCH_DIR}
32)
33
34SET(FLAIR_LIBRARIES
35 ${LIBXML2_LIBRARIES}
36 udt pthread FileLib rt z
37)
38
39#auto select dependencies
40IF (FLAIR_USE_SIMULATOR)
41 SET(FLAIR_USE_VRPN TRUE)
42ENDIF (FLAIR_USE_SIMULATOR)
43
44#VRPN for motion capture
45IF (FLAIR_USE_VRPN)
46 SET(FLAIR_LIBRARIES vrpn ${FLAIR_LIBRARIES})
47ENDIF (FLAIR_USE_VRPN)
48
49#nmea for GPS
50IF (FLAIR_USE_GPS)
51 SET(FLAIR_LIBRARIES nmea ${FLAIR_LIBRARIES})
52ENDIF (FLAIR_USE_GPS)
53
54#core, will be replace by rt or nrt version at the end
55SET(FLAIR_LIBRARIES FlairCore ${FLAIR_LIBRARIES})
56
57#vision filter lib
58IF (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")
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})
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()
67ENDIF (FLAIR_USE_VISION_FILTER)
68
69#sensor and actuator lib
70IF (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})
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()
77 if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "core2-64")
78 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARIES} sumo)
79 endif()
80ENDIF (FLAIR_USE_SENSOR_ACTUATOR)
81
82#filter lib
83IF (FLAIR_USE_FILTER)
84 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/FlairFilter)
85 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairFilter.a iir ${FLAIR_LIBRARIES})
86ENDIF (FLAIR_USE_FILTER)
87
88
89#meta lib
90IF (FLAIR_USE_META)
91 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/FlairMeta)
92 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairMeta.a ${FLAIR_LIBRARIES})
93ENDIF (FLAIR_USE_META)
94
95#ipc lib
96IF (FLAIR_USE_IPC)
97 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-install/include/FlairIpc)
98 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairIpc.a ${FLAIR_LIBRARIES})
99ENDIF (FLAIR_USE_IPC)
100
101#simulator lib
102IF (FLAIR_USE_SIMULATOR)
103 if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
104 SET(FLAIR_USE_SIMULATOR_GL FALSE)
105 endif()
106 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR}
107 $ENV{FLAIR_ROOT}/flair-install/include/FlairSimulator
108 ${CMAKE_SYSROOT}/usr/include/irrlicht
109 )
110
111 IF (FLAIR_USE_SIMULATOR_GL)
112 ADD_DEFINITIONS("-DGL")
113 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_gl.a GL ${FLAIR_LIBRARIES} Irrlicht)
114 else()
115 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_nogl.a ${FLAIR_LIBRARIES})
116 endif()
117ENDIF (FLAIR_USE_SIMULATOR)
118
119#set RT or NRT specific libraries
120set(FLAIR_LIBRARIES_RT ${FLAIR_LIBRARIES} ${XENOMAI_LIBRARIES})
121
122list(FIND FLAIR_LIBRARIES_RT "FlairCore" POS)
123if(POS GREATER -1)
124 list(REMOVE_AT FLAIR_LIBRARIES_RT ${POS})
125 list(INSERT FLAIR_LIBRARIES_RT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_rt.a")
126endif()
127
128set(FLAIR_LIBRARIES_NRT ${FLAIR_LIBRARIES})
129
130list(FIND FLAIR_LIBRARIES_NRT "FlairCore" POS)
131if(POS GREATER -1)
132 list(REMOVE_AT FLAIR_LIBRARIES_NRT ${POS})
133 list(INSERT FLAIR_LIBRARIES_NRT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_nrt.a")
134endif()
135
136#add arch specific uav lib lib
137if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon")
138 SET (PARROT_LIB -Wl,--whole-archive ${FLAIR_LIBRARY_DIR}/libFlairArdrone2.a ${FLAIR_LIBRARY_DIR}/libFlairBebop.a -Wl,--no-whole-archive)
139 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
140 set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
141endif()
142if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
143 SET (PARROT_LIB -Wl,--whole-archive ${FLAIR_LIBRARY_DIR}/libFlairMinidrones.a ${FLAIR_LIBRARY_DIR}/libFlairMamboEdu.a -Wl,--no-whole-archive)
144 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
145 set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
146endif()
147if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "cortexa8hf-neon")
148 SET (PARROT_LIB -Wl,--whole-archive ${FLAIR_LIBRARY_DIR}/libFlairBeagleBlue.a -Wl,--no-whole-archive)
149 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT})
150 set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT})
151endif()
Note: See TracBrowser for help on using the repository browser.