... | ... | @@ -8,7 +8,7 @@ This is a guide to help you get up and running locally. Since VS Code is the mos |
|
|
# Setup the project
|
|
|
Let us suppose you want to do some changes inside of the `lhw_qi` subsystem (if you're interested in any other subsystem, just replace `lhw_qi` with it from now on). Start by cloning down the project repository to your local PC somewhere, `git clone git@gitlab.liu.se:liuhomewreckers/liu-home-wreckers.git`. Now follow the steps found [here](./Docker) to get the container images setup. You'll only have to build for `lhw` and `lhw_qi`.
|
|
|
|
|
|
To check whether everything works as it should, you can enter the container with `docker compose run --rm lhw_qi zsh` and then execute `colcon build`. It should take about 4 minutes to complete the compilation. At this point we can start making changes to the source code!
|
|
|
To check whether everything works as it should, you can enter the container with `docker compose run --rm lhw_qi zsh` and then execute `colcon build`. It should take about 4 minutes to complete the compilation. At this point we can start making changes to the source code! Beware though that everytime you rebuild the container you'll loose the
|
|
|
|
|
|
# Making changes
|
|
|
...
|
... | ... | @@ -17,7 +17,7 @@ To check whether everything works as it should, you can enter the container with |
|
|
VS Code has an extension that allows you to run language servers inside of containers, meaning you can reap the benefits of the packages a container has, without having to download them to your computer. Once again I'll explain this as if you'd want to develop for `lhw_qi`, and once again you can just replace `lhw_qi`with your wanted subsystem.
|
|
|
|
|
|
1. Install the [dev containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.
|
|
|
2. Create a `.devcontainer` folder within the subsystem folder (e.g. `mkdir ./liu-home-wreckers/src/lhw_qi/.devcontainer`.
|
|
|
2. Create a `.devcontainer` folder within the subsystem folder (e.g. `mkdir ./liu-home-wreckers/src/lhw_qi/.devcontainer`).
|
|
|
3. Within the newly created folder, add these two files:
|
|
|
|
|
|
./liu-home-wreckers/src/lhw_qi/.devcontainer/devcontainer.json
|
... | ... | @@ -60,4 +60,30 @@ services: |
|
|
command: /bin/sh -c "while sleep 1000; do :; done"%
|
|
|
```
|
|
|
|
|
|
Just another docker-compose file. You should be able to use the one in project root, but I haven't managed it yet. This works though, so this stands for now. Beware that the image probably shouldn't have `listener` at the end but `latest` if you aren't developing for `lhw_qi`. |
|
|
\ No newline at end of file |
|
|
Just another docker-compose file. You should be able to use the one in project root, but I haven't managed it yet. This works though, so this stands for now. Beware that the image probably shouldn't have `listener` at the end but `latest` if you aren't developing for `lhw_qi`.
|
|
|
|
|
|
4. Now you can run the following command `Dev Containers: Open Folder in Container...` and choose the `./liu-home-wreckers/src/lhw_qi/` folder. Once the dev container has started up you should see at the bottom left of vscode that it says `Dev Container` in the blue box.
|
|
|
|
|
|
5. Easiest way to get (almost) all the right includes so that auto-completion actually works is with a [compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html) file. Add the following line into the subsystems `CMakeLists.txt` file: `set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)`. This tells cmake to export the file when you run `colcon build`, so now run that. When the compilation is done you should have the file `/workspace/liu-home-wreckers/build/compile_commands.json`. Run the following command: `C/C++: Edit configurations (JSON)` and add this line under configurations: `"compileCommands": "/workspace/liu-home-wreckers/build/compile_commands.json"`. The file should look like below:
|
|
|
|
|
|
.vscode/c_cpp_properties.json
|
|
|
```
|
|
|
{
|
|
|
"configurations": [
|
|
|
{
|
|
|
"name": "Linux",
|
|
|
"includePath": [
|
|
|
"${workspaceFolder}/**",
|
|
|
"/include/**"
|
|
|
],
|
|
|
"defines": [],
|
|
|
"compilerPath": "/usr/bin/gcc",
|
|
|
"cStandard": "c17",
|
|
|
"cppStandard": "gnu++14",
|
|
|
"intelliSenseMode": "linux-gcc-x64",
|
|
|
"compileCommands": "/workspace/liu-home-wreckers/build/compile_commands.json"
|
|
|
}
|
|
|
],
|
|
|
"version": 4
|
|
|
}
|
|
|
``` |
|
|
\ No newline at end of file |