2011-05-02 19:12:57 +02:00
|
|
|
@echo off
|
|
|
|
rem
|
2011-05-15 13:54:24 +02:00
|
|
|
rem This file should be put into C:\Program Files\Git\cmd\ subdirectory
|
2011-05-02 19:12:57 +02:00
|
|
|
rem (or similar, depeding on where the msysGit package was installed)
|
|
|
|
rem to provide a shell prompt in the unix-like build environment on Windows.
|
|
|
|
rem
|
|
|
|
rem Currently supported on NT-class systems only (Windows XP and above).
|
|
|
|
rem
|
|
|
|
rem See also:
|
|
|
|
rem README.txt
|
|
|
|
rem http://wiki.openpilot.org/display/Doc/GCS+Development+on+Windows
|
2011-05-03 13:43:15 +02:00
|
|
|
rem http://wiki.openpilot.org/display/Doc/Firmware+Development+on+Windows
|
2011-05-02 19:12:57 +02:00
|
|
|
rem
|
|
|
|
rem Based on the msys.bat file from the MSYS package
|
|
|
|
rem http://www.mingw.org/wiki/msys
|
|
|
|
rem
|
|
|
|
|
2013-04-04 22:57:43 +02:00
|
|
|
rem Shared directories for toolchains
|
|
|
|
rem set OPENPILOT_DL_DIR=C:/OpenPilot/downloads
|
|
|
|
rem set OPENPILOT_TOOLS_DIR=C:/OpenPilot/tools
|
|
|
|
|
2011-05-02 19:12:57 +02:00
|
|
|
rem this should let run MSYS shell on x64
|
|
|
|
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
|
|
|
|
SET COMSPEC=%WINDIR%\SysWOW64\cmd.exe
|
|
|
|
)
|
|
|
|
|
|
|
|
rem some MSYS environment variables
|
|
|
|
if "x%MSYSTEM%" == "x" set MSYSTEM=MINGW32
|
|
|
|
if not "x%DISPLAY%" == "x" set DISPLAY=
|
|
|
|
|
|
|
|
rem --------------------------------------------------------------------------
|
|
|
|
rem To build the OpenPilot software we need few tools in the PATH.
|
2011-05-03 21:45:16 +02:00
|
|
|
rem Here we attempt to guess tools location searching in the given
|
|
|
|
rem directories first, and in the PATH last, if not found where expected.
|
2011-05-03 16:19:00 +02:00
|
|
|
rem
|
2011-05-03 21:45:16 +02:00
|
|
|
rem Please note that if you have few similar tools installed somewhere but
|
|
|
|
rem not in the expected location, and they are in the PATH, then the script
|
|
|
|
rem can detect wrong directories. For instance, if you have QtSDK installed
|
|
|
|
rem on the D: drive, but have separately installed MinGW toolkit which is
|
|
|
|
rem in the PATH, then this script detects this MinGW instead of QtSDK's one.
|
|
|
|
rem As a result, the SDL headers will not be found, if they were copied into
|
|
|
|
rem QtSDK's MinGW directory. In that case make sure that you have correct
|
|
|
|
rem directories specified here.
|
|
|
|
rem
|
2011-05-28 10:45:22 +02:00
|
|
|
rem Also the SDL should be installed into Qt directories to build the GCS.
|
|
|
|
rem Check the wiki or ground/openpilotgcs/copydata.pro for details.
|
|
|
|
rem
|
2011-05-03 21:45:16 +02:00
|
|
|
rem Also you can add any paths below just by adding extra 'call :which'
|
2011-05-03 16:19:00 +02:00
|
|
|
rem lines with the following parameters:
|
2011-05-03 21:45:16 +02:00
|
|
|
rem - environment variable which will be set to the tool location, if found;
|
|
|
|
rem - expected directory for the executable which will be searched first;
|
|
|
|
rem - any executable file which will be searched in the given directory
|
|
|
|
rem or in the PATH, if not found where expected.
|
2011-05-03 16:19:00 +02:00
|
|
|
rem All they will be added to the PATH in order of appearance.
|
2011-05-02 19:12:57 +02:00
|
|
|
rem --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
set NOT_FOUND=
|
2011-05-03 16:19:00 +02:00
|
|
|
set PATH_DIRS=
|
2011-05-02 19:12:57 +02:00
|
|
|
|
2013-04-04 22:57:43 +02:00
|
|
|
rem Replace %ProgramFiles% by %ProgramFiles(x86)% for 64bit system
|
|
|
|
call :which MSYSGIT "%ProgramFiles%\Git\bin" git.exe
|
|
|
|
call :which QTMINGW "C:\QtSDK\mingw\bin" mingw32-make.exe
|
|
|
|
call :which QTSDK "C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin" qmake.exe
|
|
|
|
call :which ARMGCC "C:\OpenPilot\gcc-arm-none-eabi-4_6-2012q4\bin" arm-none-eabi-gcc.exe
|
|
|
|
call :which PYTHON "C:\Python27" python.exe
|
|
|
|
call :which UNSIS "%ProgramFiles%\NSIS\Unicode" makensis.exe
|
2011-05-02 19:12:57 +02:00
|
|
|
|
|
|
|
if "%NOT_FOUND%" == "" goto set_path
|
|
|
|
|
|
|
|
echo:
|
|
|
|
echo Some tools were not found in the PATH or expected location:
|
|
|
|
for %%f in (%NOT_FOUND%) do echo %%f
|
|
|
|
echo You may want to install them and/or update paths in the %0 file.
|
|
|
|
echo:
|
|
|
|
|
|
|
|
rem --------------------------------------------------------------------------
|
|
|
|
rem Provide a clean environment for command line build. We remove the
|
|
|
|
rem msysGit cmd subdirectory as well, so no recursive sh call can occur.
|
|
|
|
rem --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
:set_path
|
|
|
|
set PATH=%SYSTEMROOT%\system32;%SYSTEMROOT%
|
2011-05-03 16:19:00 +02:00
|
|
|
set PATH=%PATH_DIRS%;%PATH%
|
2011-05-02 19:12:57 +02:00
|
|
|
rem echo PATH: %PATH%
|
|
|
|
|
|
|
|
rem --------------------------------------------------------------------------
|
|
|
|
rem Start a shell.
|
|
|
|
rem Any shell script can be passed to it via command line of this batch file.
|
|
|
|
rem --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
if not exist "%MSYSGIT%\bash.exe" goto no_bash
|
2011-05-03 13:43:15 +02:00
|
|
|
call "%MSYSGIT%\bash.exe" --login -i %*
|
2011-05-02 19:12:57 +02:00
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:no_bash
|
|
|
|
echo Cannot find bash, exiting with error
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
rem --------------------------------------------------------------------------
|
2011-05-03 21:45:16 +02:00
|
|
|
rem Attempt to find executable in the directory given or in the PATH
|
2011-05-02 19:12:57 +02:00
|
|
|
rem --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
:which
|
2011-05-03 21:45:16 +02:00
|
|
|
rem search in the directory given first
|
2011-05-02 19:12:57 +02:00
|
|
|
for %%F in (%2) do set FP=%%~F\%3
|
|
|
|
if exist "%FP%" goto found_directly
|
|
|
|
|
2011-05-03 21:45:16 +02:00
|
|
|
rem search in the PATH last
|
|
|
|
for %%F in (%3) do set FP=%%~$PATH:F
|
|
|
|
if exist "%FP%" goto found_in_path
|
|
|
|
|
2011-05-02 19:12:57 +02:00
|
|
|
:not_found
|
|
|
|
for %%F in (%2) do set FP=%%~F
|
|
|
|
rem echo %3: not found, expected in %FP%
|
|
|
|
set FP=
|
|
|
|
set NOT_FOUND=%NOT_FOUND% %3
|
|
|
|
goto set
|
|
|
|
|
2011-05-03 21:45:16 +02:00
|
|
|
:found_directly
|
2011-05-02 19:12:57 +02:00
|
|
|
for %%F in ("%FP%") do set FP=%%~dpsF
|
2011-05-03 21:45:16 +02:00
|
|
|
rem echo %3: found at: %FP%
|
2011-05-02 19:12:57 +02:00
|
|
|
goto set
|
|
|
|
|
2011-05-03 21:45:16 +02:00
|
|
|
:found_in_path
|
2011-05-02 19:12:57 +02:00
|
|
|
for %%F in ("%FP%") do set FP=%%~dpsF
|
2011-05-03 21:45:16 +02:00
|
|
|
rem echo %3: found in the PATH: %FP%
|
2011-05-02 19:12:57 +02:00
|
|
|
|
|
|
|
:set
|
|
|
|
rem set results regardless of was it found or not
|
|
|
|
set %1=%FP%
|
|
|
|
rem echo %1=%FP%
|
2011-05-03 16:19:00 +02:00
|
|
|
if "%FP%" == "" goto :eof
|
|
|
|
if not "%PATH_DIRS%" == "" set PATH_DIRS=%PATH_DIRS%;
|
|
|
|
set PATH_DIRS=%PATH_DIRS%%FP%
|
2011-05-02 19:12:57 +02:00
|
|
|
goto :eof
|