mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
Merge remote-tracking branch 'origin/OP-305_os_Windows-build-system-fixes'
This commit is contained in:
commit
a1aab17304
@ -1,23 +1,33 @@
|
||||
This set of scripts is to provide a unix-like build environment on Windows.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Why do I need that?
|
||||
-------------------
|
||||
1. Why do I need it?
|
||||
2. How to install?
|
||||
3. How to use it?
|
||||
3.1. Interactive mode
|
||||
3.2. Batch mode
|
||||
4. Advanced usage
|
||||
5. Limitations of use
|
||||
6. Credits and license
|
||||
|
||||
|
||||
1. Why do I need it?
|
||||
--------------------
|
||||
It allows to use the "Big Hammer", that is, to build whole OpenPilot system
|
||||
with a single command "make all" using the top level Makefile originally
|
||||
written for Linux and Mac only.
|
||||
|
||||
Also any routine task automation could use the same set of scripts and
|
||||
commands on all platforms (Linux, Mac and Windows) if scripts are written in
|
||||
the shell language. It is particularly important for cross-paltform projects
|
||||
like the OpenPilot.
|
||||
Also any routine task automation could use the same set of scripts and commands
|
||||
on all platforms (Linux, Mac and Windows) if scripts are written in the shell
|
||||
language. It is particularly important for cross-paltform projects like the
|
||||
OpenPilot.
|
||||
|
||||
|
||||
How to install this?
|
||||
--------------------
|
||||
Fortunately, it requires only few small text files since all others
|
||||
components should already be installed on your system as parts of msysGit,
|
||||
QtSDK and CodeSourcery G++ packages required to build the OpenPilot.
|
||||
2. How to install?
|
||||
------------------
|
||||
Fortunately, it requires only few small text files since all others components
|
||||
should already be installed on your system as parts of msysGit, QtSDK and
|
||||
CodeSourcery G++ packages required to build the OpenPilot.
|
||||
|
||||
It is expected that you have the following tools installed into the listed
|
||||
locations (but any other locations are fine as well):
|
||||
@ -29,9 +39,8 @@ locations (but any other locations are fine as well):
|
||||
- Unicode NSIS in %ProgramFiles%\NSIS\Unicode
|
||||
|
||||
Also it is assumed that you have the C:\Program Files\Git\cmd\ directory in
|
||||
the PATH. Usually this is the case for msysGit installation if you have
|
||||
chosen the 2nd option: put only git and gitk in the PATH (it is recommended
|
||||
option).
|
||||
the PATH. Usually this is the case for msysGit installation if you have chosen
|
||||
the 2nd option: put only git and gitk in the PATH (it is recommended option).
|
||||
|
||||
Now you need to copy two files to your msysGit installation folders.
|
||||
Assuming that you installed the msysGit into C:\Program Files\Git\,
|
||||
@ -40,16 +49,17 @@ you have to copy:
|
||||
make\win32\make -> C:\Program Files\Git\bin\
|
||||
make\win32\sh.cmd -> C:\Program Files\Git\cmd\
|
||||
|
||||
If you have msysGit installed into another directory, you need to update
|
||||
paths accordingly. Also if you have tools installed into different
|
||||
directories and they are not in the PATH, then you may want to update paths
|
||||
in the sh.cmd script too (it is self-documented).
|
||||
If you have msysGit installed into another directory, you need to update paths
|
||||
accordingly. Also if you have tools installed into different directories and
|
||||
they are not in the PATH, then you may want to update paths in the sh.cmd
|
||||
script too (it is self-documented).
|
||||
|
||||
|
||||
How to use it?
|
||||
--------------
|
||||
3. How to use it?
|
||||
-----------------
|
||||
|
||||
Interactive mode:
|
||||
3.1. Interactive mode
|
||||
---------------------
|
||||
|
||||
1) Type:
|
||||
|
||||
@ -68,17 +78,17 @@ and the bash prompt should appear:
|
||||
user@pc /d/Work/OpenPilot/git (master)
|
||||
$
|
||||
|
||||
Note the current git branch in parentheses (master), if it exists.
|
||||
The path format is also printed according to MSYS notation. And you
|
||||
have to use forward slashes in paths, not backslashes.
|
||||
Note the current git branch in parentheses (master), if it exists. The path
|
||||
format is also printed according to MSYS notation. And you have to use forward
|
||||
slashes in paths, not backslashes.
|
||||
|
||||
3) Enter make command with required options and target list:
|
||||
|
||||
user@pc /d/Work/OpenPilot/git (master)
|
||||
$ make all
|
||||
|
||||
The building should be started, and you will have full system including
|
||||
ground software and flight firmware built in the end.
|
||||
The building should be started, and you will have full system including ground
|
||||
software and flight firmware built in the end.
|
||||
|
||||
4) To build parts of the system you can use, for example, such commands:
|
||||
|
||||
@ -91,7 +101,8 @@ or to completely remove the build directory:
|
||||
$ make all_clean
|
||||
|
||||
|
||||
Batch mode:
|
||||
3.2. Batch mode
|
||||
---------------
|
||||
|
||||
1) Create a shell script file containing all required commands, for instance:
|
||||
|
||||
@ -106,3 +117,76 @@ Batch mode:
|
||||
C:\> sh cc_make_release.sh
|
||||
|
||||
3) Of course, a lot of other shell commands can be used in scripts.
|
||||
|
||||
|
||||
4. Advanced usage
|
||||
-----------------
|
||||
|
||||
It is possible to go further and integrate shell scripting into Windows system
|
||||
like any other executables. This allows:
|
||||
|
||||
- double click on any .sh file in the Explorer window to execute it;
|
||||
- type name of .sh file with any arguments on the command line to run script;
|
||||
- omit .sh extension typing names since it is now recognized automatically;
|
||||
- call .sh scripts even from .bat and .cmd files as Windows command;
|
||||
- execute scripts which are in any directory in the PATH;
|
||||
- return and check exit code from .sh scripts to .bat or .cmd batch files.
|
||||
|
||||
In short, you may have quite powerful and cross-platform bash scripting on
|
||||
Windows.
|
||||
|
||||
In order to integrate bash scripting into Windows system you need to:
|
||||
|
||||
- double click on the included shell_script.reg file to register .sh
|
||||
extension in the system. Thus, any click on .sh script will execute it
|
||||
automatically assuming that the sh.cmd is in the PATH;
|
||||
- register .sh extension as an executable file type, so you can omit the
|
||||
.sh typing commands. To do so open "My Computer" properties dialog, choose
|
||||
the "Advanced" tab, "Environment variables", in the "System variables"
|
||||
find the variable called "PATHEXT". It contains the list of "executable"
|
||||
file extensions separated by semicolon. You want to add a ";.SH" to the
|
||||
end of its value. Then click OK to apply.
|
||||
|
||||
Now any .sh script can be run just by typing its name, optionally with
|
||||
parameters.
|
||||
|
||||
As an example, you can create a shell script named make.sh in the cmd/
|
||||
subdirectory of Git installation with the following content:
|
||||
|
||||
exec /bin/make $*
|
||||
|
||||
and then build the OpenPilot software typing
|
||||
|
||||
make all
|
||||
|
||||
directly from Windows command line or from a batch file.
|
||||
|
||||
You also may want to rename or remove "C:\Program Files\Git\etc\motd" file
|
||||
to get rid of git bash welcome message on every script invocation.
|
||||
|
||||
|
||||
5. Limitations of use
|
||||
---------------------
|
||||
|
||||
Currently there may be some problems running scripts which contain spaces in
|
||||
file names or located in directories which contain spaces in full paths.
|
||||
It results in in strange "file not found" or other errors.
|
||||
|
||||
It is recommended to avoid using such names with spaces.
|
||||
|
||||
|
||||
6. Credits and license
|
||||
----------------------
|
||||
|
||||
This set of scripts uses the MSYS package included into the msysGit
|
||||
distribution and MinGW make included into the QtSDK package.
|
||||
|
||||
The sh.cmd, shell_script.reg and this README.txt files were written
|
||||
by Oleg Semyonov (os-openpilot-org@os-propo.info) for the OpenPilot
|
||||
project and are licensed under CC-BY-SA terms:
|
||||
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
Feel free to contact me for additions and improvements.
|
||||
|
||||
Happy bashing!
|
||||
|
@ -7,6 +7,7 @@
|
||||
# See also:
|
||||
# README.txt
|
||||
# http://wiki.openpilot.org/display/Doc/GCS+Development+on+Windows
|
||||
# http://wiki.openpilot.org/display/Doc/Firmware+Development+on+Windows
|
||||
#
|
||||
|
||||
mingw32-make.exe $*
|
||||
|
@ -9,6 +9,7 @@ rem
|
||||
rem See also:
|
||||
rem README.txt
|
||||
rem http://wiki.openpilot.org/display/Doc/GCS+Development+on+Windows
|
||||
rem http://wiki.openpilot.org/display/Doc/Firmware+Development+on+Windows
|
||||
rem
|
||||
rem Based on the msys.bat file from the MSYS package
|
||||
rem http://www.mingw.org/wiki/msys
|
||||
@ -28,15 +29,23 @@ rem To build the OpenPilot software we need few tools in the PATH.
|
||||
rem Here we attempt to guess tools location using PATH or set them
|
||||
rem directly using hard-coded locations, if not found in PATH.
|
||||
rem You may want to update paths according to your installation.
|
||||
rem
|
||||
rem Also you can add any paths below just by adding extra call :which
|
||||
rem lines with the following parameters:
|
||||
rem - environment variable which will be set to the path found (or empty)
|
||||
rem - expected directory which will be tried if not found in the current PATH
|
||||
rem - any executable file which is expected to be found in PATH or directory
|
||||
rem All they will be added to the PATH in order of appearance.
|
||||
rem --------------------------------------------------------------------------
|
||||
|
||||
set NOT_FOUND=
|
||||
set PATH_DIRS=
|
||||
|
||||
call :which PYTHON "C:\Python27" python.exe
|
||||
call :which CODESOURCERY "C:\CodeSourcery\bin" cs-make.exe
|
||||
call :which QTSDK "C:\Qt\2010.05\qt\bin" qmake.exe
|
||||
call :which QTMINGW "C:\Qt\2010.05\mingw\bin" mingw32-make.exe
|
||||
call :which MSYSGIT "%ProgramFiles%\Git\bin" git.exe
|
||||
call :which QTMINGW "C:\Qt\2010.05\mingw\bin" mingw32-make.exe
|
||||
call :which QTSDK "C:\Qt\2010.05\qt\bin" qmake.exe
|
||||
call :which CODESOURCERY "C:\CodeSourcery\bin" cs-make.exe
|
||||
call :which PYTHON "C:\Python27" python.exe
|
||||
call :which UNSIS "%ProgramFiles%\NSIS\Unicode" makensis.exe
|
||||
|
||||
if "%NOT_FOUND%" == "" goto set_path
|
||||
@ -54,7 +63,7 @@ rem --------------------------------------------------------------------------
|
||||
|
||||
:set_path
|
||||
set PATH=%SYSTEMROOT%\system32;%SYSTEMROOT%
|
||||
set PATH=%MSYSGIT%;%QTMINGW%;%QTSDK%;%CODESOURCERY%;%PYTHON%;%UNSIS%;%PATH%
|
||||
set PATH=%PATH_DIRS%;%PATH%
|
||||
rem echo PATH: %PATH%
|
||||
|
||||
rem --------------------------------------------------------------------------
|
||||
@ -63,7 +72,7 @@ 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
|
||||
call %COMSPEC% /c "%MSYSGIT%\bash" --login -i %*
|
||||
call "%MSYSGIT%\bash.exe" --login -i %*
|
||||
goto :eof
|
||||
|
||||
:no_bash
|
||||
@ -103,4 +112,7 @@ rem echo %3: found at: %FP%
|
||||
rem set results regardless of was it found or not
|
||||
set %1=%FP%
|
||||
rem echo %1=%FP%
|
||||
if "%FP%" == "" goto :eof
|
||||
if not "%PATH_DIRS%" == "" set PATH_DIRS=%PATH_DIRS%;
|
||||
set PATH_DIRS=%PATH_DIRS%%FP%
|
||||
goto :eof
|
||||
|
19
make/win32/shell_script.reg
Normal file
19
make/win32/shell_script.reg
Normal file
@ -0,0 +1,19 @@
|
||||
REGEDIT4
|
||||
|
||||
[HKEY_CLASSES_ROOT\.sh]
|
||||
@="shfile"
|
||||
|
||||
[HKEY_CLASSES_ROOT\shfile]
|
||||
@="shell script"
|
||||
"AlwaysShowExt"=""
|
||||
"BrowserFlags"=dword:00000008
|
||||
"EditFlags"=dword:00000000
|
||||
|
||||
[HKEY_CLASSES_ROOT\shfile\shell]
|
||||
@=""
|
||||
|
||||
[HKEY_CLASSES_ROOT\shfile\shell\open]
|
||||
|
||||
[HKEY_CLASSES_ROOT\shfile\shell\open\command]
|
||||
@="cmd.exe /c call sh \"%1\" %*"
|
||||
|
Loading…
x
Reference in New Issue
Block a user