File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ param (
2
+ [string ]$buildtype = " Release" ,
3
+ [int ]$clean = 0 # Before building, delete the build directory entirely
4
+ )
5
+
6
+ function check_command {
7
+ param ([string ]$command )
8
+ if ((get-command $command - ea silentlycontinue) -eq $null ) {
9
+ return 1 ;
10
+ }
11
+ return 0 ;
12
+ }
13
+
14
+ if (check_command(" cl" ) - e 0 ) {
15
+ ./ vcvars2019.ps1
16
+ }
17
+
18
+ # Check prerequisites
19
+ $missing = check_command(" cmake" )
20
+ $missing += check_command(" ninja" )
21
+ $missing += check_command(" cl" )
22
+
23
+ if ($missing ) {
24
+ write-host " Visual Studio 2019 was not found!"
25
+ return ;
26
+ }
27
+
28
+ $builddir = " $psscriptroot /build/win32/$buildtype "
29
+
30
+ if ($clean -ne 0 ) {
31
+ write-host " -- Cleaning.."
32
+ rm - r - force - ea silentlycontinue $builddir
33
+ }
34
+
35
+ write-host " Building $buildtype to $builddir "
36
+ pushd # Store current path
37
+
38
+ mkdir - ea silentlycontinue $builddir
39
+ cd $builddir
40
+
41
+ cmake ../ ../ ../ physx - G Ninja - DCMAKE_BUILD_TYPE= " $buildtype "
42
+
43
+ cmake -- build . -- config $buildtype -- target install
44
+
45
+ popd # Restore current path
46
+
47
+ exit $LastExitCode
Original file line number Diff line number Diff line change
1
+ pushd " C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build"
2
+ cmd / c " vcvars64.bat&set" | foreach {
3
+ if ($_ -match " =" ) {
4
+ $v = $_.split (" =" ); set-item - force - path " ENV:\$ ( $v [0 ]) " - value " $ ( $v [1 ]) "
5
+ }
6
+ }
7
+ popd
8
+ Write-Host " Visual Studio 2019 Command Prompt variables set." - ForegroundColor Yellow
You can’t perform that action at this time.
0 commit comments