Chapter 2.2 : Compilation du projet



Il serait grand temps de compiler notre projet avant de l'envoyer sur Gitlab histoire de vérifier si il fonctionne.

Note : Bien entendu, il est préférable de vérifier la compilation le plus tôt possible, mais comme notre projet est minuscule, c'est difficile de le faire plus tôt.


Nous allons complier à la main mais les plus préssés d'entre vous pouront utiliser le script install.sh.

Commençons par créer un dossier build et allons dedans :

mkdir build

cd build



Appelons CMake :

cmake ..

-- The C compiler identification is GNU 9.3.0

-- The CXX compiler identification is GNU 9.3.0

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Detecting C compile features

-- Detecting C compile features - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- SELF_TESTS_MODE = yes

-- Configuring done

-- Generating done

-- Build files have been written to: TestGitlabCI/build



Puis Make :

make

Scanning dependencies of target accord_shadok

[ 25%] Building CXX object src/CMakeFiles/accord_shadok.dir/accord_shadok.cpp.o

[ 50%] Linking CXX shared library libaccord_shadok.so

[ 50%] Built target accord_shadok

Scanning dependencies of target test_accord_shadok

[ 75%] Building CXX object TESTS/TEST_ACCORD_SHADOK/CMakeFiles/test_accord_shadok.dir/main.cpp.o

[100%] Linking CXX executable test_accord_shadok

[100%] Built target test_accord_shadok



Lançons les tests unitaires :

make test

Running tests...

Test project /home/pierre/projects/COURS/INTRODUCTION_GITLAB/build/Correction/Final/TestGitlabCI/build

Start 1: TestAccordShadok

1/1 Test #1: TestAccordShadok ................. Passed 0.01 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) = 0.01 sec



Note : Si vous lancez gcovr après tout cela, vous n'obtiendrez aucun résultat de couverture de test car nous devons compiler notre projet différemment (voir section 2.3)