diff --git a/windows/droneapiWinBuild.bat b/windows/droneapiWinBuild.bat new file mode 100644 index 000000000..dc680a230 --- /dev/null +++ b/windows/droneapiWinBuild.bat @@ -0,0 +1,16 @@ +rem build the standalone Dronekit.exe for Windows. +rem This assumes Python is installed in C:\Python27 +SETLOCAL enableextensions + +rem get the version +for /f "tokens=*" %%a in ( + 'python returnVersion.py' + ) do ( + set VERSION=%%a + ) + + +rem -----Build the Installer----- +"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /dMyAppVersion=%VERSION% -compile droneapi_installer.iss + +pause diff --git a/windows/droneapi_installer.iss b/windows/droneapi_installer.iss new file mode 100644 index 000000000..dc347aa17 --- /dev/null +++ b/windows/droneapi_installer.iss @@ -0,0 +1,104 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "DroneKit" +; #define MyAppVersion "1" +#define MyAppPublisher "3D Robotics, Inc" +#define MyAppURL "https://github.com/diydrones/dronekit-python" +#define MyAppExeName "" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. +; Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{35EE5962-C212-4874-90EC-50863DD1537D} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +CreateAppDir=no +OutputBaseFilename=DroneKitsetup-{#MyAppVersion} +Compression=lzma +SolidCompression=yes +LicenseFile=..\LICENSE +DisableDirPage=yes + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Files] +Source: "..\droneapi\*"; DestDir: "{code:GetMAVProxyPath}\droneapi"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "..\examples\*"; DestDir: "{code:GetMAVProxyPath}\examples"; Flags: ignoreversion recursesubdirs createallsubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +; Check if MAVProxy is installed (if so, get the install path) +[Code] +function IsMAVProxyInstalled: boolean; +begin + result := RegKeyExists(HKEY_LOCAL_MACHINE, + 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{D81B9EDA-1357-462E-96E4-B47372709F7C}_is1'); +end; + +function GetMAVProxyPath(Dummy: string): string; +var + sInstallPath: string; + MAVProxyPath: string; +begin + MAVProxyPath := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{D81B9EDA-1357-462E-96E4-B47372709F7C}_is1' + sInstallPath := ''; + RegQueryStringValue(HKLM, MAVProxyPath, 'InstallLocation', sInstallPath); + Result := sInstallPath; +end; + +function InitializeSetup: boolean; +begin + result := IsMAVProxyInstalled; + if not result then + MsgBox('You need to install MAVProxy before you install DroneKit. Install MAVProxy and then run this installer again.', mbError, MB_OK); +end; + +function MAVDir_CreatePage(PreviousPageId: Integer): Integer; +var + Page: TWizardPage; + Label1: TLabel; + MAVDir: TEdit; +begin + Page := CreateCustomPage( + PreviousPageId, + 'Installation Directory', + '' + ); + + Label1 := TLabel.Create(Page); + with Label1 do + begin + Parent := Page.Surface; + Caption := 'DroneKit will be installed in the MAVProxy directory:' + Left := ScaleX(16); + Top := ScaleY(0); + Width := ScaleX(300); + Height := ScaleY(17); + end; + + MAVDir := TEdit.Create(Page); + with MAVDir do + begin + Parent := Page.Surface; + Left := ScaleX(16); + Top := ScaleY(24); + Width := ScaleX(300); + Height := ScaleY(25); + TabOrder := 0; + Text := GetMAVProxyPath(''); + Enabled := False; + end + +end; + +procedure InitializeWizard(); +begin + MAVDir_CreatePage(wpLicense); +end; \ No newline at end of file diff --git a/windows/returnVersion.py b/windows/returnVersion.py new file mode 100644 index 000000000..a15976f88 --- /dev/null +++ b/windows/returnVersion.py @@ -0,0 +1,12 @@ +# This script reads the setup.py and returns the current version number +# Used as part of building the WIndows setup file (DronekitWinBuild.bat) +# It assumes there is a line like this: +# version = "12344" + +# glob supports Unix style pathname extensions +with open("../setup.py") as f: + searchlines = f.readlines() + for i, line in enumerate(searchlines): + if "version = " in line: + print line[11:len(line)-2] + break \ No newline at end of file