This section helps you set up the environment and build an application using Visual Studio Code.
Prerequisites
- Visual Studio Code
- CMake Tools, or tools from Command-line Prerequisites or Docker Prerequisites
Setup
- Clone the Generic Node Sensor Edition GitHub project as mentioned before and checkout the
develop
branch:
git checkout develop
- Select the Open Folder button in Visual Studio Code and navigate to the location of the cloned Generic Node Sensor Edition project.
Build examples
Visual Studio Code provides multiple methods to build an application. This section contains some commonly used ones.
Using CMake and VSCode CMake tools
After installing CMake Tools, you can add the following CMake configuration to the settings.json
file, that is located in the .vscode
folder, in order to build the basic
application.
{
"cmake.generator":"Ninja",
"cmake.configureSettings": {
"TARGET_APP":"basic",
"CMAKE_BUILD_TYPE":"Debug",
"CMAKE_TOOLCHAIN_FILE":"${workspaceFolder}/Software/cross.cmake"
},
"cmake.sourceDirectory": "${workspaceFolder}/Software",
"cmake.buildDirectory":"${workspaceFolder}/Software/build",
}
You can adjust CMake settings according to your environment.
For example, on Windows, you can adjust the generator to MinGW Makefiles
instead of Ninja
:
"cmake.generator":"MinGW Makefiles",
You can also adjust the TARGET_APP
to basic_lorawan
or any other application:
"TARGET_APP":"basic_lorawan",
After adjusting your CMake configuration, make sure TOOLCHAIN_PREFIX
is configured in the generic-node-se/Software/cross.cmake
. See Command-line section for examples.
Finally, you can invoke Cmake: Configure
from VSCode Command Palette, followed by Cmake: Build
.
Using CMake and VSCode Terminal
The Command-line build commands can be used with the Visual Studio Code Integrated Terminal.
Using Docker
The Docker build commands can be used with Visual Studio Code Docker container plugins.