1
0
Fork 0

Added CPP Part

This commit is contained in:
Yohan Boujon 2023-10-10 21:06:06 +02:00
parent adb4497012
commit 3ce89fa056
10 changed files with 40 additions and 1 deletions

3
.gitignore vendored
View file

@ -1 +1,2 @@
target
target
build

22
cpp/CMakeLists.txt Normal file
View file

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.22)
# Global Variables
set(TARGET aoc2022)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Set the etape value
set(DAY "1" CACHE STRING "Enter the day to compile.")
# Get the sources and headers
file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/day${DAY}/src/*.cpp")
add_executable(${TARGET} ${SOURCES})
target_include_directories(${TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/day${DAY}/include/")
# Adding compilation option depending on the OS
if(MSVC)
target_compile_options(${TARGET} PUBLIC /W3 /WX /DEBUG )
else()
target_compile_options(${TARGET} PUBLIC -Wall -Wextra -Wpedantic -Werror -lstdc++)
endif()

7
cpp/day1/src/main.cpp Normal file
View file

@ -0,0 +1,7 @@
#include <iostream>
int main()
{
std::cout << "Bonjour Monde!" << std::endl;
return 0;
}

5
cpp/run.bat Normal file
View file

@ -0,0 +1,5 @@
echo off
cmake --build build
cd build/Debug
aoc2022.exe
cd ../..

4
cpp/run.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
cmake --build build
"./build/aoc2022"