Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics.
[simgrid.git] / buildtools / Cmake / Pipol.cmake
1 # On a Pipol system, set:
2 # PIPOL_USER
3
4 #SET(PIPOL_USER $ENV{PIPOL_USER})
5
6 # ssh/rsync mandatory 
7 IF(pipol_user)
8
9         set(CMAKE_OPTIONS "     -Wno-dev")
10         
11         if(custom_flags)
12         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Dcustom_flags=${custom_flags}")
13         endif(custom_flags)
14         
15         if(with_context)
16         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Dwith_context=${with_context}")
17         endif(with_context)
18         
19         if(enable_smpi)
20         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_smpi=on")
21         endif(enable_smpi)
22         
23         if(enable_java)
24         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_java=on")
25         endif(enable_java)
26         
27         if(enable_lua)
28         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_lua=on")
29         endif(enable_lua)       
30         
31         if(enable_ruby)
32         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_ruby=on")
33         endif(enable_ruby)      
34         
35         if(enable_compile_optimizations)
36         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_compile_optimizations=on")
37         endif(enable_compile_optimizations)
38         
39         if(enable_compile_warnings)
40         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_compile_warnings=on")
41         endif(enable_compile_warnings)  
42         
43         if(enable_tracing)
44         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_tracing=on")
45         endif(enable_tracing)
46         
47         if(enable_coverage)
48         set(CMAKE_OPTIONS "${CMAKE_OPTION}      -Denable_coverage=on")
49         endif(enable_coverage)  
50         
51         if(enable_print_message)        
52         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_print_message=on")
53         endif(enable_print_message)     
54         
55         if(enable_model-checking)
56         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_model-checking=on")
57         endif(enable_model-checking)
58         
59     if(enable_latency_bound_tracking)
60         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_latency_bound_tracking=on")
61         endif(enable_latency_bound_tracking)
62
63         FIND_PROGRAM(HAVE_SSH ssh)
64         FIND_PROGRAM(HAVE_RSYNC rsync)
65
66     MESSAGE(STATUS "Pipol user is ${pipol_user}")
67     IF(HAVE_SSH)
68         message("-- Found ssh: ${HAVE_SSH}")
69       # get pipol systems
70       EXECUTE_PROCESS(COMMAND 
71         ssh ${pipol_user}@pipol.inria.fr pipol-sub --query=systems 
72         OUTPUT_VARIABLE PIPOL_SYSTEMS OUTPUT_STRIP_TRAILING_WHITESPACE)
73         
74     ENDIF(HAVE_SSH)
75   
76         ADD_CUSTOM_TARGET(pipol_test_list_images
77                 COMMENT "Available images for pipol tests (cmake + make + make test) : "
78                 )
79                 
80         ADD_CUSTOM_TARGET(pipol_experimental_list_images
81                 COMMENT "Available images for ctest (ctest -D Experimental) : "
82                 )
83                 
84         ADD_CUSTOM_TARGET(pipol_kvm_deploy
85                 COMMENT "Deploy all kvm images on pipol (ctest -D Experimental) : "
86                 )
87         ADD_CUSTOM_COMMAND(TARGET pipol_kvm_deploy
88                 POST_BUILD
89                 COMMENT "See results on http://cdash.inria.fr/CDash/index.php?project=Simgrid"
90                 )
91   
92     IF(HAVE_RSYNC)
93         message("-- Found rsync: ${HAVE_RSYNC}")
94               MACRO(PIPOL_TARGET
95                   SYSTEM_PATTERN)
96                                   STRING(REPLACE ".dd.gz" "" SYSTEM_TARGET ${SYSTEM_PATTERN})
97                                 
98                               ADD_CUSTOM_TARGET(
99                                 ${SYSTEM_TARGET}
100                                 COMMENT "PIPOL Build : ${SYSTEM_PATTERN}"
101                                 COMMAND rsync ${pipol_user}@pipol.inria.fr:/usr/local/bin/pipol-sub .
102                                 COMMAND ./pipol-sub --pipol-user=${pipol_user} ${SYSTEM_PATTERN} 02:00 --reconnect --group --keep --verbose=1 --export=${CMAKE_HOME_DIRECTORY} --rsynco=-aC  
103                                 \"sudo chown ${pipol_user} ${CMAKE_HOME_DIRECTORY} \;
104                                 cd ${CMAKE_HOME_DIRECTORY} \;
105                                 sh ${CMAKE_HOME_DIRECTORY}/buildtools/pipol/liste_install.sh \;
106                                 cmake -E remove CMakeCache.txt \;
107                                 cmake ${CMAKE_HOME_DIRECTORY}${CMAKE_OPTIONS} \;
108                                 make clean \;
109                                 make \;
110                                 make check \"
111                                 )
112                               ADD_CUSTOM_TARGET(
113                                 ${SYSTEM_TARGET}_experimental
114                                 COMMENT "PIPOL Build : ${SYSTEM_PATTERN}_experimental"
115                                 COMMAND rsync ${pipol_user}@pipol.inria.fr:/usr/local/bin/pipol-sub .
116                                 COMMAND ./pipol-sub --pipol-user=${pipol_user} ${SYSTEM_PATTERN} 02:00 --reconnect --group --keep --verbose=1 --export=${CMAKE_HOME_DIRECTORY} --rsynco=-aC  
117                                 \"sudo chown ${pipol_user} ${CMAKE_HOME_DIRECTORY} \;
118                                 cd ${CMAKE_HOME_DIRECTORY} \;
119                                 sh ${CMAKE_HOME_DIRECTORY}/buildtools/pipol/liste_install.sh \;
120                                 cmake -E remove CMakeCache.txt \;
121                                 cmake ${CMAKE_HOME_DIRECTORY}${CMAKE_OPTIONS} \;
122                                 ctest -D Experimental \"
123                                 )
124                                 
125                               STRING(REGEX MATCH "kvm" make_test "${SYSTEM_TARGET}")
126                               if(make_test)
127                                 STRING(REGEX MATCH "windows" make_test "${SYSTEM_TARGET}")
128                                 if(NOT make_test)
129                                   ADD_CUSTOM_COMMAND(TARGET pipol_kvm_deploy
130                                         COMMENT "PIPOL Build : ${SYSTEM_PATTERN}"
131                                         COMMAND rsync ${pipol_user}@pipol.inria.fr:/usr/local/bin/pipol-sub .
132                                         COMMAND ./pipol-sub --pipol-user=${pipol_user} ${SYSTEM_PATTERN} 02:00 --reconnect --group --keep --verbose=1 --export=${CMAKE_HOME_DIRECTORY} --rsynco=-aC  
133                                         \"sudo chown ${pipol_user} ${CMAKE_HOME_DIRECTORY} \;
134                                         cd ${CMAKE_HOME_DIRECTORY} \;
135                                         sh ${CMAKE_HOME_DIRECTORY}/buildtools/pipol/liste_install.sh \;
136                                         cmake -E remove CMakeCache.txt \;
137                                         cmake ${CMAKE_HOME_DIRECTORY}${CMAKE_OPTIONS} \;
138                                         ctest -D Experimental \"
139                                          )
140                                 endif(NOT make_test)
141                               endif(make_test)
142                               
143                               ADD_CUSTOM_COMMAND(TARGET ${SYSTEM_TARGET}_experimental
144                                                                  POST_BUILD
145                                                                  COMMENT "See results on http://cdash.inria.fr/CDash/index.php?project=Simgrid"
146                                                                  )
147                                                                  
148                               ADD_CUSTOM_COMMAND(TARGET pipol_test_list_images
149                                         COMMAND echo ${SYSTEM_TARGET}
150                                         )
151                                   ADD_CUSTOM_COMMAND(TARGET pipol_experimental_list_images
152                                         COMMAND echo "${SYSTEM_TARGET}_experimental"
153                                         )
154       ENDMACRO(PIPOL_TARGET)
155       
156     ENDIF(HAVE_RSYNC)
157     
158 # add a target for each pipol system
159 IF(PIPOL_SYSTEMS)
160   MESSAGE(STATUS "Adding Pipol targets")
161   FOREACH(SYSTEM ${PIPOL_SYSTEMS})
162     PIPOL_TARGET(${SYSTEM})
163   ENDFOREACH(SYSTEM ${PIPOL_SYSTEMS})
164 ENDIF(PIPOL_SYSTEMS)
165
166 ADD_CUSTOM_TARGET(pipol_kill_all_jobs
167                 COMMENT "PIPOL delete all jobs"
168                 COMMAND ./pipol-sub --pipol-user=${pipol_user} deleteallmyjobs
169                 )
170                 
171 message("-- Pipol options: ${CMAKE_OPTIONS}")
172                 
173 ENDIF(pipol_user)