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

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

going to out of source build

File size: 4.8 KB
RevLine 
[97]1if(DEFINED FLAIRUSEFILE_INCLUDED)
2 return()
3endif()
4
5SET(FLAIRUSEFILE_INCLUDED true)
6
[2]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
[45]27#check if we have a flair-hds directory
[97]28if (DEFINED FOUND_HDS_DIR)
29 SET(FLAIRHDS_LIBRARY_DIR
[45]30 $ENV{FLAIR_ROOT}/flair-hds/bin/lib/${ARCH_DIR}
31 )
32endif()
33
[2]34SET(FLAIR_INCLUDE_DIR
35 ${LIBXML2_INCLUDE_DIR}
[67]36 ${CMAKE_SYSROOT}/usr/include/opencv1
[2]37 ${FLAIR_DEV}/include/FlairCore
38)
39SET(FLAIR_LIBRARY_DIR
[10]40 ${FLAIR_BIN}/lib/${ARCH_DIR}
[2]41)
42
43SET(FLAIR_LIBRARIES
44 ${LIBXML2_LIBRARIES}
45 udt pthread cv cxcore highgui FileLib rt z
46)
47
[44]48#auto select dependencies
49IF (FLAIR_USE_SIMULATOR)
50 SET(FLAIR_USE_VRPN TRUE)
51ENDIF (FLAIR_USE_SIMULATOR)
52
[2]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
[45]66#vision filter lib
67IF (FLAIR_USE_VISION_FILTER)
[83]68 if(FOUND_HDS_DIR AND ("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon" OR "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "core2-64"))
[97]69 message(${PROJECT_NAME} ": using libdspcv_gpp.a for vision filter")
[45]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()
[68]73 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} $ENV{FLAIR_ROOT}/flair-dev/include/FlairVisionFilter)
[45]74 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairVisionFilter.a ${FLAIR_LIBRARIES})
75 endif()
76ENDIF (FLAIR_USE_VISION_FILTER)
77
[2]78#sensor and actuator lib
79IF (FLAIR_USE_SENSOR_ACTUATOR)
80 SET(FLAIR_INCLUDE_DIR ${FLAIR_INCLUDE_DIR} ${FLAIR_DEV}/include/FlairSensorActuator)
[55]81 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSensorActuator.a nmea ${FLAIR_LIBRARIES})
[2]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
[45]90
[2]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")
[68]109 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_gl.a GL ${FLAIR_LIBRARIES} Irrlicht Xxf86vm)
[2]110 else()
[68]111 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_nogl.a ${FLAIR_LIBRARIES})
[2]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
[68]132#add ardrone2, bebop or minidrones lib
133if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon")
[49]134 SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairArdrone2.a ${FLAIRHDS_LIBRARY_DIR}/libFlairBebop.a -Wl,--no-whole-archive)
[68]135 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
[75]136 set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
[68]137endif()
138if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
[71]139 SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairMinidrones.a ${FLAIRHDS_LIBRARY_DIR}/libFlairMamboEdu.a -Wl,--no-whole-archive)
[49]140 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
[75]141 set(FLAIR_LIBRARIES_RT ${PARROT_LIB} ${FLAIR_LIBRARIES_RT} nmea)
[26]142endif()
Note: See TracBrowser for help on using the repository browser.