James E. King, III | 4d651ab | 2017-02-19 22:19:55 -0500 | [diff] [blame] | 1 | :: |
| 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 | |
| 29 | IF DEFINED ARCH ( |
| 30 | ECHO [warn ] using existing environment variable ARCH |
| 31 | EXIT /B 0 |
| 32 | ) |
| 33 | |
| 34 | CALL :CHECK x64 |
| 35 | IF %ERRORLEVEL% == 0 (SET ARCH=x64) ELSE (SET ARCH=win32) |
| 36 | |
| 37 | IF NOT DEFINED ARCH ( |
| 38 | ECHO [error] unable to determine the target architecture |
| 39 | EXIT /B 1 |
| 40 | ) |
| 41 | |
| 42 | ECHO [info ] detected target architecture %ARCH% |
| 43 | EXIT /B 0 |
| 44 | |
| 45 | :CHECK |
| 46 | cl /? 2>&1 | findstr /C:" for %1%" > nul |
| 47 | EXIT /B %ERRORLEVEL% |