Official repository of the Programming and Architecture of Computing Systems course of the MS in Robotics, Graphics, and Computer Vision
The code examples and some laboratories rely on cmake to enable multi-platform building support, so there is no need to manually write any Makefile or other build system. Linux is the preferred operating system to work on the labs, but the binaries have been also compiled on mac OS.
Although, we do not provide support for Windows. If you want to build and run the test on Windows, please consider using CMake with Visual Studio.
You can download the free community edition of Visual Studio, and then with you github credentials download this repo and compile it.
One advantage of cmake is the separation between source and binary files. To
generate the programs in Linux, please follow these 3 step sequence. First, create a build directory, then
invoke cmake to generate the build files, Makefiles
, and, after
than, use the standard make
tool for obtaining the binaries. By default,
cmake builds programs in release mode with optimizations enabled, if you want
to build them with debug support; e.g., to use them with gdb
, you can set the
variable CMAKE_BUILD_TYPE
to Debug
.
The directory code_examples
contains many of the small C++ programs and
fragments from the slides.
To compile them on Linux or mac OS, you can use cmake
. For example:
mkdir build-release
cd build-release
cmake -DCMAKE_BUILD_TYPE=Release ../ # generate the Makefile with cmake
make # compile the examples
ls # list the examples
Please note that the invocation to cmake
includes the path ../
that correspond to the parent directory where
the main CMakeLists.txt
file resides.
If you want to compile for debugging, please note that at this point, we will
have two sets of binaries, set the variable CMAKE_BUILD_TYPE
when calling
cmake
:
mkdir build-debug
cd build-debug
cmake -DCMAKE_BUILD_TYPE=Debug ../ # generate the Makefile with cmake
make -j4 # compile the examples in parallel with 4 jobs
Also if you want to see the actual build commands, there are several alternatives such as:
make VERBOSE=1 # linux/mac OS specific
cmake --build . -v # should work on any OS
cmake --build --target hello # build a single target on Windows OS
In some machines of the Computer Science Department, two different versions of
cmake
, versions 2 and 3, coexists. Their binary names are cmake
and
cmake3
, respectively. Since this repository requires cmake
version 3, if
you get an error running cmake
about the version, please switch to cmake3
executable. You can check cmake's version with:
eniac:PACS user$ cmake -version
cmake version 3.18.3
Each laboratory includes its own directory, but all of them can be built at the same time if required. To build a single laboratory; e.g., the third laboratory in release mode, please follow these steps:
mkdir -p build-release # assuming pwd equals root PACS repo directory
cd build-release
rm -rf ./ # only run this command inside build-release directory
cmake -DCMAKE_BUILD_TYPE=Release ../
cd Laboratory-3
make -j2 # compile two jobs in parallel
Suggestion: One workflow approach for the labs is to develop and test in debug mode,
inside a build-debug
directory, and switch to release, in another
build-release
directory, to run the final experiments and obtain execution
times or other metrics.