source: pacpussensors/trunk/build/igep_toolchain.cmake@ 127

Last change on this file since 127 was 5, checked in by aschildk, 11 years ago

Fix CMakeLists for cross compiling. Add linux build scripts

File size: 3.4 KB
Line 
1cmake_minimum_required(VERSION 2.8)
2
3# CMake system name must be something like "Linux".
4# This is important for cross-compiling.
5set( CMAKE_SYSTEM_NAME Linux )
6set( CMAKE_SYSTEM_PROCESSOR arm )
7
8if(EXISTS "/opt/poky/1.3/sysroots/x86_64-pokysdk-linux")#64 bits
9 SET(CMAKE_C_COMPILER /opt/poky/1.3/sysroots/x86_64-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc)
10 SET(CMAKE_CXX_COMPILER /opt/poky/1.3/sysroots/x86_64-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++)
11 SET(CMAKE_LINKER /opt/poky/1.3/sysroots/x86_64-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-ld)
12 SET(CMAKE_AR /opt/poky/1.3/sysroots/x86_64-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-ar)
13 SET(QT_QMAKE_EXECUTABLE /opt/poky/1.3/sysroots/x86_64-pokysdk-linux/usr/bin/qmake2)
14elseif(EXISTS "/opt/poky/1.3/sysroots/i686-pokysdk-linux")#32 bits
15 SET(CMAKE_C_COMPILER /opt/poky/1.3/sysroots/i686-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc)
16 SET(CMAKE_CXX_COMPILER /opt/poky/1.3/sysroots/i686-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++)
17 SET(CMAKE_LINKER /opt/poky/1.3/sysroots/i686-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-ld)
18 SET(CMAKE_AR /opt/poky/1.3/sysroots/i686-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-ar)
19 SET(QT_QMAKE_EXECUTABLE /opt/poky/1.3/sysroots/i686-pokysdk-linux/usr/bin/qmake2)
20else()
21 message(FATAL_ERROR "Cross-compilator is not installed, please read https://devel.hds.utc.fr/projects/igep" )
22endif()
23
24SET(CMAKE_C_ARCHIVE_CREATE "${CMAKE_AR} cr <TARGET> <LINK_FLAGS> <OBJECTS>")
25SET(CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
26
27SET(CMAKE_SYSTEM_PREFIX_PATH /opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/)
28
29set( CMAKE_C_FLAGS " -march=armv7-a -fno-tree-vectorize -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 --sysroot=/opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi " CACHE STRING "CFLAGS" )
30set( CMAKE_CXX_FLAGS " -march=armv7-a -fno-tree-vectorize -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 --sysroot=/opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -O2 -pipe -g -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden -fpermissive" CACHE STRING "CXXFLAGS" )
31set( CMAKE_C_FLAGS_RELEASE "-O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG" CACHE STRING "CFLAGS for release" )
32set( CMAKE_CXX_FLAGS_RELEASE "-O2 -pipe -g -feliminate-unused-debug-types -O2 -pipe -g -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden -DNDEBUG" CACHE STRING "CXXFLAGS for release" )
33
34# only search in the paths provided so cmake doesnt pick
35# up libraries and tools from the native build machine
36set( CMAKE_FIND_ROOT_PATH /opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/ )
37set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
38set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
39set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
40
41# Use qt.conf settings
42#set( ENV{QT_CONF_PATH} $ENV{IGEP_ROOT}/uav_dev/include/qt.conf )
43
44# Use native cmake modules
45set( CMAKE_MODULE_PATH /opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/share/cmake-2.8/Modules/ )
46
47# add for non /usr/lib libdir, e.g. /usr/lib64
48#set( CMAKE_LIBRARY_PATH /usr/lib /lib)
49
Note: See TracBrowser for help on using the repository browser.