Direct dependency on fmt

This commit is contained in:
AntoinePrv 2022-10-26 10:36:24 +02:00
parent 8fb2cbe000
commit 4e2a91bea7
14 changed files with 33 additions and 53 deletions

View File

@ -344,6 +344,8 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
find_package(CURL CONFIG REQUIRED) find_package(CURL CONFIG REQUIRED)
find_package(yaml-cpp CONFIG REQUIRED) find_package(yaml-cpp CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED) find_package(nlohmann_json CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(fmt REQUIRED)
find_package(LibLZMA CONFIG REQUIRED) find_package(LibLZMA CONFIG REQUIRED)
find_library(LZ4_LIBRARY NAMES lz4) find_library(LZ4_LIBRARY NAMES lz4)
find_library(LZO2_LIBRARY NAMES lzo2) find_library(LZO2_LIBRARY NAMES lzo2)
@ -374,6 +376,8 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
${LIBLZMA_LIBRARIES} ${LIBLZMA_LIBRARIES}
CURL::libcurl CURL::libcurl
nlohmann_json::nlohmann_json nlohmann_json::nlohmann_json
spdlog::spdlog
fmt::fmt
${YAML_CPP_LIBRARIES} ${YAML_CPP_LIBRARIES}
${LIBSOLV_BUILD_STATICRARIES} ${LIBSOLV_BUILD_STATICRARIES}
${LIBSOLVEXT_BUILD_STATICRARIES} ${LIBSOLVEXT_BUILD_STATICRARIES}
@ -383,7 +387,9 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
tl::expected tl::expected
) )
add_definitions("-DLIBARCHIVE_STATIC -DCURL_STATICLIB -DSOLV_BUILD_STATIC") add_definitions(
-DLIBARCHIVE_STATIC -DCURL_STATICLIB -DSOLV_BUILD_STATIC
)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
include_directories($ENV{CONDA_PREFIX}/Library/include/) include_directories($ENV{CONDA_PREFIX}/Library/include/)
include_directories($ENV{VCPKG_ROOT}/installed/x64-windows-static/include/) include_directories($ENV{VCPKG_ROOT}/installed/x64-windows-static/include/)
@ -399,6 +405,8 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
find_package(yaml-cpp CONFIG REQUIRED) find_package(yaml-cpp CONFIG REQUIRED)
find_package(reproc++ CONFIG REQUIRED) find_package(reproc++ CONFIG REQUIRED)
find_package(tl-expected REQUIRED) find_package(tl-expected REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(fmt REQUIRED)
set(LIBMAMBA_LIBRARIES_DEPS set(LIBMAMBA_LIBRARIES_DEPS
${LIBSOLV_LIBRARIES} ${LIBSOLV_LIBRARIES}
@ -410,6 +418,8 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
reproc++ reproc++
reproc reproc
tl::expected tl::expected
spdlog::spdlog
fmt::fmt
) )
target_link_libraries(${target_name} PUBLIC target_link_libraries(${target_name} PUBLIC

View File

@ -18,4 +18,5 @@ dependencies:
- termcolor-cpp - termcolor-cpp
- cli11 >=2.2 - cli11 >=2.2
- spdlog - spdlog
- fmt
- sel(win): winreg - sel(win): winreg

View File

@ -12,6 +12,7 @@ dependencies:
- cpp-filesystem - cpp-filesystem
- nlohmann_json - nlohmann_json
- spdlog - spdlog
- fmt
- termcolor-cpp - termcolor-cpp
- zlib - zlib
- winreg - winreg

View File

@ -4,6 +4,11 @@
// //
// The full license is in the file LICENSE, distributed with this software. // The full license is in the file LICENSE, distributed with this software.
#include <termcolor/termcolor.hpp>
#include <spdlog/spdlog.h>
#include <spdlog/pattern_formatter.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include "mamba/core/context.hpp" #include "mamba/core/context.hpp"
#include "mamba/core/environment.hpp" #include "mamba/core/environment.hpp"
#include "mamba/core/output.hpp" #include "mamba/core/output.hpp"
@ -12,11 +17,6 @@
#include "mamba/core/url.hpp" #include "mamba/core/url.hpp"
#include "mamba/core/execution.hpp" #include "mamba/core/execution.hpp"
#include "termcolor/termcolor.hpp"
#include "spdlog/spdlog.h"
#include "spdlog/sinks/stdout_color_sinks.h"
namespace mamba namespace mamba
{ {
class Logger : public spdlog::logger class Logger : public spdlog::logger

View File

@ -7,13 +7,6 @@
#ifndef MAMBA_CORE_PROGRESS_BAR_IMPL_HPP #ifndef MAMBA_CORE_PROGRESS_BAR_IMPL_HPP
#define MAMBA_CORE_PROGRESS_BAR_IMPL_HPP #define MAMBA_CORE_PROGRESS_BAR_IMPL_HPP
#include "spdlog/spdlog.h"
#ifdef SPDLOG_FMT_EXTERNAL
#include "fmt/color.h"
#else
#include "spdlog/fmt/bundled/color.h"
#endif
#include <iosfwd> #include <iosfwd>
#include <mutex> #include <mutex>
#include <atomic> #include <atomic>
@ -22,6 +15,9 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <spdlog/spdlog.h>
#include <fmt/color.h>
#include "mamba/core/progress_bar.hpp" #include "mamba/core/progress_bar.hpp"
namespace mamba namespace mamba

View File

@ -11,8 +11,9 @@ extern "C"
#include <iostream> #include <iostream>
#include <stack> #include <stack>
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <spdlog/fmt/chrono.h> #include <fmt/chrono.h>
#include "mamba/core/query.hpp" #include "mamba/core/query.hpp"
#include "mamba/core/match_spec.hpp" #include "mamba/core/match_spec.hpp"

View File

@ -11,12 +11,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "spdlog/spdlog.h"
#ifdef SPDLOG_FMT_EXTERNAL
#include <fmt/format.h> #include <fmt/format.h>
#else
#include <spdlog/fmt/bundled/format.h>
#endif
#include "mamba/core/pool.hpp" #include "mamba/core/pool.hpp"
#include "mamba/core/solver.hpp" #include "mamba/core/solver.hpp"

View File

@ -22,18 +22,9 @@ pybind11_add_module(bindings
src/main.cpp src/main.cpp
longpath.manifest longpath.manifest
) )
target_link_libraries(bindings PUBLIC pybind11::pybind11 libmamba) target_link_libraries(bindings PUBLIC pybind11::pybind11 libmamba)
set_property(TARGET bindings PROPERTY CXX_STANDARD 17) set_property(TARGET bindings PROPERTY CXX_STANDARD 17)
# Check spdlog C header for external fmt configuration.
find_file(SPDLOG_TWEAK_H NAMES spdlog/tweakme.h)
if(SPDLOG_TWEAK_H)
file(READ ${SPDLOG_TWEAK_H} SPDLOG_TWEAK_H_STRING)
if("${SPDLOG_TWEAK_H_STRING}" MATCHES "\n *#define *SPDLOG_FMT_EXTERNAL *")
find_package(fmt REQUIRED)
target_link_libraries(bindings PRIVATE fmt::fmt)
endif()
endif()
install(TARGETS bindings install(TARGETS bindings
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/libmambapy/) LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/libmambapy/)

View File

@ -18,6 +18,7 @@ dependencies:
- termcolor-cpp - termcolor-cpp
- cli11 >=2.2 - cli11 >=2.2
- spdlog - spdlog
- fmt
- pybind11 - pybind11
- pybind11-stubgen - pybind11-stubgen
- pytest - pytest

View File

@ -8,11 +8,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <pybind11/stl.h> #include <pybind11/stl.h>
#include "nlohmann/json.hpp" #include <nlohmann/json.hpp>
#include <fmt/format.h>
// Make sure to use external fmt if desired
#include "spdlog/tweakme.h"
#include "spdlog/fmt/fmt.h"
#include "mamba/api/clean.hpp" #include "mamba/api/clean.hpp"
#include "mamba/api/configuration.hpp" #include "mamba/api/configuration.hpp"

View File

@ -18,6 +18,7 @@ dependencies:
- termcolor-cpp - termcolor-cpp
- cli11 >=2.2 - cli11 >=2.2
- spdlog - spdlog
- fmt
- pybind11 - pybind11
- pybind11-stubgen - pybind11-stubgen
- pytest - pytest

View File

@ -67,16 +67,6 @@ message(STATUS "Micromamba linkage: ${MICROMAMBA_LINKAGE}")
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
target_link_libraries(micromamba PRIVATE Threads::Threads) target_link_libraries(micromamba PRIVATE Threads::Threads)
# Check spdlog C header for external fmt configuration.
find_file(SPDLOG_TWEAK_H NAMES spdlog/tweakme.h)
if(SPDLOG_TWEAK_H)
file(READ ${SPDLOG_TWEAK_H} SPDLOG_TWEAK_H_STRING)
if("${SPDLOG_TWEAK_H_STRING}" MATCHES "\n *#define *SPDLOG_FMT_EXTERNAL *")
find_package(fmt REQUIRED)
target_link_libraries(micromamba PRIVATE fmt::fmt)
endif()
endif()
if (${MICROMAMBA_LINKAGE} STREQUAL "FULL_STATIC") if (${MICROMAMBA_LINKAGE} STREQUAL "FULL_STATIC")
target_link_libraries(micromamba PRIVATE libmamba-full-static) target_link_libraries(micromamba PRIVATE libmamba-full-static)
if (WIN32) if (WIN32)

View File

@ -24,5 +24,6 @@ dependencies:
- pytest-xprocess - pytest-xprocess
- pyyaml - pyyaml
- spdlog - spdlog
- fmt
- sel(win): winreg - sel(win): winreg
- sel(win): pywin32 - sel(win): pywin32

View File

@ -2,15 +2,10 @@
#include <exception> #include <exception>
#include <thread> #include <thread>
#include "spdlog/spdlog.h" #include <spdlog/spdlog.h>
#ifdef SPDLOG_FMT_EXTERNAL #include <fmt/color.h>
#include "fmt/color.h"
#else
#include "spdlog/fmt/bundled/color.h"
#endif
#include <reproc++/run.hpp> #include <reproc++/run.hpp>
#include "common_options.hpp" #include <nlohmann/json.hpp>
#include "mamba/api/configuration.hpp" #include "mamba/api/configuration.hpp"
#include "mamba/api/install.hpp" #include "mamba/api/install.hpp"
@ -19,7 +14,7 @@
#include "mamba/core/execution.hpp" #include "mamba/core/execution.hpp"
#include "mamba/core/error_handling.hpp" #include "mamba/core/error_handling.hpp"
#include <nlohmann/json.hpp> #include "common_options.hpp"
#ifndef _WIN32 #ifndef _WIN32
extern "C" extern "C"