Warrior_EA/DirectML/build_cpu.bat

43 lines
1.3 KiB
Batchfile
Raw Permalink Normal View History

@echo off
REM Builds WarriorCPU.dll with MSVC. Run this from a plain cmd/PowerShell
REM window - it locates and loads the VS build environment itself, no
REM need to open a "Developer Command Prompt" first.
setlocal
set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist %VSWHERE% (
echo Could not find vswhere.exe - is Visual Studio / Build Tools installed?
exit /b 1
)
for /f "usebackq tokens=*" %%i in (`%VSWHERE% -latest -products * -property installationPath`) do (
set VSINSTALL=%%i
)
if not defined VSINSTALL (
echo Could not find any Visual Studio / Build Tools installation.
exit /b 1
)
if not exist "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" (
echo Found a VS install at "%VSINSTALL%" but it has no C++ toolset ^(vcvars64.bat missing^).
echo Install the "Desktop development with C++" workload ^(or the smaller
echo "Build Tools for Visual Studio"^) and re-run this script.
exit /b 1
)
call "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat"
if errorlevel 1 exit /b 1
cd /d "%~dp0"
cl.exe /nologo /LD /EHsc /O2 /std:c++17 ^
WarriorCPU.cpp ^
/Fe:WarriorCPU.dll
if errorlevel 1 (
echo Build failed.
exit /b 1
)
echo.
echo Built DirectML\WarriorCPU.dll
echo Copy it into your terminal's MQL5\Libraries\ folder before compiling the EA.
endlocal