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

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

m

File size: 2.6 KB
Line 
1if(NOT DEFINED ENV{FLAIR_ROOT})
2 message(FATAL_ERROR "variable FLAIR_ROOT not defined")
3endif()
4
5include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/ColoredMessage.cmake)
6
7if(NOT DEFINED ENV{FLAIR_ROOT})
8 err("variable FLAIR_ROOT not defined")
9endif()
10
11if(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()
27ENDIF()
28
29include(${FLAIR_DEV}/cmake-modules/ArchDir.cmake)
30
31list(APPEND CMAKE_MODULE_PATH ${FLAIR_DEV}/cmake-modules/)
32
33#framework
34SET(FLAIR_USE_FILE ${FLAIR_DEV}/cmake-modules/FlairUseFile.cmake)
35
36#default executable ouput paths
37if(NOT DEFINED EXECUTABLE_OUTPUT_PATH)
38 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
39endif()
40if(NOT DEFINED TARGET_EXECUTABLE_OUTPUT_PATH)
41 SET(TARGET_EXECUTABLE_OUTPUT_PATH bin/arm)
42endif()
43
44#reimplement add executable to add a custom target for delivery (only on ARM)
45#delivery are read from ssh config file
46function(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})
74endfunction()
Note: See TracBrowser for help on using the repository browser.