prepare_build.bat (1980B)
1 REM Copyright 2022 The Chromium Authors. 2 REM Use of this source code is governed by a BSD-style license that can be 3 REM found in the LICENSE file. 4 @echo off 5 setlocal 6 7 REM This script is meant to be run once to setup the example demo agent. 8 REM Run it with one command line argument: the path to a directory where the 9 REM demo agent will be built. This should be a directory outside the SDK 10 REM directory tree. By default, if no directory is supplied, a directory 11 REM named `build` in the project root will be used. 12 REM 13 REM Once the build is prepared, the demo binary is built using the command 14 REM `cmake --build <build-dir>`, where <build-dir> is the same argument given 15 REM to this script. 16 17 set ROOT_DIR=%~dp0 18 call :ABSPATH "%ROOT_DIR%\demo" DEMO_DIR 19 call :ABSPATH "%ROOT_DIR%\proto" PROTO_DIR 20 21 REM BUILD_DIR defaults to $ROOT_DIR/build if no argument is provided. 22 IF "%1" == "" ( 23 call :ABSPATH "%ROOT_DIR%\build" BUILD_DIR 24 ) ELSE ( 25 set BUILD_DIR=%~f1 26 ) 27 28 echo . 29 echo Root dir: %ROOT_DIR% 30 echo Build dir: %BUILD_DIR% 31 echo Demo dir: %DEMO_DIR% 32 echo Proto dir: %PROTO_DIR% 33 echo . 34 35 REM Prepare build directory 36 mkdir "%BUILD_DIR%" 37 REM Prepare protobuf out directory 38 mkdir "%BUILD_DIR%\gen" 39 REM Enter build directory 40 cd /d "%BUILD_DIR%" 41 42 REM Install vcpkg and use it to install Google Protocol Buffers. 43 IF NOT exist .\vcpkg\ ( 44 cmd/c git clone https://github.com/microsoft/vcpkg 45 cmd/c .\vcpkg\bootstrap-vcpkg.bat -disableMetrics 46 ) ELSE ( 47 echo vcpkg is already installed. 48 ) 49 REM Install any packages we want from vcpkg. 50 cmd/c .\vcpkg\vcpkg install protobuf:x64-windows 51 cmd/c .\vcpkg\vcpkg install gtest:x64-windows 52 53 REM Generate the build files. 54 set CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake 55 cmake %ROOT_DIR% 56 57 echo. 58 echo. 59 echo To build, type: cmake --build "%BUILD_DIR%" 60 echo. 61 62 exit /b 63 64 REM Resolve relative path in %1 and set it into variable %2. 65 :ABSPATH 66 set %2=%~f1 67 exit /b