diff --git a/CMakeLists.txt b/CMakeLists.txt index 25b17266..03ef1f19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(pizzeria LANGUAGES CXX) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +# SFML include(FetchContent) FetchContent_Declare(SFML GIT_REPOSITORY https://github.com/SFML/SFML.git @@ -18,6 +19,13 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(googletest) +# Boost +set(BOOST_ROOT $ENV{BOOST_ROOT}) +set(BOOST_LIBRARYDIR "$ENV{BOOST_ROOT}/stage/lib") +find_package(Boost 1.82 REQUIRED COMPONENTS log) +include_directories( ${Boost_INCLUDE_DIRS} ) +link_directories(${BOOST_LIBRARYDIR}) + add_executable(pizzeria src/main.cpp @@ -57,6 +65,7 @@ add_executable(pizzeria src/vista/presentador.cpp src/vista/vista.cpp src/vista/basicos_vista.cpp + src/demos/boost_log.cpp src/demos/demo_nivel.cpp src/demos/map.cpp src/demos/prueba.cpp @@ -64,7 +73,7 @@ add_executable(pizzeria src/demos/visual.cpp src/demos/visual_textos.cpp ) -target_link_libraries(pizzeria PRIVATE sfml-graphics sfml-audio) +target_link_libraries(pizzeria PRIVATE sfml-graphics sfml-audio Boost::log) target_compile_features(pizzeria PRIVATE cxx_std_17) # Tratar los warnings como errores en modo Debug. @@ -135,6 +144,7 @@ add_executable( src/vista/presentador.cpp src/vista/vista.cpp src/vista/basicos_vista.cpp + src/demos/boost_log.cpp src/demos/demo_nivel.cpp src/demos/map.cpp src/demos/prueba.cpp diff --git a/src/demos/boost_log.cpp b/src/demos/boost_log.cpp new file mode 100644 index 00000000..54f56ca0 --- /dev/null +++ b/src/demos/boost_log.cpp @@ -0,0 +1,16 @@ +#include "boost_log.h" +#include +#include + +#define LOG BOOST_LOG_TRIVIAL + +int demo_boost_log() { + std::cout << "Prueba de Boost Log" << std::endl; + LOG(trace) << "A trace severity message"; + BOOST_LOG_TRIVIAL(debug) << "A debug severity message"; + BOOST_LOG_TRIVIAL(info) << "An informational severity message"; + BOOST_LOG_TRIVIAL(warning) << "A warning severity message"; + BOOST_LOG_TRIVIAL(error) << "An error severity message"; + BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message"; + return 0; +} diff --git a/src/demos/boost_log.h b/src/demos/boost_log.h new file mode 100644 index 00000000..f136fffc --- /dev/null +++ b/src/demos/boost_log.h @@ -0,0 +1,5 @@ +#pragma once + +#include "../shared.h" + +int demo_boost_log(); diff --git a/src/main.cpp b/src/main.cpp index 58651288..b966eda3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include "demos/boost_log.h" #include "demos/demo_nivel.h" #include "demos/map.h" #include "demos/min_ex.h" @@ -13,6 +14,7 @@ #define USER_ERROR 1 enum class AppNombrada { + Boost, Juego, Nivel, Visual, @@ -26,6 +28,7 @@ enum class AppNombrada { const std::map cadena_to_app_nombrada = { {"", AppNombrada::Juego}, // + {"boost-log", AppNombrada::Boost}, // {"nivel", AppNombrada::Nivel}, // {"visual", AppNombrada::Visual}, // {"textos", AppNombrada::Textos}, // @@ -62,6 +65,9 @@ int _main(int argc, char *argv[]) { case AppNombrada::Juego: return juego(); break; + case AppNombrada::Boost: + return demo_boost_log(); + break; case AppNombrada::Nivel: { int num_nivel_introducido;