aboutsummaryrefslogtreecommitdiff
path: root/PxShared/common.pm
blob: a4a7cebfc917f66c94ba9583e544e690069a5953 (plain) (blame)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
sub GetXPJ
{
	my $xpj = "";
	if ( $^O eq 'linux' )
	{
	  $xpj= "$ENV{P4ROOT_PATH}/physx/buildtools/xpj/1/linux/xpj4";
	}
	elsif ( $^O eq 'darwin' )
	{
	  $xpj= "$ENV{P4ROOT_PATH}/physx/buildtools/xpj/1/osx32/xpj4";
	}
	else
	{
	  $xpj= "$ENV{P4ROOT_PATH}/physx/buildtools/xpj/1/win32/xpj4.exe";
	  $xpj =~ s#/#\\#g;
	}
	return $xpj;
}

sub EnsurePath
{
	my @missed_files;

	foreach (@_)
	{
	push @missed_files, $_ unless (-d $_ or -e $_);
	}

	if ($#missed_files > 0)
	{
	print( "Not all necessaried directories in P4 were synced, please sync the following paths:\n" );
	foreach my $file (@missed_files)
	{
	  print ("\t$file\n");
	}

	die "Missing files";
	}
}

sub GenerateSolutions
{
	my $project = shift;
	my $xpj = GetXPJ();
	if ( $^O eq 'MSWin32' )
	{
	  foreach my $platform (qw(win32 win64))
	  {
			$ENV{PLATFORM} = "windows";
	    foreach my $tool (qw(vc11 vc12 vc14))
	    {
	        print "Generating $tool for $platform ...\n";
	        system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" );
	    }
	  }

	  foreach my $platform (qw(win32modern win64modern win8arm))
	  {
	    $ENV{PLATFORM} = "windows";
	    foreach my $tool (qw(vc11))
	    {
	        print "Generating $tool for $platform ...\n";
	        system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" );
	    }
	  }
		
		foreach my $platform (qw(xboxone))
	  {
	    $ENV{PLATFORM} = "xboxone";
	    foreach my $tool (qw(vc11 vc14))
	    {
	        print "Generating $tool for $platform ...\n";
	        system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" );
	    }
	  }
	  foreach my $platform (qw(ps4))
	  {
		  $ENV{PLATFORM} = "ps4";
	    foreach my $tool (qw(vc10 vc11 vc12 vc14))
	    {
	        print "Generating $tool for $platform ...\n";
	        system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" );
	    }
	  }
	}
	elsif ( $^O eq 'darwin' )
	{
	  foreach my $platform (qw(osx32 osx64 ios ios64))
	  {
			$ENV{PLATFORM} = "unix";
	    foreach my $tool (qw(make))
	    {
	        print "Generating $tool for $platform ...\n";
	        system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" );
	    }
	  }
	}
	elsif ( $^O eq 'linux' )
	{
	  foreach my $platform (qw(linux32 linux64))
	  {
			$ENV{PLATFORM} = "unix";
	    foreach my $tool (qw(make))
	    {
	        print "Generating $tool for $platform ...\n";
	        system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" );
	    }
	  }
	}
}

1;