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

Last change on this file since 68 was 68, checked in by Sanahuja Guillaume, 3 years ago

maj for armv5te

File size: 4.5 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    ${CMAKE_SYSROOT}/usr/include/opencv
34        ${FLAIR_DEV}/include/FlairCore
35)
36SET(FLAIR_LIBRARY_DIR
37        ${FLAIR_BIN}/lib/${ARCH_DIR}
38)
39
40SET(FLAIR_LIBRARIES     
41        ${LIBXML2_LIBRARIES}
42        udt pthread cv cxcore highgui FileLib rt z
43)
44
45#auto select dependencies
46IF (FLAIR_USE_SIMULATOR)
47        SET(FLAIR_USE_VRPN TRUE)
48ENDIF (FLAIR_USE_SIMULATOR)
49
50#VRPN for motion capture
51IF (FLAIR_USE_VRPN)
52        SET(FLAIR_LIBRARIES vrpn ${FLAIR_LIBRARIES})
53ENDIF (FLAIR_USE_VRPN)
54
55#nmea for GPS
56IF (FLAIR_USE_GPS)
57        SET(FLAIR_LIBRARIES nmea ${FLAIR_LIBRARIES})
58ENDIF (FLAIR_USE_GPS)
59
60#core, will be replace by rt or nrt version at the end
61SET(FLAIR_LIBRARIES FlairCore ${FLAIR_LIBRARIES})
62
63#vision filter lib
64IF (FLAIR_USE_VISION_FILTER)
65    if(FOUND_HDS_DIR AND NOT "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
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)
132endif()
133if(FOUND_HDS_DIR AND FLAIR_USE_META AND "${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")     
134  SET (PARROT_LIB -Wl,--whole-archive ${FLAIRHDS_LIBRARY_DIR}/libFlairMinidrones.a -Wl,--no-whole-archive)
135        set(FLAIR_LIBRARIES_NRT ${PARROT_LIB}  ${FLAIR_LIBRARIES_NRT} nmea)
136endif()
Note: See TracBrowser for help on using the repository browser.