Skip to content
Snippets Groups Projects
Commit d765425d authored by Christof Kaufmann's avatar Christof Kaufmann
Browse files

build: Fix spdlog issues and bump version to 1.12.0

There have been CMake issues: spdlog was used in multiple export sets
which created CMake issues for the imagefusion target. It seems,
FetchContent_MakeAvailable defines an export set, so the additional
export set has been removed and it is still working.

When spdlog is not installed, is works through FetchContent. But, if it
is installed, it is likely using the external fmt library for
formatting. This gave a compile error in logging.h when including the
bundled ranges.h. So we use the same macro to decide whether to use the
bundled file or the external one. Usually it should be enough to include
spdlog/format/ranges.h and this would include the right file, but
unfortunately this very file might be missing as well in a pre-build
package. This fixes the conda-build, but using the package from Ubuntu
22.04 (spdlog 1.9.2) still fails, since spdlog is imcompatible with fmt.

The version has been updated to current releast 1.12.0.
parent 72bd247e
No related branches found
No related tags found
No related merge requests found
...@@ -162,7 +162,7 @@ else() ...@@ -162,7 +162,7 @@ else()
option(SPDLOG_INSTALL "Install dependency SPDLOG" ON) option(SPDLOG_INSTALL "Install dependency SPDLOG" ON)
FetchContent_Declare(spdlog FetchContent_Declare(spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.8.5) GIT_TAG v1.12.0)
FetchContent_MakeAvailable(spdlog) # checks also for compiler options, so set them before! FetchContent_MakeAvailable(spdlog) # checks also for compiler options, so set them before!
endif() endif()
set(TARGETS ${TARGETS} "spdlog::spdlog") set(TARGETS ${TARGETS} "spdlog::spdlog")
...@@ -313,14 +313,6 @@ if(IMAGEFUSION_INSTALL) ...@@ -313,14 +313,6 @@ if(IMAGEFUSION_INSTALL)
COMPONENT dev COMPONENT dev
FILES_MATCHING PATTERN "*.h") FILES_MATCHING PATTERN "*.h")
endif() endif()
if(NOT spdlog_FOUND)
install(TARGETS spdlog
EXPORT spdlogTargets
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT lib)
endif()
# install python interface library into package dir (where also __init__.py resides) # install python interface library into package dir (where also __init__.py resides)
if(IMAGEFUSION_BUILD_PYTHON_INTERFACE) if(IMAGEFUSION_BUILD_PYTHON_INTERFACE)
...@@ -380,14 +372,6 @@ if(IMAGEFUSION_INSTALL) ...@@ -380,14 +372,6 @@ if(IMAGEFUSION_INSTALL)
) )
endif() endif()
if(NOT spdlog_FOUND)
export(EXPORT spdlogTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/imagefusion/spdlogTargets.cmake"
NAMESPACE spdlog::
)
set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/spdlog")
endif()
# packaging with CPack # packaging with CPack
include(cmake/ImagefusionCPack.cmake) include(cmake/ImagefusionCPack.cmake)
endif() endif()
......
...@@ -37,7 +37,11 @@ ...@@ -37,7 +37,11 @@
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <spdlog/fmt/ostr.h> // required for custom types #include <spdlog/fmt/ostr.h> // required for custom types
#if !defined(SPDLOG_FMT_EXTERNAL)
#include <spdlog/fmt/bundled/ranges.h> // for logging std::vector #include <spdlog/fmt/bundled/ranges.h> // for logging std::vector
#else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib
#include <fmt/ranges.h>
#endif
#define SPDLOG_SINGLE_TRACE(...) _Pragma("omp single nowait")\ #define SPDLOG_SINGLE_TRACE(...) _Pragma("omp single nowait")\
SPDLOG_TRACE(__VA_ARGS__) SPDLOG_TRACE(__VA_ARGS__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment