====== Building the Digilent Agent From Source ======
This page describes the process of building the Digilent Agent from source.
**//Note: This process is recommended for advanced users only and most users should install one of the existing builds [[software:digilent-agent:start| available here]]. //**
===== Windows =====
----
* Install [[https://www.qt.io/download/ | QT Creator 5.7]] or newer.
* Install [[http://download.qt.io/official_releases/qt-installer-framework/ | QT Installer Framework 2.03]] or newer.
* Ensure the QT and QT installer framework binaries are on the system path:
* C:\Qt\5.11.1\mingw53_32\bin
* C:\Qt\QtIFW-3.0.4\bin
* Clone the [[https://github.com/Digilent/digilent-agent | Digilent Agent]] repository.
* Initialize and update git submodules
* git submodule init
* git submodule update
* Launch the QT project 'digilent-agent.pro'.
* Press **Ctrl+R** to build or **F5** to build in debug mode.
=== Installer ===
* Hard link the debug and release build outputs into the project **root directory**. Ex:
* New-Item -ItemType Junction -Name debug -Value ..\build-digilent-agent-Desktop_Qt_5_11_1_MinGW_32bit-Debug\debug\
* New-Item -ItemType Junction -Name release -Value ..\build-digilent-agent-Desktop_Qt_5_11_1_MinGW_32bit-Release\release\
* Set the version number in **agent.cpp**.
* Use QT to build a release build in the **release** folder at the project root.
* Set the version number in **installer/config/winConfig.xml**.
* TODO - REMOVE - Set the version number in **installer/packages/com.digilent.agent/meta/winConfig.xml**.
* Use CygWin to enter the **installer** directory at the project root.
* Run the build script with the following command
* ./build.sh win
\\ ex. ./build win 1.0.0 release
* The installer will be created in the **installer** directory at the project root.
===== Linux =====
----
* (Optional - provides GUI IDE and debugging) Install [[https://www.qt.io/download/ | QT Creator 5.7]] or newer.
* Update the package feeds. sudo apt-get update
\\
* Install QT5 sudo apt-get install qt5-default
\\
* Install QT5 serial port supportsudo apt-get install libqt5serialport5-dev
\\
* Clone the Digilent Agent repository git clone https://github.com/Digilent/digilent-agent.git
\\
* Enter the repo directory cd digilent-agent
\\
* Initialize and update the submodules (Digilent qtSerial and pgm)
git submodule init
git submodule update
\\
* Run qmake qmake
\\
* Build the Digilent Agent make
\\
* Run the Digilent Agent (Read/Write permission for UART devices is required) ./digilent-agent
\\
===.deb ===
* Build release using qmake and make as described above.
* This step is to confirm everything is setup correctly and can technically be omitted as the deb build script will rebuild everything form source.
* Open a terminal in the **installer** directory at the project root.
* Run the build script with the following command
* ./build deb
\\ ex. ./build deb 1.0.0
* Follow the instructions in the terminal.
* The .deb will be created in the **installer** directory at the project root.
===== Mac =====
Install [[https://www.qt.io/download/ | QT Creator 5.7]] or newer.
* Clone the [[https://github.com/Digilent/digilent-agent | Digilent Agent]] repository.
* Initialize and update git submodules
* git submodule init
* git submodule update
* Build from command line
* Run: qmake
* make
* **Or** build from QT Creator:
* Press **Ctrl+R** to build or **F5** to build in debug mode.
* Build Signed .dgm
* Enter the **installer** sub directory. cd installer
* Run the build script to package dependencies, sign the .app and build the .dmg ./build.sh osx release
* Where is the release version (ex. 1.0.1).
**Or**
Generate an Xcode Project:
qmake -spec macx-xcode digilent-agent.pro
* Add images/icon.iconset to digilent-agent/Resources in Xcode
//Note: If the **digilent-agent.entitlements** is red in Xcode you may have to delete the file and use Xcode to manually create an **Poperty List** file named digilent-agent.entitlements in the project root. //
=== Build a new .dmg ===
* Build a release version of the Digilent Agent using QT.
* Use [[http://doc.qt.io/qt-5/osx-deployment.html | macdeployqt]] to build a distributable .app. \\ macdeployqt Digilent\ Agent.app/ -codesign= -always-overwrite
* Use **Disk Utility** to create a new disk image.
* Name the image digilent-agent-.dmg where is of the form #.#.# (ex. 1.0.3)
* Set the image size to be just large enough to hold the Agent and WaveForms Live offline support (~20 MB). The size cannot be changed later.
* Set the Image Format to read/write disk image.
* Mount and open the disk image.
* Click **View>>as Icons** to ensure the disk image contents is viewed as icons.
* Copy and paste the **.app** file from the QT release build folder into the mounted disk image.
* Create a shortcut to the **Apps** directory in the mounted disk image.
* Copy and paste the **WaveForms-Live** offline support into the mounted disk image.
* Create a shortcut to the **share** directory in the mounted disk image.
* (Optional) add a background image.
* Copy and paste an image file into the mounted disk image.
* With the mounted disk image active select **View>>Show View Options**.
* Under the **Background:** section click **Picture**
* Drag the image from the mounted disk image to the picture box.
* Use the terminal to hide the image file (change the name to start with a '.'). \\ cd /Volumes/
mv .
* Unmount the disk image.
* Use Disk Utility to convert the disk image into a read-only copy.
* **Images>>Convert**
* Select the disk image and click **Open**.
* Set the **Image Format** to **read-only**.
* Click **Save**.
* Distribute the read-only copy of the disk image.
* Keep the read-write copy of the disk image to simplify future updates.
{{tag>digilent-agent tutorial build}}