Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use flag -Drelease=on on pipol for the moment.
[simgrid.git] / buildtools / pipol / cmake.pl
1 #!/usr/bin/perl -w
2 use strict;
3
4 my($my_cmake_version);
5 my($cmake);
6 my($ctest);
7 my($cpack);
8
9 $my_cmake_version = `cmake --version`;
10 $cmake = `which cmake`;
11 $ctest = `which ctest`;
12 $cpack = `which cpack`;
13 print "$cmake";
14 print "$ctest";
15 print "$cpack";
16
17 chomp $cmake;
18 chomp $ctest;
19 chomp $cpack;
20
21 if ( -f "$cmake" )
22 {
23         if($my_cmake_version =~ /.*2.8.[0-9].*$/) 
24         {
25                 print "cmake version : $my_cmake_version";
26         }
27         else
28         {
29                 if($my_cmake_version =~ /.*2.6.[1-9].*$/) 
30                 {
31                         print "version > 2.6.0\n";
32                         system "wget http://www.cmake.org/files/v2.8/cmake-2.8.2.tar.gz";
33                         system "tar zxvf cmake-2.8.2.tar.gz";
34                         chdir("./cmake-2.8.2");
35                         system "cmake .";
36                         system "make";
37                         if (-f "./bin/cmake"){
38                                 system "sudo ln -sf `pwd`/bin/cmake $cmake";
39                                 system "sudo ln -sf `pwd`/bin/cpack $cpack";
40                                 system "sudo ln -sf `pwd`/bin/ctest $ctest";
41                         }
42                         else
43                         {
44                                 return;
45                         }
46         
47                 }
48                 else
49                 {
50                         print "version < 2.6.1\n";
51                         system "wget http://www.cmake.org/files/v2.6/cmake-2.6.4.tar.gz";
52                         system "wget http://www.cmake.org/files/v2.8/cmake-2.8.2.tar.gz";
53         
54                         system "tar zxvf cmake-2.6.4.tar.gz";
55                         chdir("./cmake-2.6.4/");
56                         system "cmake .";
57                         system "make";
58                         if (-f "./bin/cmake"){
59                                 system "sudo ln -sf `pwd`/bin/cmake $cmake";
60                                 system "sudo ln -sf `pwd`/bin/cpack $cpack";
61                                 system "sudo ln -sf `pwd`/bin/ctest $ctest";
62                         }
63                         else
64                         {
65                                 return;
66                         }
67                         chdir("./..");
68         
69                         $my_cmake_version = `cmake --version`;
70                         print "cmake version : $my_cmake_version";
71                         $cmake = `which cmake`;
72                         $ctest = `which ctest`;
73                         $cpack = `which cpack`;
74                         print "$cmake";
75                         print "$ctest";
76                         print "$cpack";
77                         chomp $cmake;
78                         chomp $ctest;
79                         chomp $cpack;
80         
81                         system "tar zxvf cmake-2.8.2.tar.gz";
82                         chdir("./cmake-2.8.2/");
83                         system "cmake .";
84                         system "make";
85                         if (-f "./bin/cmake"){
86                                 system "sudo ln -sf `pwd`/bin/cmake $cmake";
87                                 system "sudo ln -sf `pwd`/bin/cpack $cpack";
88                                 system "sudo ln -sf `pwd`/bin/ctest $ctest";
89                         }
90                         else
91                         {
92                                 return;
93                         }
94                 }
95         $my_cmake_version = `cmake --version`;
96         print "cmake version : $my_cmake_version";
97         $cmake = `which cmake`;
98         $ctest = `which ctest`;
99         $cpack = `which cpack`;
100         print "$cmake";
101         print "$ctest";
102         print "$cpack";
103         }
104 }