source: flair-dev/trunk/cmake-modules/FlairUseFile.cmake@ 106

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

going to out of source build

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