1 | if(NOT DEFINED ENV{FLAIR_ROOT})
|
---|
2 | message(FATAL_ERROR "variable FLAIR_ROOT not defined")
|
---|
3 | endif()
|
---|
4 |
|
---|
5 | include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/ColoredMessage.cmake)
|
---|
6 |
|
---|
7 | if(NOT DEFINED ENV{FLAIR_ROOT})
|
---|
8 | err("variable FLAIR_ROOT not defined")
|
---|
9 | endif()
|
---|
10 |
|
---|
11 | if(NOT FLAIR_DEV)
|
---|
12 | IF(FLAIR_DEV_TAG)
|
---|
13 | warn("Configuring flair-dev and flair-bin for tag ${FLAIR_DEV_TAG}")
|
---|
14 | SET(FLAIR_DEV $ENV{FLAIR_ROOT}/flair-dev_svn/tags/${FLAIR_DEV_TAG})
|
---|
15 | SET(FLAIR_BIN $ENV{FLAIR_ROOT}/flair-bin_svn/tags/${FLAIR_DEV_TAG})
|
---|
16 | if(EXISTS "${FLAIR_DEV}/cmake-modules/GlobalCmakeUAV.cmake")
|
---|
17 | UNSET(FLAIR_DEV_TAG)
|
---|
18 | include(${FLAIR_DEV}/cmake-modules/GlobalCmakeUAV.cmake)
|
---|
19 | return()
|
---|
20 | else()
|
---|
21 | err("File not found ${FLAIR_DEV}/cmake-modules/GlobalCmakeUAV.cmake Please check that ${FLAIR_DEV} is up to date")
|
---|
22 | endif()
|
---|
23 | ELSE()
|
---|
24 | SET(FLAIR_DEV $ENV{FLAIR_ROOT}/flair-dev)
|
---|
25 | SET(FLAIR_BIN $ENV{FLAIR_ROOT}/flair-bin)
|
---|
26 | ENDIF()
|
---|
27 | ENDIF()
|
---|
28 |
|
---|
29 | include(${FLAIR_DEV}/cmake-modules/ArchDir.cmake)
|
---|
30 |
|
---|
31 | list(APPEND CMAKE_MODULE_PATH ${FLAIR_DEV}/cmake-modules/)
|
---|
32 |
|
---|
33 | #framework
|
---|
34 | SET(FLAIR_USE_FILE ${FLAIR_DEV}/cmake-modules/FlairUseFile.cmake)
|
---|
35 |
|
---|
36 | #default executable ouput paths
|
---|
37 | if(NOT DEFINED EXECUTABLE_OUTPUT_PATH)
|
---|
38 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
---|
39 | endif()
|
---|
40 | if(NOT DEFINED TARGET_EXECUTABLE_OUTPUT_PATH)
|
---|
41 | SET(TARGET_EXECUTABLE_OUTPUT_PATH bin/arm)
|
---|
42 | endif()
|
---|
43 |
|
---|
44 | #add definitions for archs
|
---|
45 | if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon")
|
---|
46 | ADD_DEFINITIONS(-DARMV7A)
|
---|
47 | endif()
|
---|
48 |
|
---|
49 | if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
|
---|
50 | ADD_DEFINITIONS(-DARMV5TE)
|
---|
51 | endif()
|
---|
52 |
|
---|
53 | if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "core2-64")
|
---|
54 | ADD_DEFINITIONS(-DCORE2_64)
|
---|
55 | endif()
|
---|
56 |
|
---|
57 | #reimplement add executable to add a custom target for delivery (only on ARM)
|
---|
58 | #delivery are read from ssh config file
|
---|
59 | function(ADD_EXECUTABLE)
|
---|
60 | if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" AND EXISTS "$ENV{HOME}/.ssh/config")
|
---|
61 | file(STRINGS $ENV{HOME}/.ssh/config TEST)
|
---|
62 | foreach(f ${TEST})
|
---|
63 | string(FIND ${f} "Host " POS)#cherche ligne host
|
---|
64 | if(${POS} GREATER -1)
|
---|
65 | string(REPLACE Host "" TARGET_NAME ${f})#enleve Host
|
---|
66 | string(STRIP ${TARGET_NAME} TARGET_NAME)#enleve les espaces
|
---|
67 | endif()
|
---|
68 | string(FIND ${f} HostName POS)#cherche hostname
|
---|
69 | if(${POS} GREATER -1)
|
---|
70 | string(FIND ${f} "192.168." POS)#cherche addresse
|
---|
71 | if(${POS} GREATER 0)#garde que les adresses en 192.168.6.x
|
---|
72 | string(REPLACE HostName "" ADDRESS ${f})#enleve Hostname
|
---|
73 | string(STRIP ${ADDRESS} ADDRESS)#enleve les espaces
|
---|
74 | message("adding delivery target for " ${ARGV0} " (" ${ADDRESS} ")")
|
---|
75 | string(REPLACE "/" "_" TARGET_PATH ${TARGET_EXECUTABLE_OUTPUT_PATH})#les / ne sont pas acceptés
|
---|
76 | add_custom_target(
|
---|
77 | delivery_root_${ADDRESS}_${TARGET_PATH}_${ARGV0}
|
---|
78 | COMMAND make
|
---|
79 | COMMAND scp ${EXECUTABLE_OUTPUT_PATH}/${ARGV0} root@${ADDRESS}:${TARGET_EXECUTABLE_OUTPUT_PATH}
|
---|
80 | )
|
---|
81 | endif()
|
---|
82 | endif()
|
---|
83 | endforeach(f)
|
---|
84 | endif()
|
---|
85 | #call original function
|
---|
86 | _ADD_EXECUTABLE(${ARGV})
|
---|
87 | endfunction()
|
---|