@@ -1,75 +1,94 | |||
|
1 | 1 | use File::Basename; |
|
2 | 2 | use feature "switch"; |
|
3 | 3 | use lib 'test/scripts'; |
|
4 | 4 | use Jobs; |
|
5 | 5 | |
|
6 | 6 | # read command line params |
|
7 | 7 | my $jobname = shift; |
|
8 | 8 | |
|
9 | 9 | # get script directory |
|
10 | 10 | my $scriptdir = File::Basename::dirname($0); |
|
11 | 11 | |
|
12 | 12 | # read ini file |
|
13 | 13 | my $inifile = $scriptdir . "/jobs.ini"; |
|
14 | 14 | my %job = Jobs::get($inifile, $jobname); |
|
15 | 15 | |
|
16 | 16 | # examine the platform |
|
17 | 17 | given ($job{'Platform'}) { |
|
18 | 18 | |
|
19 | 19 | when ("Win7") { |
|
20 | 20 | |
|
21 | 21 | $scriptdir =~ s/\//\\/g; # replace / -> \ |
|
22 | 22 | |
|
23 | 23 | # construct a build command |
|
24 | 24 | if ($job{'ToolChain'} eq "mingw") { |
|
25 | 25 | run($scriptdir . "\\build_win_mingw.bat", $job{'QtDir'}, $job{'Config'}, $job{'MinGWDir'}); |
|
26 | 26 | } |
|
27 | 27 | elsif ($job{'ToolChain'} eq "vs2005") { |
|
28 | 28 | run($scriptdir . "\\build_win_vs2005.bat", $job{'QtDir'}, $job{'Config'}); |
|
29 | 29 | } |
|
30 | 30 | elsif ($job{'ToolChain'} eq "vs2008") { |
|
31 | 31 | run($scriptdir . "\\build_win_vs2008.bat", $job{'QtDir'}, $job{'Config'}); |
|
32 | 32 | } |
|
33 | 33 | elsif ($job{'ToolChain'} eq "vs2010") { |
|
34 | 34 | run($scriptdir . "\\build_win_vs2010.bat", $job{'QtDir'}, $job{'Config'}); |
|
35 | 35 | } |
|
36 | 36 | else { |
|
37 | 37 | die "Unknown toolchain!"; |
|
38 | 38 | } |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | when ("Mac") { |
|
42 | 42 | |
|
43 | 43 | # setup build environment |
|
44 | 44 | $ENV{'QTDIR'} = $job{'QtDir'}; |
|
45 | 45 | $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'}; |
|
46 | 46 | |
|
47 | 47 | # run qmake |
|
48 | 48 | my $cmd; |
|
49 | 49 | if ($job{'ToolChain'} eq "clang") { |
|
50 | 50 | run("qmake -r -spec unsupported/macx-clang CONFIG+=" . $job{'Config'}); |
|
51 | 51 | } |
|
52 | 52 | elsif ($job{'ToolChain'} eq "gcc") { |
|
53 | 53 | run("qmake -r CONFIG+=" . $job{'Config'}); |
|
54 | 54 | } |
|
55 | 55 | else { |
|
56 | 56 | die "Unknown toolchain!"; |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | # run make |
|
60 | 60 | run("make"); |
|
61 | 61 | } |
|
62 | 62 | |
|
63 | when ("Linux") { | |
|
64 | ||
|
65 | # setup build environment | |
|
66 | $ENV{'QTDIR'} = $job{'QtDir'}; | |
|
67 | $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'}; | |
|
68 | ||
|
69 | # run qmake | |
|
70 | my $cmd; | |
|
71 | if ($job{'ToolChain'} eq "gcc") { | |
|
72 | run("qmake -r CONFIG+=" . $job{'Config'}); | |
|
73 | } | |
|
74 | else { | |
|
75 | die "Unknown toolchain!"; | |
|
76 | } | |
|
77 | ||
|
78 | # run make | |
|
79 | run("make"); | |
|
80 | } | |
|
81 | ||
|
63 | 82 | default { |
|
64 | 83 | die "Unknown platform " . $job{'Platform'}; |
|
65 | 84 | } |
|
66 | 85 | } |
|
67 | 86 | |
|
68 | 87 | sub run { |
|
69 | 88 | my $cmd; |
|
70 | 89 | foreach (@_) { |
|
71 | 90 | $cmd .= "$_ "; |
|
72 | 91 | } |
|
73 | 92 | print "running : $cmd\n"; |
|
74 | 93 | system(@_) == 0 or die "system \"$cmd\" failed: $?"; |
|
75 | 94 | } No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now