Setup
Tired of working in a laggy VM ? Here are some instructions to avoid the VM, on Linux and Windows via WSL2. Understanding and configuring this setup takes a bit of time, download itself is pretty short (under 5min) and you can continue reading when waiting.
If you are on Windows and don't know WSL yet, I recommend my Fedora WSL setup tutorial.
Note: this is inspired by the provided linux-instructions.pdf, thanks for this documentation, this a continuation for a better experience and broader support.
Get starting code for labs - retrieve_lab alternative
If you are not using the VM, when you see a command like retrieve_lab pco24 lab01 at the start of a lab you can't access this script. This is why you can use a reimplementation called labget, that can be used exactly the sam way: retrieve_lab pco24 lab01 -> labget pco24 lab01. This reimplementation also has better errors in case the branch or course name doesn't exist :)
To install it: lxup get labget Help: I don't have lxup !
Example
> labget pco24 lab01
Clone depuis https://reds-gitlab.heig-vd.ch/reds-public/pco24_student.git
Cloning into 'pco24_lab01'...
remote: Enumerating objects: 46, done.
remote: Counting objects: 100% (2/2), done.
remote: Total 46 (delta 1), reused 1 (delta 1), pack-reused 44 (from 1)
Receiving objects: 100% (46/46), 10.08 KiB | 448.00 KiB/s, done.
Resolving deltas: 100% (14/14), done.
> cd pco24_lab01
pco24_lab01> tree
├── code
│ ├── CMakeLists.txt
│ ├── counter
│ ├── interlacement
│ ├── order
│ └── timestamps
└── pco_rendu.sh
Install the setup
The setup contains the following tools
- QT 5
- GoogleTest (gtest)
- pcosynchro library compiled from source
- pandas and matplotlib for the first lab
xtimes- a minimalist CLI to run a program X times to count occurences of same outputsscrandrthat can be useful in PCO
I don't include QtCreator, because most of students I ask would prefer to not use it.
Fedora & Ubuntu
The setup has been automated with lxup and is taking 3-6 minutes to run.
lxup play base
lxup play pco
Build system
With the play button in CLion
CLion is a proprietary software, if it is not a concern for you, CLion magically detects the targets so it can offer a play button that just works...
If you are on Windows, make sure CLion executes the commandes in WSL2, not in your default terminal... See related Jetbrains docs.
Building a CMake project in your terminal
If you are using VSCode or another IDE, you may want to just run your programs in the terminal. You can use the universal runner called r. You can install r and it's dependency cmr with the command lxup get r cmr. Help: I don't have lxup !
.
r is your play button in the terminal ! It takes care of compilation + execution like the play button in CLion. When there is multiple targets (multiple binary files generated by CMake), you can filter the list with the first argument. For example, when there is a labo_gui and labo_tests targets, running r gui will filter the target list with the word "gui", and the GUI will be ran.
Examples running r
# Not the folder with the code
labo6Engines> r
Sorry, but r.fish failed to match any supported project type in this folder
You can show the help with r -h or r --help to see what's supported
Maybe that's a bug, please make sure you are using the latest version or report the bug !
labo6Engines> cd code/
code> ls
CMakeLists.txt labo6_gui labo6_tests src
# This folder contains a `CMakeLists.txt`, r knows how to call CMake !
code> r
-- The C compiler identification is GNU 15.0.1
-- The CXX compiler identification is GNU 15.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
...
[ 94%] Built target PCO_lab06_tests
[100%] Built target PCO_lab06_gui
Multiple targets found, choose one or run again with a filter as first argument.
1. build/labo6_gui/PCO_lab06_gui
2. build/labo6_tests/PCO_lab06_tests
Choose a target by index: 1
Running build/labo6_gui/PCO_lab06_gui
# Filtering target list with "g" is enough to only match the "PCO_lab06_gui" target !
code> r g
# Building...
Running ./build/labo6_gui/PCO_lab06_gui
# Same for tests target
code> r t
Running ./build/labo6_tests/PCO_lab06_tests
[==========] Running 21 tests from 6 test suites.
[----------] Global test environment set-up.
[----------] 1 test from Pass
...
Troubleshooting
See troubleshooting page. It contains some general errors and their solutions. It also list several minor issues specifics to a certain setup and a given lab.
Did you found some errors or improvements ? Please contribute back by email (samuel.roland username for heig domain) or with a PR !