-
Notifications
You must be signed in to change notification settings - Fork 68
/
BuildAwsSdkWin64.bat
82 lines (71 loc) · 3.21 KB
/
BuildAwsSdkWin64.bat
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
SET EXITCODE=0
SET SCRIPT_DIR=%~dp0
SET SDK_REPO_DIR=%SCRIPT_DIR%aws-sdk-cpp\
SET SDK_BUILD_DIR=%SDK_REPO_DIR%_build\
SET SDK_INSTALL_DIR=%SDK_REPO_DIR%_install\
SET MODULE_WIN64_DIR=%SCRIPT_DIR%Win64\
@REM Find and run VsDevCmd.bat to add the msbuild command to Path
SET VS_INSTALLPATH=
IF EXIST "%programfiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
FOR /F "tokens=* USEBACKQ" %%F IN (
`"%programfiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16.0 -property installationPath`
) DO (
SET VS_INSTALLPATH=%%F
)
)
IF NOT EXIST "%VS_INSTALLPATH%" (
@for /F "usebackq delims=" %%I in (`powershell -command "$a=Get-CimInstance MSFT_VSInstance|Out-String|Select-String -Pattern 'InstallLocation.*: (.*)';echo $a.Matches.groups[1].Value"`) do set VS_INSTALLPATH=%%I
)
IF NOT EXIST "%VS_INSTALLPATH%" (
SET /P VS_INSTALLPATH="Enter absolute path to the VS install path. Typically looks like Program Files/Microsoft Visual Studio/Community/2019. The folder named Common7 should be in this folder. Path="
)
IF NOT EXIST "%VS_INSTALLPATH%" (
ECHO "Valid Visual Studio install path not found. Installation FAILED. Re-run after installing VS 2019 and/or enter in the correct path."
GOTO FAILED
)
CALL "%VS_INSTALLPATH%\Common7\Tools\VsDevCmd.bat"
@REM Clone the repo
IF NOT EXIST "%SDK_REPO_DIR%" (
PUSHD "%SCRIPT_DIR%"
git clone -c core.longpaths=true --recurse-submodules https://github.com/aws/aws-sdk-cpp.git
IF %ERRORLEVEL% NEQ 0 ( POPD & GOTO FAILED )
POPD
PUSHD "%SDK_REPO_DIR%"
IF %ERRORLEVEL% NEQ 0 ( POPD & GOTO FAILED )
POPD
)
@REM Create build and install directories where we will build and install the SDK to
IF EXIST "%SDK_BUILD_DIR%" ( RMDIR /Q /S "%SDK_BUILD_DIR%" )
MKDIR "%SDK_BUILD_DIR%"
IF EXIST "%SDK_INSTALL_DIR%" ( RMDIR /Q /S "%SDK_INSTALL_DIR%" )
MKDIR "%SDK_INSTALL_DIR%"
@REM Build and install the SDK
PUSHD "%SDK_BUILD_DIR%"
cmake .. -G "Visual Studio 16 2019" -DBUILD_ONLY=polly -DCUSTOM_MEMORY_MANAGEMENT=ON -DCMAKE_INSTALL_PREFIX="%SDK_INSTALL_DIR%"
IF %ERRORLEVEL% NEQ 0 ( POPD & GOTO FAILED )
msbuild ALL_BUILD.vcxproj /p:Configuration=Release /p:DebugSymbols=true
IF %ERRORLEVEL% NEQ 0 ( POPD & GOTO FAILED )
msbuild INSTALL.vcxproj /p:Configuration=Release /p:DebugSymbols=true
IF %ERRORLEVEL% NEQ 0 ( POPD & GOTO FAILED )
POPD
@REM Remove any previous builds from the platform specific directory
IF EXIST "%MODULE_WIN64_DIR%" ( RMDIR /Q /S "%MODULE_WIN64_DIR%" )
IF %ERRORLEVEL% NEQ 0 ( GOTO FAILED )
MKDIR "%MODULE_WIN64_DIR%"
IF %ERRORLEVEL% NEQ 0 ( GOTO FAILED )
@REM Copy the new build to the platform specific directory
xcopy "%SDK_INSTALL_DIR%include" "%MODULE_WIN64_DIR%include" /E/H/C/I
MKDIR "%MODULE_WIN64_DIR%"bin
MKDIR "%MODULE_WIN64_DIR%"lib
xcopy "%SDK_INSTALL_DIR%"bin\*.dll "%MODULE_WIN64_DIR%bin" /E/H/C/I
xcopy "%SDK_BUILD_DIR%"bin\Release\*.pdb "%MODULE_WIN64_DIR%bin" /E/H/C/I
@REM Some of the libs are built to the bin folder for some weird reason
xcopy "%SDK_INSTALL_DIR%"bin\*.lib "%MODULE_WIN64_DIR%lib"
xcopy "%SDK_INSTALL_DIR%"lib\*.lib "%MODULE_WIN64_DIR%lib"
@REM Remove the cloned repo, build, and install directory.
RMDIR /Q /S "%SDK_REPO_DIR%"
GOTO SUCCESS
:FAILED
set EXITCODE=1
:SUCCESS
EXIT /B %EXITCODE%