xref: /5.5.2/tlm/win32/environment.bat (revision 7a2df266)
1@echo off
2
3if defined tools_version goto tools_set
4if exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0" (
5  set tools_version=14.0
6) else (
7  set tools_version=12.0
8)
9
10:tools_set
11if "%tools_version%" == "15.0" (
12  set "tools_dir=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build"
13) else (
14  set "tools_dir=C:\Program Files (x86)\Microsoft Visual Studio %tools_version%\VC"
15)
16echo Using tools from %tools_dir%
17if not defined source_root goto default_source_root
18
19:target_arch
20if not defined target_arch goto default_target_arch
21
22:setup_arch
23if /i "%target_arch%" == "amd64" goto setup_amd64
24if /i "%target_arch%" == "x86" goto setup_x86
25
26echo Unknown architecture: %target_arch%. Must be amd64 or x86
27set ERRORLEVEL=1
28goto eof
29
30:default_source_root
31set source_root=%CD%
32echo source_root not set. It was automatically set to the current directory %source_root%.
33goto target_arch
34
35:default_target_arch
36set target_arch=amd64
37echo target_arch is not set. It was automatically set to %target_arch%.
38goto setup_arch
39
40:setup_x86
41echo Setting up Visual Studio environment for x86
42call "%tools_dir%\vcvarsall.bat" x86
43goto setup_environment
44
45:setup_amd64
46echo Setting up Visual Studio environment for amd64
47call "%tools_dir%\vcvarsall.bat" amd64
48goto setup_environment
49
50:setup_environment
51rem Unfortunately we need to have all of the directories
52rem we build dll's in in the path in order to run make
53rem test in a module..
54
55echo Setting compile environment for building Couchbase server
56set OBJDIR=\build
57set MODULEPATH=%SOURCE_ROOT%%OBJDIR%\platform
58set MODULEPATH=%MODULEPATH%;%SOURCE_ROOT%%OBJDIR%\platform\extmeta
59set MODULEPATH=%MODULEPATH%;%SOURCE_ROOT%%OBJDIR%\platform\cbcompress
60set MODULEPATH=%MODULEPATH%;%SOURCE_ROOT%%OBJDIR%\platform\cbsocket
61set MODULEPATH=%MODULEPATH%;%SOURCE_ROOT%%OBJDIR%\phosphor
62
63set MODULEPATH=%MODULEPATH%;%SOURCE_ROOT%%OBJDIR%\memcached
64set MODULEPATH=%MODULEPATH%;%SOURCE_ROOT%%OBJDIR%\couchstore
65set MODULEPATH=%MODULEPATH%;%SOURCE_ROOT%%OBJDIR%\sigar\build-src
66set PATH=%MODULEPATH%;%PATH%;%SOURCE_ROOT%\install\bin
67set OBJDIR=
68SET MODULEPATH=
69cd %SOURCE_ROOT%
70if "%target_arch%" == "amd64" set PATH=%PATH%;%SOURCE_ROOT%\install\x86\bin
71goto eof
72
73:missing_root
74echo source_root should be set in the source root
75set ERRORLEVEL=1
76goto eof
77
78:missing_target_arch
79echo target_arch must be set in environment to x86 or amd64
80set ERRORLEVEL=1
81goto eof
82
83:eof
84