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