blob: 9570a1e856c4cd1319fa64ce73e6887714ecb804 [file] [log] [blame]
James E. King, III4d651ab2017-02-19 22:19:55 -05001::
2:: Licensed under the Apache License, Version 2.0 (the "License");
3:: you may not use this file except in compliance with the License.
4:: You may obtain a copy of the License at
5::
6:: http://www.apache.org/licenses/LICENSE-2.0
7::
8:: Unless required by applicable law or agreed to in writing, software
9:: distributed under the License is distributed on an "AS IS" BASIS,
10:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11:: See the License for the specific language governing permissions and
12:: limitations under the License.
13::
14
15::
16:: Detect the architecture we're building for.
17:: Set the ARCH environment variable to one of:
18:: win32
19:: x64
20::
21:: Honors any existing ARCH environment variable
22:: setting instead of overwriting it, to allow it
23:: to be forced if needed.
24::
25:: Sets ERRORLEVEL to 0 if ARCH can be determined,
26:: to 1 if it cannot.
27::
28
29IF DEFINED ARCH (
30 ECHO [warn ] using existing environment variable ARCH
31 EXIT /B 0
32)
33
34CALL :CHECK x64
35IF %ERRORLEVEL% == 0 (SET ARCH=x64) ELSE (SET ARCH=win32)
36
37IF NOT DEFINED ARCH (
38 ECHO [error] unable to determine the target architecture
39 EXIT /B 1
40)
41
42ECHO [info ] detected target architecture %ARCH%
43EXIT /B 0
44
45:CHECK
46cl /? 2>&1 | findstr /C:" for %1%" > nul
47EXIT /B %ERRORLEVEL%