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

Last change on this file was 62, checked in by Sanahuja Guillaume, 7 years ago

m

File size: 4.2 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/opencv
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)
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()
71ENDIF (FLAIR_USE_VISION_FILTER)
72
73#sensor and actuator lib
74IF (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})
77ENDIF (FLAIR_USE_SENSOR_ACTUATOR)
78
79#filter lib
80IF (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})
83ENDIF (FLAIR_USE_FILTER)
84
85
86#meta lib
87IF (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})
90ENDIF (FLAIR_USE_META)
91
92#simulator lib
93IF (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 ${SIMU_LIBRARY} GL ${FLAIR_LIBRARIES} Irrlicht Xxf86vm)
107 else()
108 SET(FLAIR_LIBRARIES ${FLAIR_LIBRARY_DIR}/libFlairSimulator_nogl.a ${SIMU_LIBRARY} ${FLAIR_LIBRARIES})
109 endif()
110ENDIF (FLAIR_USE_SIMULATOR)
111
112#set RT or NRT specific libraries
113set(FLAIR_LIBRARIES_RT ${FLAIR_LIBRARIES} ${XENOMAI_LIBRARIES})
114
115list(FIND FLAIR_LIBRARIES_RT "FlairCore" POS)
116if(POS GREATER -1)
117 list(REMOVE_AT FLAIR_LIBRARIES_RT ${POS})
118 list(INSERT FLAIR_LIBRARIES_RT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_rt.a")
119endif()
120
121set(FLAIR_LIBRARIES_NRT ${FLAIR_LIBRARIES})
122
123list(FIND FLAIR_LIBRARIES_NRT "FlairCore" POS)
124if(POS GREATER -1)
125 list(REMOVE_AT FLAIR_LIBRARIES_NRT ${POS})
126 list(INSERT FLAIR_LIBRARIES_NRT ${POS} "${FLAIR_LIBRARY_DIR}/libFlairCore_nrt.a")
127endif()
128
129#add ardrone2 and bebop lib
130if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
131 SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairArdrone2.a ${FLAIRHDS_LIBRARY_DIR}/libFlairBebop.a -Wl,--no-whole-archive)
132 set(FLAIR_LIBRARIES_NRT ${PARROT_LIB} ${FLAIR_LIBRARIES_NRT} nmea)
133endif()
Note: See TracBrowser for help on using the repository browser.