113498266Sopenharmony_ci@echo off
213498266Sopenharmony_cirem ***************************************************************************
313498266Sopenharmony_cirem *                                  _   _ ____  _
413498266Sopenharmony_cirem *  Project                     ___| | | |  _ \| |
513498266Sopenharmony_cirem *                             / __| | | | |_) | |
613498266Sopenharmony_cirem *                            | (__| |_| |  _ <| |___
713498266Sopenharmony_cirem *                             \___|\___/|_| \_\_____|
813498266Sopenharmony_cirem *
913498266Sopenharmony_cirem * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
1013498266Sopenharmony_cirem * Copyright (C) Jay Satiro, <raysatiro@yahoo.com>.
1113498266Sopenharmony_cirem *
1213498266Sopenharmony_cirem * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_cirem * you should have received as part of this distribution. The terms
1413498266Sopenharmony_cirem * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_cirem *
1613498266Sopenharmony_cirem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_cirem * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_cirem * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_cirem *
2013498266Sopenharmony_cirem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_cirem * KIND, either express or implied.
2213498266Sopenharmony_cirem *
2313498266Sopenharmony_cirem * SPDX-License-Identifier: curl
2413498266Sopenharmony_cirem *
2513498266Sopenharmony_cirem ***************************************************************************
2613498266Sopenharmony_ci
2713498266Sopenharmony_ci:begin
2813498266Sopenharmony_ci  rem Check we are running on a Windows NT derived OS
2913498266Sopenharmony_ci  if not "%OS%" == "Windows_NT" goto nodos
3013498266Sopenharmony_ci
3113498266Sopenharmony_ci  rem Set our variables
3213498266Sopenharmony_ci  setlocal
3313498266Sopenharmony_ci  set SUCCESSFUL_BUILDS=
3413498266Sopenharmony_ci  set VC_VER=
3513498266Sopenharmony_ci  set BUILD_PLATFORM=
3613498266Sopenharmony_ci  set DEFAULT_START_DIR=..\..\wolfssl
3713498266Sopenharmony_ci
3813498266Sopenharmony_ci  rem Calculate the program files directory
3913498266Sopenharmony_ci  if defined PROGRAMFILES (
4013498266Sopenharmony_ci    set "PF=%PROGRAMFILES%"
4113498266Sopenharmony_ci    set OS_PLATFORM=x86
4213498266Sopenharmony_ci  )
4313498266Sopenharmony_ci  if defined PROGRAMFILES(x86) (
4413498266Sopenharmony_ci    rem Visual Studio was x86-only prior to 14.3
4513498266Sopenharmony_ci    if /i "%~1" == "vc14.3" (
4613498266Sopenharmony_ci      set "PF=%PROGRAMFILES%"
4713498266Sopenharmony_ci    ) else (
4813498266Sopenharmony_ci      set "PF=%PROGRAMFILES(x86)%"
4913498266Sopenharmony_ci    )
5013498266Sopenharmony_ci    set OS_PLATFORM=x64
5113498266Sopenharmony_ci  )
5213498266Sopenharmony_ci
5313498266Sopenharmony_ci  rem Ensure we have the required arguments
5413498266Sopenharmony_ci  if /i "%~1" == "" goto syntax
5513498266Sopenharmony_ci
5613498266Sopenharmony_ci:parseArgs
5713498266Sopenharmony_ci  if "%~1" == "" goto prerequisites
5813498266Sopenharmony_ci
5913498266Sopenharmony_ci  if /i "%~1" == "vc10" (
6013498266Sopenharmony_ci    set VC_VER=10.0
6113498266Sopenharmony_ci    set VC_DESC=VC10
6213498266Sopenharmony_ci    set VC_TOOLSET=v100
6313498266Sopenharmony_ci    set "VC_PATH=Microsoft Visual Studio 10.0\VC"
6413498266Sopenharmony_ci  ) else if /i "%~1" == "vc11" (
6513498266Sopenharmony_ci    set VC_VER=11.0
6613498266Sopenharmony_ci    set VC_DESC=VC11
6713498266Sopenharmony_ci    set VC_TOOLSET=v110
6813498266Sopenharmony_ci    set "VC_PATH=Microsoft Visual Studio 11.0\VC"
6913498266Sopenharmony_ci  ) else if /i "%~1" == "vc12" (
7013498266Sopenharmony_ci    set VC_VER=12.0
7113498266Sopenharmony_ci    set VC_DESC=VC12
7213498266Sopenharmony_ci    set VC_TOOLSET=v120
7313498266Sopenharmony_ci    set "VC_PATH=Microsoft Visual Studio 12.0\VC"
7413498266Sopenharmony_ci  ) else if /i "%~1" == "vc14" (
7513498266Sopenharmony_ci    set VC_VER=14.0
7613498266Sopenharmony_ci    set VC_DESC=VC14
7713498266Sopenharmony_ci    set VC_TOOLSET=v140
7813498266Sopenharmony_ci    set "VC_PATH=Microsoft Visual Studio 14.0\VC"
7913498266Sopenharmony_ci  ) else if /i "%~1" == "vc14.1" (
8013498266Sopenharmony_ci    set VC_VER=14.1
8113498266Sopenharmony_ci    set VC_DESC=VC14.10
8213498266Sopenharmony_ci    set VC_TOOLSET=v141
8313498266Sopenharmony_ci
8413498266Sopenharmony_ci    rem Determine the VC14.1 path based on the installed edition in descending
8513498266Sopenharmony_ci    rem order (Enterprise, then Professional and finally Community)
8613498266Sopenharmony_ci    if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
8713498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
8813498266Sopenharmony_ci    ) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
8913498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
9013498266Sopenharmony_ci    ) else (
9113498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
9213498266Sopenharmony_ci    )
9313498266Sopenharmony_ci  ) else if /i "%~1" == "vc14.2" (
9413498266Sopenharmony_ci    set VC_VER=14.2
9513498266Sopenharmony_ci    set VC_DESC=VC14.20
9613498266Sopenharmony_ci    set VC_TOOLSET=v142
9713498266Sopenharmony_ci
9813498266Sopenharmony_ci    rem Determine the VC14.2 path based on the installed edition in descending
9913498266Sopenharmony_ci    rem order (Enterprise, then Professional and finally Community)
10013498266Sopenharmony_ci    if exist "%PF%\Microsoft Visual Studio\2019\Enterprise\VC" (
10113498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2019\Enterprise\VC"
10213498266Sopenharmony_ci    ) else if exist "%PF%\Microsoft Visual Studio\2019\Professional\VC" (
10313498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2019\Professional\VC"
10413498266Sopenharmony_ci    ) else (
10513498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2019\Community\VC"
10613498266Sopenharmony_ci    )
10713498266Sopenharmony_ci  ) else if /i "%~1" == "vc14.3" (
10813498266Sopenharmony_ci    set VC_VER=14.3
10913498266Sopenharmony_ci    set VC_DESC=VC14.30
11013498266Sopenharmony_ci    set VC_TOOLSET=v143
11113498266Sopenharmony_ci
11213498266Sopenharmony_ci    rem Determine the VC14.3 path based on the installed edition in descending
11313498266Sopenharmony_ci    rem order (Enterprise, then Professional and finally Community)
11413498266Sopenharmony_ci    if exist "%PF%\Microsoft Visual Studio\2022\Enterprise\VC" (
11513498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2022\Enterprise\VC"
11613498266Sopenharmony_ci    ) else if exist "%PF%\Microsoft Visual Studio\2022\Professional\VC" (
11713498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2022\Professional\VC"
11813498266Sopenharmony_ci    ) else (
11913498266Sopenharmony_ci      set "VC_PATH=Microsoft Visual Studio\2022\Community\VC"
12013498266Sopenharmony_ci    )
12113498266Sopenharmony_ci  ) else if /i "%~1" == "x86" (
12213498266Sopenharmony_ci    set BUILD_PLATFORM=x86
12313498266Sopenharmony_ci  ) else if /i "%~1" == "x64" (
12413498266Sopenharmony_ci    set BUILD_PLATFORM=x64
12513498266Sopenharmony_ci  ) else if /i "%~1" == "debug" (
12613498266Sopenharmony_ci    set BUILD_CONFIG=debug
12713498266Sopenharmony_ci  ) else if /i "%~1" == "release" (
12813498266Sopenharmony_ci    set BUILD_CONFIG=release
12913498266Sopenharmony_ci  ) else if /i "%~1" == "-?" (
13013498266Sopenharmony_ci    goto syntax
13113498266Sopenharmony_ci  ) else if /i "%~1" == "-h" (
13213498266Sopenharmony_ci    goto syntax
13313498266Sopenharmony_ci  ) else if /i "%~1" == "-help" (
13413498266Sopenharmony_ci    goto syntax
13513498266Sopenharmony_ci  ) else (
13613498266Sopenharmony_ci    if not defined START_DIR (
13713498266Sopenharmony_ci      set START_DIR=%~1
13813498266Sopenharmony_ci    ) else (
13913498266Sopenharmony_ci      goto unknown
14013498266Sopenharmony_ci    )
14113498266Sopenharmony_ci  )
14213498266Sopenharmony_ci
14313498266Sopenharmony_ci  shift & goto parseArgs
14413498266Sopenharmony_ci
14513498266Sopenharmony_ci:prerequisites
14613498266Sopenharmony_ci  rem Compiler is a required parameter
14713498266Sopenharmony_ci  if not defined VC_VER goto syntax
14813498266Sopenharmony_ci
14913498266Sopenharmony_ci  rem Default the start directory if one isn't specified
15013498266Sopenharmony_ci  if not defined START_DIR set "START_DIR=%DEFAULT_START_DIR%"
15113498266Sopenharmony_ci
15213498266Sopenharmony_ci  rem Check we have a program files directory
15313498266Sopenharmony_ci  if not defined PF goto nopf
15413498266Sopenharmony_ci
15513498266Sopenharmony_ci  rem Check we have Visual Studio installed
15613498266Sopenharmony_ci  if not exist "%PF%\%VC_PATH%" goto novc
15713498266Sopenharmony_ci
15813498266Sopenharmony_ci  rem Check the start directory exists
15913498266Sopenharmony_ci  if not exist "%START_DIR%" goto nowolfssl
16013498266Sopenharmony_ci
16113498266Sopenharmony_ci:configure
16213498266Sopenharmony_ci  if "%BUILD_PLATFORM%" == "" set BUILD_PLATFORM=%OS_PLATFORM%
16313498266Sopenharmony_ci
16413498266Sopenharmony_ci  if "%BUILD_PLATFORM%" == "x86" (
16513498266Sopenharmony_ci    set VCVARS_PLATFORM=x86
16613498266Sopenharmony_ci  ) else if "%BUILD_PLATFORM%" == "x64" (
16713498266Sopenharmony_ci    if "%VC_VER%" == "10.0" set VCVARS_PLATFORM=%BUILD_PLATFORM%
16813498266Sopenharmony_ci    if "%VC_VER%" == "11.0" set VCVARS_PLATFORM=amd64
16913498266Sopenharmony_ci    if "%VC_VER%" == "12.0" set VCVARS_PLATFORM=amd64
17013498266Sopenharmony_ci    if "%VC_VER%" == "14.0" set VCVARS_PLATFORM=amd64
17113498266Sopenharmony_ci    if "%VC_VER%" == "14.1" set VCVARS_PLATFORM=amd64
17213498266Sopenharmony_ci    if "%VC_VER%" == "14.2" set VCVARS_PLATFORM=amd64
17313498266Sopenharmony_ci    if "%VC_VER%" == "14.3" set VCVARS_PLATFORM=amd64
17413498266Sopenharmony_ci  )
17513498266Sopenharmony_ci
17613498266Sopenharmony_ci:start
17713498266Sopenharmony_ci  echo.
17813498266Sopenharmony_ci  set SAVED_PATH=%CD%
17913498266Sopenharmony_ci
18013498266Sopenharmony_ci  if "%VC_VER%" == "14.1" (
18113498266Sopenharmony_ci    call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
18213498266Sopenharmony_ci  ) else if "%VC_VER%" == "14.2" (
18313498266Sopenharmony_ci    call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
18413498266Sopenharmony_ci  ) else if "%VC_VER%" == "14.3" (
18513498266Sopenharmony_ci    call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
18613498266Sopenharmony_ci  ) else (
18713498266Sopenharmony_ci    call "%PF%\%VC_PATH%\vcvarsall" %VCVARS_PLATFORM%
18813498266Sopenharmony_ci  )
18913498266Sopenharmony_ci
19013498266Sopenharmony_ci  echo.
19113498266Sopenharmony_ci  cd /d %SAVED_PATH%
19213498266Sopenharmony_ci  if defined START_DIR cd /d %START_DIR%
19313498266Sopenharmony_ci  goto %BUILD_PLATFORM%
19413498266Sopenharmony_ci
19513498266Sopenharmony_ci:x64
19613498266Sopenharmony_ci  rem Calculate our output directory
19713498266Sopenharmony_ci  set OUTDIR=build\Win64\%VC_DESC%
19813498266Sopenharmony_ci  if not exist %OUTDIR% md %OUTDIR%
19913498266Sopenharmony_ci
20013498266Sopenharmony_ci  if "%BUILD_CONFIG%" == "release" goto x64release
20113498266Sopenharmony_ci
20213498266Sopenharmony_ci:x64debug
20313498266Sopenharmony_ci  rem Perform 64-bit Debug Build
20413498266Sopenharmony_ci
20513498266Sopenharmony_ci  call :build Debug x64
20613498266Sopenharmony_ci  if errorlevel 1 goto error
20713498266Sopenharmony_ci
20813498266Sopenharmony_ci  call :build "DLL Debug" x64
20913498266Sopenharmony_ci  if errorlevel 1 goto error
21013498266Sopenharmony_ci
21113498266Sopenharmony_ci  if "%BUILD_CONFIG%" == "debug" goto success
21213498266Sopenharmony_ci
21313498266Sopenharmony_ci:x64release
21413498266Sopenharmony_ci  rem Perform 64-bit Release Build
21513498266Sopenharmony_ci
21613498266Sopenharmony_ci  call :build Release x64
21713498266Sopenharmony_ci  if errorlevel 1 goto error
21813498266Sopenharmony_ci
21913498266Sopenharmony_ci  call :build "DLL Release" x64
22013498266Sopenharmony_ci  if errorlevel 1 goto error
22113498266Sopenharmony_ci
22213498266Sopenharmony_ci  goto success
22313498266Sopenharmony_ci
22413498266Sopenharmony_ci:x86
22513498266Sopenharmony_ci  rem Calculate our output directory
22613498266Sopenharmony_ci  set OUTDIR=build\Win32\%VC_DESC%
22713498266Sopenharmony_ci  if not exist %OUTDIR% md %OUTDIR%
22813498266Sopenharmony_ci
22913498266Sopenharmony_ci  if "%BUILD_CONFIG%" == "release" goto x86release
23013498266Sopenharmony_ci
23113498266Sopenharmony_ci:x86debug
23213498266Sopenharmony_ci  rem Perform 32-bit Debug Build
23313498266Sopenharmony_ci
23413498266Sopenharmony_ci  call :build Debug Win32
23513498266Sopenharmony_ci  if errorlevel 1 goto error
23613498266Sopenharmony_ci
23713498266Sopenharmony_ci  call :build "DLL Debug" Win32
23813498266Sopenharmony_ci  if errorlevel 1 goto error
23913498266Sopenharmony_ci
24013498266Sopenharmony_ci  if "%BUILD_CONFIG%" == "debug" goto success
24113498266Sopenharmony_ci
24213498266Sopenharmony_ci:x86release
24313498266Sopenharmony_ci  rem Perform 32-bit Release Build
24413498266Sopenharmony_ci
24513498266Sopenharmony_ci  call :build Release Win32
24613498266Sopenharmony_ci  if errorlevel 1 goto error
24713498266Sopenharmony_ci
24813498266Sopenharmony_ci  call :build "DLL Release" Win32
24913498266Sopenharmony_ci  if errorlevel 1 goto error
25013498266Sopenharmony_ci
25113498266Sopenharmony_ci  goto success
25213498266Sopenharmony_ci
25313498266Sopenharmony_ci:build
25413498266Sopenharmony_ci  rem This function builds wolfSSL.
25513498266Sopenharmony_ci  rem Usage: CALL :build <configuration> <platform>
25613498266Sopenharmony_ci  rem The current directory must be the wolfSSL directory.
25713498266Sopenharmony_ci  rem VS Configuration: Debug, Release, DLL Debug or DLL Release.
25813498266Sopenharmony_ci  rem VS Platform: Win32 or x64.
25913498266Sopenharmony_ci  rem Returns: 1 on fail, 0 on success.
26013498266Sopenharmony_ci  rem An informational message should be shown before any return.
26113498266Sopenharmony_ci  setlocal
26213498266Sopenharmony_ci  set MSBUILD_CONFIG=%~1
26313498266Sopenharmony_ci  set MSBUILD_PLATFORM=%~2
26413498266Sopenharmony_ci
26513498266Sopenharmony_ci  if not exist wolfssl64.sln (
26613498266Sopenharmony_ci    echo.
26713498266Sopenharmony_ci    echo Error: build: wolfssl64.sln not found in "%CD%"
26813498266Sopenharmony_ci    exit /b 1
26913498266Sopenharmony_ci  )
27013498266Sopenharmony_ci
27113498266Sopenharmony_ci  rem OUTDIR isn't a full path, only relative. MSBUILD_OUTDIR must be full and
27213498266Sopenharmony_ci  rem not have trailing backslashes, which are handled later.
27313498266Sopenharmony_ci  if "%MSBUILD_CONFIG%" == "Debug" (
27413498266Sopenharmony_ci    set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\LIB Debug"
27513498266Sopenharmony_ci  ) else if "%MSBUILD_CONFIG%" == "Release" (
27613498266Sopenharmony_ci    set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\LIB Release"
27713498266Sopenharmony_ci  ) else if "%MSBUILD_CONFIG%" == "DLL Debug" (
27813498266Sopenharmony_ci    set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\DLL Debug"
27913498266Sopenharmony_ci  ) else if "%MSBUILD_CONFIG%" == "DLL Release" (
28013498266Sopenharmony_ci    set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\DLL Release"
28113498266Sopenharmony_ci  ) else (
28213498266Sopenharmony_ci    echo.
28313498266Sopenharmony_ci    echo Error: build: Configuration not recognized.
28413498266Sopenharmony_ci    exit /b 1
28513498266Sopenharmony_ci  )
28613498266Sopenharmony_ci
28713498266Sopenharmony_ci  if not "%MSBUILD_PLATFORM%" == "Win32" if not "%MSBUILD_PLATFORM%" == "x64" (
28813498266Sopenharmony_ci    echo.
28913498266Sopenharmony_ci    echo Error: build: Platform not recognized.
29013498266Sopenharmony_ci    exit /b 1
29113498266Sopenharmony_ci  )
29213498266Sopenharmony_ci
29313498266Sopenharmony_ci  copy /v /y "%~dp0\wolfssl_options.h" .\cyassl\options.h
29413498266Sopenharmony_ci  if %ERRORLEVEL% neq 0 (
29513498266Sopenharmony_ci    echo.
29613498266Sopenharmony_ci    echo Error: build: Couldn't replace .\cyassl\options.h
29713498266Sopenharmony_ci    exit /b 1
29813498266Sopenharmony_ci  )
29913498266Sopenharmony_ci
30013498266Sopenharmony_ci  copy /v /y "%~dp0\wolfssl_options.h" .\wolfssl\options.h
30113498266Sopenharmony_ci  if %ERRORLEVEL% neq 0 (
30213498266Sopenharmony_ci    echo.
30313498266Sopenharmony_ci    echo Error: build: Couldn't replace .\wolfssl\options.h
30413498266Sopenharmony_ci    exit /b 1
30513498266Sopenharmony_ci  )
30613498266Sopenharmony_ci
30713498266Sopenharmony_ci  rem Extra trailing \ in Dirs because otherwise it thinks a quote is escaped
30813498266Sopenharmony_ci  msbuild wolfssl64.sln ^
30913498266Sopenharmony_ci    -p:CustomAfterMicrosoftCommonTargets="%~dp0\wolfssl_override.props" ^
31013498266Sopenharmony_ci    -p:Configuration="%MSBUILD_CONFIG%" ^
31113498266Sopenharmony_ci    -p:Platform="%MSBUILD_PLATFORM%" ^
31213498266Sopenharmony_ci    -p:PlatformToolset="%VC_TOOLSET%" ^
31313498266Sopenharmony_ci    -p:OutDir="%MSBUILD_OUTDIR%\\" ^
31413498266Sopenharmony_ci    -p:IntDir="%MSBUILD_OUTDIR%\obj\\"
31513498266Sopenharmony_ci
31613498266Sopenharmony_ci  if %ERRORLEVEL% neq 0 (
31713498266Sopenharmony_ci    echo.
31813498266Sopenharmony_ci    echo Error: Failed building wolfSSL %MSBUILD_CONFIG%^|%MSBUILD_PLATFORM%.
31913498266Sopenharmony_ci    exit /b 1
32013498266Sopenharmony_ci  )
32113498266Sopenharmony_ci
32213498266Sopenharmony_ci  rem For tests to run properly the wolfSSL directory must remain the current.
32313498266Sopenharmony_ci  set "PATH=%MSBUILD_OUTDIR%;%PATH%"
32413498266Sopenharmony_ci  "%MSBUILD_OUTDIR%\testsuite.exe"
32513498266Sopenharmony_ci
32613498266Sopenharmony_ci  if %ERRORLEVEL% neq 0 (
32713498266Sopenharmony_ci    echo.
32813498266Sopenharmony_ci    echo Error: Failed testing wolfSSL %MSBUILD_CONFIG%^|%MSBUILD_PLATFORM%.
32913498266Sopenharmony_ci    exit /b 1
33013498266Sopenharmony_ci  )
33113498266Sopenharmony_ci
33213498266Sopenharmony_ci  echo.
33313498266Sopenharmony_ci  echo Success: Built and tested wolfSSL %MSBUILD_CONFIG%^|%MSBUILD_PLATFORM%.
33413498266Sopenharmony_ci  echo.
33513498266Sopenharmony_ci  echo.
33613498266Sopenharmony_ci  rem This is necessary to export our local variables back to the caller.
33713498266Sopenharmony_ci  endlocal & set SUCCESSFUL_BUILDS="%MSBUILD_CONFIG%|%MSBUILD_PLATFORM%" ^
33813498266Sopenharmony_ci    %SUCCESSFUL_BUILDS%
33913498266Sopenharmony_ci  exit /b 0
34013498266Sopenharmony_ci
34113498266Sopenharmony_ci:syntax
34213498266Sopenharmony_ci  rem Display the help
34313498266Sopenharmony_ci  echo.
34413498266Sopenharmony_ci  echo Usage: build-wolfssl ^<compiler^> [platform] [configuration] [directory]
34513498266Sopenharmony_ci  echo.
34613498266Sopenharmony_ci  echo.
34713498266Sopenharmony_ci  echo Compiler:
34813498266Sopenharmony_ci  echo.
34913498266Sopenharmony_ci  echo vc10      - Use Visual Studio 2010
35013498266Sopenharmony_ci  echo vc11      - Use Visual Studio 2012
35113498266Sopenharmony_ci  echo vc12      - Use Visual Studio 2013
35213498266Sopenharmony_ci  echo vc14      - Use Visual Studio 2015
35313498266Sopenharmony_ci  echo vc14.1    - Use Visual Studio 2017
35413498266Sopenharmony_ci  echo vc14.2    - Use Visual Studio 2019
35513498266Sopenharmony_ci  echo vc14.3    - Use Visual Studio 2022
35613498266Sopenharmony_ci  echo.
35713498266Sopenharmony_ci  echo.
35813498266Sopenharmony_ci  echo Platform:
35913498266Sopenharmony_ci  echo.
36013498266Sopenharmony_ci  echo x86       - Perform a 32-bit build
36113498266Sopenharmony_ci  echo x64       - Perform a 64-bit build
36213498266Sopenharmony_ci  echo.
36313498266Sopenharmony_ci  echo If this parameter is unset the OS platform is used ^(%OS_PLATFORM%^).
36413498266Sopenharmony_ci  echo.
36513498266Sopenharmony_ci  echo.
36613498266Sopenharmony_ci  echo Configuration:
36713498266Sopenharmony_ci  echo.
36813498266Sopenharmony_ci  echo debug     - Perform a debug build
36913498266Sopenharmony_ci  echo release   - Perform a release build
37013498266Sopenharmony_ci  echo.
37113498266Sopenharmony_ci  echo If this parameter is unset both configurations are built.
37213498266Sopenharmony_ci  echo.
37313498266Sopenharmony_ci  echo.
37413498266Sopenharmony_ci  echo Other:
37513498266Sopenharmony_ci  echo.
37613498266Sopenharmony_ci  echo directory - Specifies the wolfSSL source directory
37713498266Sopenharmony_ci  echo.
37813498266Sopenharmony_ci  echo If this parameter is unset the directory used is "%DEFAULT_START_DIR%".
37913498266Sopenharmony_ci  echo.
38013498266Sopenharmony_ci  goto error
38113498266Sopenharmony_ci
38213498266Sopenharmony_ci:unknown
38313498266Sopenharmony_ci  echo.
38413498266Sopenharmony_ci  echo Error: Unknown argument '%1'
38513498266Sopenharmony_ci  goto error
38613498266Sopenharmony_ci
38713498266Sopenharmony_ci:nodos
38813498266Sopenharmony_ci  echo.
38913498266Sopenharmony_ci  echo Error: Only a Windows NT based Operating System is supported
39013498266Sopenharmony_ci  goto error
39113498266Sopenharmony_ci
39213498266Sopenharmony_ci:nopf
39313498266Sopenharmony_ci  echo.
39413498266Sopenharmony_ci  echo Error: Cannot obtain the directory for Program Files
39513498266Sopenharmony_ci  goto error
39613498266Sopenharmony_ci
39713498266Sopenharmony_ci:novc
39813498266Sopenharmony_ci  echo.
39913498266Sopenharmony_ci  echo Error: %VC_DESC% is not installed
40013498266Sopenharmony_ci  goto error
40113498266Sopenharmony_ci
40213498266Sopenharmony_ci:nox64
40313498266Sopenharmony_ci  echo.
40413498266Sopenharmony_ci  echo Error: %VC_DESC% does not support 64-bit builds
40513498266Sopenharmony_ci  goto error
40613498266Sopenharmony_ci
40713498266Sopenharmony_ci:nowolfssl
40813498266Sopenharmony_ci  echo.
40913498266Sopenharmony_ci  echo Error: Cannot locate wolfSSL source directory, expected "%START_DIR%"
41013498266Sopenharmony_ci  goto error
41113498266Sopenharmony_ci
41213498266Sopenharmony_ci:error
41313498266Sopenharmony_ci  if "%OS%" == "Windows_NT" endlocal
41413498266Sopenharmony_ci  exit /B 1
41513498266Sopenharmony_ci
41613498266Sopenharmony_ci:success
41713498266Sopenharmony_ci  if defined SUCCESSFUL_BUILDS (
41813498266Sopenharmony_ci    echo.
41913498266Sopenharmony_ci    echo.
42013498266Sopenharmony_ci    echo Build complete.
42113498266Sopenharmony_ci    echo.
42213498266Sopenharmony_ci    echo The following configurations were built and tested successfully:
42313498266Sopenharmony_ci    echo.
42413498266Sopenharmony_ci    echo %SUCCESSFUL_BUILDS%
42513498266Sopenharmony_ci    echo.
42613498266Sopenharmony_ci  )
42713498266Sopenharmony_ci  cd /d %SAVED_PATH%
42813498266Sopenharmony_ci  endlocal
42913498266Sopenharmony_ci  exit /B 0
430