source: flair-dev/tags/0.0.2/cmake-modules/FlairUseFile.cmake@ 41

Last change on this file since 41 was 27, checked in by Sanahuja Guillaume, 8 years ago

m

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