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 | #reimplement add executable to add a custom target for delivery (only on ARM)
|
---|
45 | #delivery are read from ssh config file
|
---|
46 | function(ADD_EXECUTABLE)
|
---|
47 | if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" AND EXISTS "$ENV{HOME}/.ssh/config")
|
---|
48 | file(STRINGS $ENV{HOME}/.ssh/config TEST)
|
---|
49 | foreach(f ${TEST})
|
---|
50 | string(FIND ${f} "Host " POS)#cherche ligne host
|
---|
51 | if(${POS} GREATER -1)
|
---|
52 | string(REPLACE Host "" TARGET_NAME ${f})#enleve Host
|
---|
53 | string(STRIP ${TARGET_NAME} TARGET_NAME)#enleve les espaces
|
---|
54 | endif()
|
---|
55 | string(FIND ${f} HostName POS)#cherche hostname
|
---|
56 | if(${POS} GREATER -1)
|
---|
57 | string(FIND ${f} "192.168." POS)#cherche addresse
|
---|
58 | if(${POS} GREATER 0)#garde que les adresses en 192.168.6.x
|
---|
59 | string(REPLACE HostName "" ADDRESS ${f})#enleve Hostname
|
---|
60 | string(STRIP ${ADDRESS} ADDRESS)#enleve les espaces
|
---|
61 | message("adding delivery target for " ${ARGV0} " (" ${ADDRESS} ")")
|
---|
62 | string(REPLACE "/" "_" TARGET_PATH ${TARGET_EXECUTABLE_OUTPUT_PATH})#les / ne sont pas acceptés
|
---|
63 | add_custom_target(
|
---|
64 | delivery_root_${ADDRESS}_${TARGET_PATH}_${ARGV0}
|
---|
65 | COMMAND make
|
---|
66 | COMMAND scp ${EXECUTABLE_OUTPUT_PATH}/${ARGV0} root@${ADDRESS}:${TARGET_EXECUTABLE_OUTPUT_PATH}
|
---|
67 | )
|
---|
68 | endif()
|
---|
69 | endif()
|
---|
70 | endforeach(f)
|
---|
71 | endif()
|
---|
72 | #call original function
|
---|
73 | _ADD_EXECUTABLE(${ARGV})
|
---|
74 | endfunction()
|
---|