diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-01-18 09:44:34 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-01-18 09:44:34 +0100 |
commit | bd814eafac20a5264782bad69ce2df1599921c68 (patch) | |
tree | 7b2f14fec5457d1fdc1ed4a0d7236d6f09525dca /docs/part-1/4-4_build-first-app-ide.md | |
parent | 2a297d08d6b686abe9ab8404a15aa892f4832e25 (diff) |
Split markdown files to have a detailed TOC/summary.
Change-Id: I7d578335ba0d1719030bc2efc6518da17a6150dc
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'docs/part-1/4-4_build-first-app-ide.md')
-rw-r--r-- | docs/part-1/4-4_build-first-app-ide.md | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/docs/part-1/4-4_build-first-app-ide.md b/docs/part-1/4-4_build-first-app-ide.md new file mode 100644 index 0000000..c3c0cda --- /dev/null +++ b/docs/part-1/4-4_build-first-app-ide.md @@ -0,0 +1,187 @@ +# Build using a source code editor / IDE + +First create an XDS config file or reuse the previous one, for example we use +here aarch64 SDK to cross build application for a Renesas Gen3 board. + +```bash +# create file at root directory of your project +# for example: +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cat > $MY_PROJECT_DIR/xds-project.conf << EOF + export XDS_AGENT_URL=localhost:8800 + export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b + export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +EOF +``` + +## NetBeans + +This chapter will show you how to create 2 configurations, one to compile your +project natively (using native GNU gcc) and one to cross-compile your project +using XDS. + +You can easily switch from one to other configuration using menu +**Run -> Set Project Configuration**. + +__Netbeans 8.x :__ + +- Open menu **Tools** -> **Options** + - Open **C/C++** tab, in **Build Tools** sub-tab, click on **Add** button: + + ![Add new tool panel](./pictures/nb_newtool.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Finally click on **OK** button. + +- Now create we first declare project into NetBeans and create first a native + configuration. To do that, open menu **File** -> **New Project** + +- Select **C/C++ Project with Existing Sources** ; + Click on **Next** button + +- Specify your project directory and set **Select Configuration Mode** to + **Custom**. Keep **Tool Collection** to **Default GNU** in order to create a + *native configuration* based on native GNU GCC. Finally click on **Next** button. + + ![Select Model panel](./pictures/nb_new-project-1.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + +- Just update **Run in Folder** field and add `build_native` suffix so that + resulting build files will be located into `build_native` sub-directory. + Keep all others settings to default value and click on **Next** button. + + ![Select Model panel](./pictures/nb_new-project-2.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + +- Click several times on **Next button** (always keep default settings) and + click on **Finish** button to complete creation of native configuration. + +- Now we will create a **cross configuration** based on XDS tools. + Edit project properties (using menu **File** -> **Project Properties**) to add a new configuration that will use XDS to cross-compile your application for example for a Renesas Gen3 board. + + - in **Build** category, click on **Manage Configurations** button and then **New** button to add a new configuration named for example "Gen3 board" + + ![Select Build category](./pictures/nb_new-project-3.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Click on **Set Active** button + + - Select **Pre-Build** sub-category, and set: + - Working Directory: `build_gen3` + - Command Line: `xds-cli exec -c ../xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ..` + - Pre-build First: `ticked` + + - Select **Make** sub-category, and set: + - Working Directory: `build_gen3` + - Build Command: `xds-cli exec -c ../xds-project.conf -- make remote-target-populate` + - Clean Command: `xds-cli exec -c ../xds-project.conf -- make clean` + + ![Select Make sub-category](./pictures/nb_new-project-4.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Select **Run** sub-category, and set: + - Run Command: `target/start-on-root@renesas-gen3.sh` + - Run Directory: `build-gen3` + + ![Select Run sub-category](./pictures/nb_new-project-5.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Click on **OK** button to save settings + +By changing configuration from **Default** to **Gen3 board**, you can now simply +compile your helloworld application natively (**Default** configuration) or +cross-compile your application through XDS for the Renesas Gen3 board +(**Gen3 board** configuration). + +## Visual Studio Code + +Open your project in VS Code + +```bash +cd $MY_PROJECT_DIR +code . & +``` + +Add new tasks : press `Ctrl+Shift+P` and select the `Tasks: Configure Task` +command and you will see a list of task runner templates. + +And define your own tasks, here is an example to build +[helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) +AGL helloworld application based on cmake template. + +```json +{ + "version": "2.0.0", + "type": "shell", + "presentation": { + "reveal": "always" + }, + "tasks": [ + { + "taskName": "clean", + "command": "/bin/rm -rf ${workspaceFolder}/build/* && mkdir -p build && echo Cleanup done.", + "problemMatcher": [] + }, + { + "taskName": "pre-build", + "group": "build", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ../", + "problemMatcher": [ + "$gcc" + ] + }, + { + "taskName": "build", + "group": "build", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget", + "problemMatcher": [ + "$gcc" + ] + }, + { + "taskName": "populate", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget-target-install", + "problemMatcher": [] + } + ] +} +``` + +> **Note:** +> +> You can also add your own keybindings to trig above tasks, for example: +> +> ```json +> // Build +> { +> "key": "alt+f9", +> "command": "workbench.action.tasks.runTask", +> "args": "clean" +> }, +> { +> "key": "alt+f10", +> "command": "workbench.action.tasks.runTask", +> "args": "pre-build" +> }, +> { +> "key": "alt+f11", +> "command": "workbench.action.tasks.runTask", +> "args": "build" +> }, +> { +> "key": "alt+f12", +> "command": "workbench.action.tasks.runTask", +> "args": "populate" +> }, +> ``` +> +> More details about VSC keybindings [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks) +> +> More details about VSC tasks [here](https://code.visualstudio.com/docs/editor/tasks) + +## Qt Creator + +Please refer to [agl-hello-qml](https://github.com/radiosound-com/agl-hello-qml#clone--build-project) project. +Thanks to Dennis for providing this useful example. + +## Others IDE + +*Coming soon...* |