forked from Unity-Technologies/monobuildtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_runtime_win.pl
97 lines (68 loc) · 2.62 KB
/
build_runtime_win.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
sub CompileVCProj;
use Cwd 'abs_path';
use File::Spec;
use File::Basename;
use File::Copy;
use File::Path;
my $root = File::Spec->rel2abs( dirname($0) );
my $buildsroot = "$root/builds";
my $buildir = "$buildsroot/src";
my $monoroot = abs_path($root."/../Mono");
$monoroot = abs_path($root."/../mono") unless (-d $monoroot);
die ("Cannot find mono checkout in ../Mono or ../mono") unless (-d $monoroot);
print "Mono checkout found in $monoroot\n\n";
if ($ENV{UNITY_THISISABUILDMACHINE})
{
print "rmtree-ing $root/builds because we're on a buildserver, and want to make sure we don't include old artifacts\n";
rmtree("$root/builds");
} else {
print "not rmtree-ing $root/builds, as we're not on a buildmachine";
}
my $os = 'win';
my $arch = 'i386' ;
my $buildtarget = "$buildir/$os-$arch";
my $buildtargetwin = "$root\\builds\\src\\$os-$arch";
mkpath("$buildtarget");
CompileVCProj("$monoroot/msvc/mono.sln","Release_eglib|Win32",0);
dircopy('$monoroot/builds', '$buildtarget') or die $!;
my $remove = "$buildtarget/embedruntimes/win32/libmono.bsc";
if (-e $remove)
{
unlink($remove) or die("can't delete libmono.bsc");
}
#have a duplicate for now...
copy("$buildtarget/embedruntimes/win32/mono.dll","$buildtarget/monodistribution/bin/mono.dll");
copy("$buildtarget/embedruntimes/win32/mono.pdb","$buildtarget/monodistribution/bin/mono.pdb");
if ($ENV{UNITY_THISISABUILDMACHINE})
{
system("echo mono-runtime-win32 = $ENV{'BUILD_VCS_NUMBER'} > $buildtargetwin\\versions.txt");
}
sub CompileVCProj
{
my $sln = shift(@_);
my $slnconfig = shift(@_);
my $incremental = shift(@_);
my $projectname = shift(@_);
my @optional = @_;
my @devenvlocations = ($ENV{"PROGRAMFILES(X86)"}."/Microsoft Visual Studio 10.0/Common7/IDE/devenv.com",
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 10.0/Common7/IDE/devenv.com",
"$ENV{REALVSPATH}/Common7/IDE/devenv.com");
my $devenv;
foreach my $devenvoption (@devenvlocations)
{
if (-e $devenvoption) {
$devenv = $devenvoption;
}
}
my $buildcmd = $incremental ? "/build" : "/rebuild";
if (defined $projectname)
{
print "devenv.exe $sln $buildcmd $slnconfig /project $projectname @optional \n\n";
system($devenv, $sln, $buildcmd, $slnconfig, '/project', $projectname, @optional) eq 0
or die("VisualStudio failed to build $sln");
} else {
print "devenv.exe $sln $buildcmd $slnconfig\n\n";
system($devenv, $sln, $buildcmd, $slnconfig) eq 0
or die("VisualStudio failed to build $sln");
}
}