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(yaml-cpp CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(fmt REQUIRED)
find_package(LibLZMA CONFIG REQUIRED)
find_library(LZ4_LIBRARY NAMES lz4)
find_library(LZO2_LIBRARY NAMES lzo2)
@ -374,6 +376,8 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
${LIBLZMA_LIBRARIES}
CURL::libcurl
nlohmann_json::nlohmann_json
spdlog::spdlog
fmt::fmt
${YAML_CPP_LIBRARIES}
${LIBSOLV_BUILD_STATICRARIES}
${LIBSOLVEXT_BUILD_STATICRARIES}
@ -383,7 +387,9 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
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")
include_directories($ENV{CONDA_PREFIX}/Library/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(reproc++ CONFIG REQUIRED)
find_package(tl-expected REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(fmt REQUIRED)
set(LIBMAMBA_LIBRARIES_DEPS
${LIBSOLV_LIBRARIES}
@ -410,6 +418,8 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
reproc++
reproc
tl::expected
spdlog::spdlog
fmt::fmt
)
target_link_libraries(${target_name} PUBLIC

View File

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

View File

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

View File

@ -4,6 +4,11 @@
//
// 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/environment.hpp"
#include "mamba/core/output.hpp"
@ -12,11 +17,6 @@
#include "mamba/core/url.hpp"
#include "mamba/core/execution.hpp"
#include "termcolor/termcolor.hpp"
#include "spdlog/spdlog.h"
#include "spdlog/sinks/stdout_color_sinks.h"
namespace mamba
{
class Logger : public spdlog::logger

View File

@ -7,13 +7,6 @@
#ifndef 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 <mutex>
#include <atomic>
@ -22,6 +15,9 @@
#include <vector>
#include <map>
#include <spdlog/spdlog.h>
#include <fmt/color.h>
#include "mamba/core/progress_bar.hpp"
namespace mamba

View File

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

View File

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

View File

@ -22,18 +22,9 @@ pybind11_add_module(bindings
src/main.cpp
longpath.manifest
)
target_link_libraries(bindings PUBLIC pybind11::pybind11 libmamba)
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
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/libmambapy/)

View File

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

View File

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

View File

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

View File

@ -67,16 +67,6 @@ message(STATUS "Micromamba linkage: ${MICROMAMBA_LINKAGE}")
find_package(Threads REQUIRED)
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")
target_link_libraries(micromamba PRIVATE libmamba-full-static)
if (WIN32)

View File

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

View File

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