1 | cmake_minimum_required(VERSION 2.8)
|
---|
2 |
|
---|
3 | # CMake system name must be something like "Linux".
|
---|
4 | # This is important for cross-compiling.
|
---|
5 | set( CMAKE_SYSTEM_NAME Linux )
|
---|
6 | set( CMAKE_SYSTEM_PROCESSOR arm )
|
---|
7 |
|
---|
8 | if(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)
|
---|
14 | elseif(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)
|
---|
20 | else()
|
---|
21 | message(FATAL_ERROR "Cross-compilator is not installed, please read https://devel.hds.utc.fr/projects/igep" )
|
---|
22 | endif()
|
---|
23 |
|
---|
24 | SET(CMAKE_C_ARCHIVE_CREATE "${CMAKE_AR} cr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
---|
25 | SET(CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
|
---|
26 |
|
---|
27 | SET(CMAKE_SYSTEM_PREFIX_PATH /opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/)
|
---|
28 |
|
---|
29 | set( 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" )
|
---|
30 | set( 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" )
|
---|
31 | set( CMAKE_C_FLAGS_RELEASE "-O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG" CACHE STRING "CFLAGS for release" )
|
---|
32 | set( 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
|
---|
36 | set( CMAKE_FIND_ROOT_PATH /opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/ )
|
---|
37 | set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
|
---|
38 | set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
---|
39 | set( 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
|
---|
45 | set( CMAKE_MODULE_PATH /opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/share/cmake-2.8/Modules/ )
|
---|
46 | list (APPEND CMAKE_MODULE_PATH " /home/romain/TX1/tmpTarget/cmake/")
|
---|
47 |
|
---|
48 | # add for non /usr/lib libdir, e.g. /usr/lib64
|
---|
49 | set( CMAKE_LIBRARY_PATH /home/romain/TX1/tmpTarget/lib)
|
---|
50 |
|
---|
51 | set (CMAKE_CXX_FLAGS "-fPIC")
|
---|
52 |
|
---|