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