source: flair-dev/tags/latest/cmake-modules/GlobalCmakeFlair.cmake

Last change on this file was 81, checked in by Sanahuja Guillaume, 6 years ago

add defines for architectures to speed up compile time

File size: 2.9 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#add definitions for archs
45if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv7a-neon")
46 ADD_DEFINITIONS(-DARMV7A)
47endif()
48
49if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "armv5te")
50 ADD_DEFINITIONS(-DARMV5TE)
51endif()
52
53if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "core2-64")
54 ADD_DEFINITIONS(-DCORE2_64)
55endif()
56
57#reimplement add executable to add a custom target for delivery (only on ARM)
58#delivery are read from ssh config file
59function(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})
87endfunction()
Note: See TracBrowser for help on using the repository browser.