Browse Source

fix handling of built in version of spdlog and fmt

develop
Eyck Jentzsch 6 months ago
parent
commit
f0495ae868
79 changed files with 29 additions and 20 deletions
  1. +29
    -18
      CMakeLists.txt
  2. +0
    -2
      src/report.cpp
  3. +0
    -0
      third_party/spdlog/async.h

+ 29
- 18
CMakeLists.txt View File

@ -70,14 +70,30 @@ if(CCI_FOUND)
)
endif()
if(TARGET spdlog::spdlog)
set(SPDLOG_TARGET spdlog::spdlog)
elseif(TARGET CONAN_PKG::spdlog)
set(SPDLOG_TARGET CONAN_PKG::spdlog)
else()
add_library(spdlog_local INTERFACE)
target_compile_definitions(spdlog_local SPDLOG_HEADER_ONLY)
target_include_directories(fmt_local INTERFACE third_party)
set(SPDLOG_TARGET spdlog_local)
message("Using built-in version of spdlog")
endif()
if(TARGET fmt::fmt)
set(FMT_TARGET fmt::fmt)
elseif(TARGET CONAN_PKG::fmt)
set(FMT_TARGET CONAN_PKG::fmt)
else()
add_library(fmt_local INTERFACE)
target_include_directories(fmt_local INTERFACE third_party/spdlog)
set(FMT_TARGET fmt_local)
message("Using built-in version of fmt")
endif()
if(SCV_FOUND)
if(TARGET fmt::fmt)
set(FMT_TGT fmt::fmt)
elseif(TARGET CONAN_PKG::fmt)
set(FMT_TGT CONAN_PKG::fmt)
else()
set(FMT_TGT "")
endif()
if(ZLIB_FOUND)
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_compressed.cpp)
endif(ZLIB_FOUND)
@ -87,9 +103,7 @@ if(SCV_FOUND)
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_ldb/scv_tr_ldb.cpp )
endif()
endif()
if(NOT FMT_TGT STREQUAL "")
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_sqlite/scv_tr_sqlite.cpp src/scv_tr_sqlite/sqlite3.c )
endif()
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_sqlite/scv_tr_sqlite.cpp src/scv_tr_sqlite/sqlite3.c )
endif(SCV_FOUND)
# Define two variables in order not to repeat ourselves.
@ -110,12 +124,9 @@ set_target_properties(scc PROPERTIES
PUBLIC_HEADER "incl/scc.h" # specify the public headers
)
target_link_libraries(scc scc-util ${FMT_TGT} ${CMAKE_DL_LIBS})
if(${CMAKE_VERSION} VERSION_LESS "3.2.0")
target_link_libraries(scc ${CMAKE_THREAD_LIBS_INIT})
else()
target_link_libraries(scc Threads::Threads)
endif()
target_link_libraries(scc PUBLIC scc-util ${CMAKE_DL_LIBS})
target_link_libraries(scc PRIVATE ${FMT_TARGET} ${SPDLOG_TARGET})
target_link_libraries(scc PUBLIC Threads::Threads)
if(CCI_FOUND)
target_compile_definitions(scc PUBLIC -DWITH_CCI)
@ -136,11 +147,11 @@ if(SCV_FOUND)
endif()
if(ZLIB_FOUND)
target_link_libraries (scc ${ZLIB_LIBRARIES})
target_link_libraries (scc PUBLIC ${ZLIB_LIBRARIES})
endif(ZLIB_FOUND)
target_include_directories (scc PUBLIC ${SystemC_INCLUDE_DIRS})
target_link_libraries(scc ${SystemC_LIBRARIES} )
target_link_libraries(scc PUBLIC ${SystemC_LIBRARIES} )
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
target_link_directories(scc PUBLIC ${SystemC_LIBRARY_DIRS})
endif()

+ 0
- 2
src/report.cpp View File

@ -24,12 +24,10 @@
#include <chrono>
#include <fstream>
#include <scc/report.h>
#define SPDLOG_HEADER_ONLY
#include "spdlog/spdlog.h"
#include "spdlog/async.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#undef SPDLOG_HEADER_ONLY
#include <thread>
#include <tuple>
#ifdef __GNUC__

src/spdlog/async.h → third_party/spdlog/async.h View File


Loading…
Cancel
Save