source: flair-dev/tags/0.2.2/cmake-modules/FlairUseFile.cmake

Last change on this file was 83, checked in by Sanahuja Guillaume, 6 years ago

opencv

File size: 4.7 KB
Line 
1find_package(LibXml2 REQUIRED)
2find_package(Xenomai QUIET)
3
4if(NOT XENOMAI_FOUND)
5 warn("Xenomai not found, you will not be able to link a real time program")
6endif()
7
8execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
9 OUTPUT_VARIABLE GCC_VERSION)
10
11if (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()
17else()
18 message(STATUS "GCC version < 4.3, c+11 is not supported!")
19endif()
20
21#check if we have a flair-hds directory
22if (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 )
28endif()
29
30SET(FLAIR_INCLUDE_DIR
31 ${LIBXML2_INCLUDE_DIR}
32 ${CMAKE_SYSROOT}/usr/include/opencv1
33 ${FLAIR_DEV}/include/FlairCore
34)
35SET(FLAIR_LIBRARY_DIR
36 ${FLAIR_BIN}/lib/${ARCH_DIR}
37)
38
39SET(FLAIR_LIBRARIES
40 ${LIBXML2_LIBRARIES}
41 udt pthread cv cxcore highgui FileLib rt z
42)
43
44#auto select dependencies
45IF (FLAIR_USE_SIMULATOR)
46 SET(FLAIR_USE_VRPN TRUE)
47ENDIF (FLAIR_USE_SIMULATOR)
48
49#VRPN for motion capture
50IF (FLAIR_USE_VRPN)
51 SET(FLAIR_LIBRARIES vrpn ${FLAIR_LIBRARIES})
52ENDIF (FLAIR_USE_VRPN)
53
54#nmea for GPS
55IF (FLAIR_USE_GPS)
56 SET(FLAIR_LIBRARIES nmea ${FLAIR_LIBRARIES})
57ENDIF (FLAIR_USE_GPS)
58
59#core, will be replace by rt or nrt version at the end
60SET(FLAIR_LIBRARIES FlairCore ${FLAIR_LIBRARIES})
61
62#vision filter lib
63IF (FLAIR_USE_VISION_FILTER)
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")
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()
69 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-dev/include/FlairVisionFilter)
70 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairVisionFilter.a ${FLAIR_LIBRARIES})
71 endif()
72ENDIF (FLAIR_USE_VISION_FILTER)
73
74#sensor and actuator lib
75IF (FLAIR_USE_SENSOR_ACTUATOR)
76 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} ${FLAIR_DEV}/include/FlairSensorActuator)
77 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSensorActuator.a nmea ${FLAIR_LIBRARIES})
78ENDIF (FLAIR_USE_SENSOR_ACTUATOR)
79
80#filter lib
81IF (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})
84ENDIF (FLAIR_USE_FILTER)
85
86
87#meta lib
88IF (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})
91ENDIF (FLAIR_USE_META)
92
93#simulator lib
94IF (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")
105 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_gl.a GL ${FLAIR_LIBRARIES} Irrlicht Xxf86vm)
106 else()
107 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_nogl.a ${FLAIR_LIBRARIES})
108 endif()
109ENDIF (FLAIR_USE_SIMULATOR)
110
111#set RT or NRT specific libraries
112set(FLAIR_LIBRARIES_RT ${FLAIR_LIBRARIES} ${XENOMAI_LIBRARIES})
113
114list(FIND FLAIR_LIBRARIES_RT "FlairCore" POS)
115if(POS GREATER -1)
116 list(REMOVE_AT FLAIR_LIBRARIES_RT ${POS})
117 list(INSERT FLAIR_LIBRARIES_RT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_rt.a")
118endif()
119
120set(FLAIR_LIBRARIES_NRT ${FLAIR_LIBRARIES})
121
122list(FIND FLAIR_LIBRARIES_NRT "FlairCore" POS)
123if(POS GREATER -1)
124 list(REMOVE_AT FLAIR_LIBRARIES_NRT ${POS})
125 list(INSERT FLAIR_LIBRARIES_NRT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_nrt.a")
126endif()
127
128#add ardrone2, bebop or minidrones lib
129if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon")
130 SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairArdrone2.a ${FLAIRHDS_LIBRARY_DIR}/libFlairBebop.a -Wl,--no-whole-archive)
131 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
132 set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
133endif()
134if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
135 SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairMinidrones.a ${FLAIRHDS_LIBRARY_DIR}/libFlairMamboEdu.a -Wl,--no-whole-archive)
136 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
137 set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
138endif()
Note: See TracBrowser for help on using the repository browser.