diff --git a/lesson5/CMakeLists.txt b/lesson5/CMakeLists.txt new file mode 100644 index 0000000..2aa29f1 --- /dev/null +++ b/lesson5/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(formatter CXX) + +find_package(fmt REQUIRED) + +add_executable(formatter src/main.cpp) +target_link_libraries(formatter fmt::fmt) diff --git a/lesson5/conanfile.py b/lesson5/conanfile.py new file mode 100644 index 0000000..b452c4c --- /dev/null +++ b/lesson5/conanfile.py @@ -0,0 +1,15 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout + +class FormatterRecipe(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps" + + def requirements(self): + self.requires("fmt/11.0.2") + + def build_requirements(self): + self.tool_requires("cmake/3.31.5") + + def layout(self): + cmake_layout(self) diff --git a/lesson5/profiles/raspberry b/lesson5/profiles/raspberry new file mode 100644 index 0000000..55bc290 --- /dev/null +++ b/lesson5/profiles/raspberry @@ -0,0 +1,12 @@ +[settings] +os=Linux +arch=armv7hf +compiler=gcc +build_type=Release +compiler.cppstd=gnu14 +compiler.libcxx=libstdc++11 +compiler.version=12 +[buildenv] +CC=arm-linux-gnueabihf-gcc-12 +CXX=arm-linux-gnueabihf-g++-12 +LD=arm-linux-gnueabihf-ld diff --git a/lesson5/src/main.cpp b/lesson5/src/main.cpp new file mode 100644 index 0000000..c86bff1 --- /dev/null +++ b/lesson5/src/main.cpp @@ -0,0 +1,19 @@ +#include +#include + +int main() { + fmt::print(fmt::fg(fmt::color::cyan) | fmt::emphasis::bold, + "Conan is a MIT-licensed, Open Source "); + fmt::print(fmt::fg(fmt::color::white), + "package manager for C and C++ development\n"); + + #ifdef NDEBUG + fmt::print(fmt::fg(fmt::color::green) | fmt::emphasis::italic, + "Release configuration!\n"); + #else + fmt::print(fmt::fg(fmt::color::yellow) | fmt::emphasis::italic, + "Debug configuration!\n"); + #endif + + return 0; +}