Added TP_INSA Cmake project. Boilerplate for the TP.
This commit is contained in:
parent
784e1f6ff0
commit
bc22a1cd69
6 changed files with 64 additions and 3 deletions
|
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.22)
|
||||||
# Global Variables
|
# Global Variables
|
||||||
set(EXERCICE_TARGET exercice_insa)
|
set(EXERCICE_TARGET exercice_insa)
|
||||||
set(TD_TARGET td_insa)
|
set(TD_TARGET td_insa)
|
||||||
|
set(TP_TARGET tp_insa)
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
@ -19,6 +20,11 @@ file(GLOB SOURCES_TD "${PROJECT_SOURCE_DIR}/td/td${TD}/src/*.cpp")
|
||||||
add_executable(${TD_TARGET} ${SOURCES_TD})
|
add_executable(${TD_TARGET} ${SOURCES_TD})
|
||||||
target_include_directories(${TD_TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/td/td${ETAPE}/include/")
|
target_include_directories(${TD_TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/td/td${ETAPE}/include/")
|
||||||
|
|
||||||
|
#TP
|
||||||
|
file(GLOB SOURCES_TP "${PROJECT_SOURCE_DIR}/tp/src/*.cpp")
|
||||||
|
add_executable(${TP_TARGET} ${SOURCES_TP})
|
||||||
|
target_include_directories(${TP_TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/tp/include")
|
||||||
|
|
||||||
# Adding compilation option depending on the OS
|
# Adding compilation option depending on the OS
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(${EXERCICE_TARGET} PUBLIC /W3 /WX /DEBUG )
|
target_compile_options(${EXERCICE_TARGET} PUBLIC /W3 /WX /DEBUG )
|
||||||
|
|
|
@ -14,7 +14,7 @@ cd build
|
||||||
```
|
```
|
||||||
cmake -DETAPE=2 -DTD=1 ..
|
cmake -DETAPE=2 -DTD=1 ..
|
||||||
```
|
```
|
||||||
_Dans cet exemple, l'étape 2 et le td 1 seront construits._
|
_Dans cet exemple, l'étape 2 et le td 1 seront construits. Le tp lui n'a pas besoin de nombre particulier._
|
||||||
|
|
||||||
### Lancer la compilation
|
### Lancer la compilation
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ Il suffit ensuite de construire l'executable dans le dossier désiré
|
||||||
```
|
```
|
||||||
cmake --build . --target <target_name>
|
cmake --build . --target <target_name>
|
||||||
```
|
```
|
||||||
>`<target_name>` étant soit `td_insa` ou `exercice_insa`
|
>`<target_name>` étant soit `td_insa`, `exercice_insa` ou `tp_insa`
|
||||||
|
|
||||||
## Conseil pour compiler et executer efficacement
|
## Conseil pour compiler et executer efficacement
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ _Pour Powershell sur Windows_
|
||||||
run.bat <target_name>
|
run.bat <target_name>
|
||||||
```
|
```
|
||||||
_Pour CMD sur Windows_
|
_Pour CMD sur Windows_
|
||||||
>`<target_name>` étant soit `td_insa` ou `exercice_insa`
|
>`<target_name>` étant soit `td_insa`, `exercice_insa` ou `tp_insa`
|
||||||
|
|
||||||
## Test des allocations entre la bibliothèque standard et mon implémentation
|
## Test des allocations entre la bibliothèque standard et mon implémentation
|
||||||
|
|
||||||
|
|
12
tp/include/figure.h
Normal file
12
tp/include/figure.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef HEADER_FIGURE
|
||||||
|
#define HEADER_FIGURE
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class Figure {
|
||||||
|
public:
|
||||||
|
virtual int perimetre()=0;
|
||||||
|
virtual std::string afficherCaracteristiques()=0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HEADER_FIGURE
|
17
tp/include/polygone.h
Normal file
17
tp/include/polygone.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef HEADER_POLYGONE
|
||||||
|
#define HEADER_POLYGONE
|
||||||
|
|
||||||
|
#include "figure.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
class Polygone : public Figure
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Polygone(u_int64_t nb_cotes);
|
||||||
|
virtual std::string afficherCaracteristiques() override;
|
||||||
|
virtual int perimetre() override;
|
||||||
|
private:
|
||||||
|
u_int64_t _nbcotes;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HEADER_POLYGONE
|
8
tp/src/main.cpp
Normal file
8
tp/src/main.cpp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include "../include/polygone.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
Polygone coolPoly(5);
|
||||||
|
std::cout << coolPoly.afficherCaracteristiques() << std::endl;
|
||||||
|
}
|
18
tp/src/polygone.cpp
Normal file
18
tp/src/polygone.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include "../include/polygone.h"
|
||||||
|
#include <string>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
Polygone::Polygone(u_int64_t nb_cotes)
|
||||||
|
: _nbcotes(nb_cotes)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Polygone::afficherCaracteristiques()
|
||||||
|
{
|
||||||
|
return std::string("Nombre de cotes : " + std::to_string(_nbcotes));
|
||||||
|
}
|
||||||
|
|
||||||
|
int Polygone::perimetre()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue