Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
8dd85285
Commit
8dd85285
authored
May 18, 2019
by
David Zemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow user to choose between static or shared library
parent
dbcbeb7a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
31 deletions
+27
-31
CMakeLists.txt
CMakeLists.txt
+11
-12
CMakeLists.txt
bench/CMakeLists.txt
+4
-4
CMakeLists.txt
example/CMakeLists.txt
+4
-4
common.h
include/spdlog/common.h
+2
-3
base_sink.h
include/spdlog/sinks/base_sink.h
+2
-3
spdlog.cpp
src/spdlog.cpp
+3
-4
CMakeLists.txt
tests/CMakeLists.txt
+1
-1
No files found.
CMakeLists.txt
View file @
8dd85285
...
@@ -45,6 +45,7 @@ else()
...
@@ -45,6 +45,7 @@ else()
set
(
SPDLOG_MASTER_PROJECT OFF
)
set
(
SPDLOG_MASTER_PROJECT OFF
)
endif
()
endif
()
option
(
BUILD_SHARED_LIBS
"Global flag to cause add_library to create shared libraries if on."
ON
)
option
(
SPDLOG_BUILD_EXAMPLES
"Build examples"
${
SPDLOG_MASTER_PROJECT
}
)
option
(
SPDLOG_BUILD_EXAMPLES
"Build examples"
${
SPDLOG_MASTER_PROJECT
}
)
option
(
SPDLOG_BUILD_BENCH
"Build benchmarks (Requires https://github.com/google/benchmark.git to be installed)"
OFF
)
option
(
SPDLOG_BUILD_BENCH
"Build benchmarks (Requires https://github.com/google/benchmark.git to be installed)"
OFF
)
option
(
SPDLOG_BUILD_TESTS
"Build tests"
ON
)
option
(
SPDLOG_BUILD_TESTS
"Build tests"
ON
)
...
@@ -55,15 +56,13 @@ set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include/spdlog")
...
@@ -55,15 +56,13 @@ set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include/spdlog")
message
(
STATUS
"Build type: "
${
CMAKE_BUILD_TYPE
}
)
message
(
STATUS
"Build type: "
${
CMAKE_BUILD_TYPE
}
)
# Build static lib
# Build library
set
(
SRC_BASE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src"
)
add_library
(
spdlog src/spdlog.cpp
)
set
(
STATIC_SRC_FILES
"
${
SRC_BASE
}
/spdlog.cpp"
)
add_library
(
spdlog::spdlog ALIAS spdlog
)
add_library
(
spdlog_static STATIC
${
STATIC_SRC_FILES
}
)
target_compile_definitions
(
spdlog PUBLIC SPDLOG_COMPILED_LIB
)
add_library
(
spdlog::static ALIAS spdlog_static
)
target_include_directories
(
spdlog PUBLIC
"$<BUILD_INTERFACE:
${
CMAKE_CURRENT_LIST_DIR
}
/include>"
)
target_compile_definitions
(
spdlog_static PUBLIC SPDLOG_STATIC_LIB
)
set_target_properties
(
spdlog PROPERTIES OUTPUT_NAME
"spdlog"
)
target_include_directories
(
spdlog_static PUBLIC
"$<BUILD_INTERFACE:
${
CMAKE_CURRENT_LIST_DIR
}
/include>"
)
set_target_properties
(
spdlog PROPERTIES DEBUG_POSTFIX
"-debug"
)
set_target_properties
(
spdlog_static PROPERTIES OUTPUT_NAME
"spdlog"
)
set_target_properties
(
spdlog_static PROPERTIES DEBUG_POSTFIX
"-debug"
)
# Headr only
# Headr only
add_library
(
spdlog_header_only INTERFACE
)
add_library
(
spdlog_header_only INTERFACE
)
...
@@ -75,8 +74,8 @@ if(SPDLOG_FMT_EXTERNAL AND NOT TARGET fmt::fmt)
...
@@ -75,8 +74,8 @@ if(SPDLOG_FMT_EXTERNAL AND NOT TARGET fmt::fmt)
endif
()
endif
()
if
(
SPDLOG_FMT_EXTERNAL
)
if
(
SPDLOG_FMT_EXTERNAL
)
target_compile_definitions
(
spdlog
_static
INTERFACE SPDLOG_FMT_EXTERNAL
)
target_compile_definitions
(
spdlog INTERFACE SPDLOG_FMT_EXTERNAL
)
target_link_libraries
(
spdlog
_static
INTERFACE fmt::fmt
)
target_link_libraries
(
spdlog INTERFACE fmt::fmt
)
target_compile_definitions
(
spdlog_header_only INTERFACE SPDLOG_FMT_EXTERNAL
)
target_compile_definitions
(
spdlog_header_only INTERFACE SPDLOG_FMT_EXTERNAL
)
target_link_libraries
(
spdlog_header_only INTERFACE fmt::fmt
)
target_link_libraries
(
spdlog_header_only INTERFACE fmt::fmt
)
endif
()
endif
()
...
@@ -98,7 +97,7 @@ endif()
...
@@ -98,7 +97,7 @@ endif()
# install
# install
#---------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------
install
(
DIRECTORY
${
HEADER_BASE
}
DESTINATION include
)
install
(
DIRECTORY
${
HEADER_BASE
}
DESTINATION include
)
install
(
TARGETS spdlog
_static ARCHIVE
DESTINATION lib
)
install
(
TARGETS spdlog DESTINATION lib
)
#---------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------
# register project in CMake user registry
# register project in CMake user registry
...
...
bench/CMakeLists.txt
View file @
8dd85285
...
@@ -33,16 +33,16 @@ find_package(Threads REQUIRED)
...
@@ -33,16 +33,16 @@ find_package(Threads REQUIRED)
find_package
(
benchmark CONFIG REQUIRED
)
find_package
(
benchmark CONFIG REQUIRED
)
add_executable
(
bench bench.cpp
)
add_executable
(
bench bench.cpp
)
target_link_libraries
(
bench PRIVATE spdlog::s
tatic
Threads::Threads
)
target_link_libraries
(
bench PRIVATE spdlog::s
pdlog
Threads::Threads
)
add_executable
(
async_bench async_bench.cpp
)
add_executable
(
async_bench async_bench.cpp
)
target_link_libraries
(
async_bench PRIVATE spdlog::s
tatic
Threads::Threads
)
target_link_libraries
(
async_bench PRIVATE spdlog::s
pdlog
Threads::Threads
)
add_executable
(
latency latency.cpp
)
add_executable
(
latency latency.cpp
)
target_link_libraries
(
latency PRIVATE benchmark::benchmark spdlog::s
tatic
Threads::Threads
)
target_link_libraries
(
latency PRIVATE benchmark::benchmark spdlog::s
pdlog
Threads::Threads
)
add_executable
(
formatter-bench formatter-bench.cpp
)
add_executable
(
formatter-bench formatter-bench.cpp
)
target_link_libraries
(
formatter-bench PRIVATE benchmark::benchmark spdlog::s
tatic
Threads::Threads
)
target_link_libraries
(
formatter-bench PRIVATE benchmark::benchmark spdlog::s
pdlog
Threads::Threads
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
example/CMakeLists.txt
View file @
8dd85285
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
cmake_minimum_required
(
VERSION 3.1
)
cmake_minimum_required
(
VERSION 3.1
)
project
(
SpdlogExamples CXX
)
project
(
SpdlogExamples CXX
)
if
(
NOT TARGET spdlog
)
if
(
NOT TARGET spdlog
::spdlog
)
# Stand-alone build
# Stand-alone build
find_package
(
spdlog CONFIG REQUIRED
)
find_package
(
spdlog CONFIG REQUIRED
)
endif
()
endif
()
...
@@ -34,14 +34,14 @@ find_package(Threads REQUIRED)
...
@@ -34,14 +34,14 @@ find_package(Threads REQUIRED)
add_executable
(
example example.cpp
)
add_executable
(
example example.cpp
)
if
(
CMAKE_SYSTEM_NAME STREQUAL
"Android"
)
if
(
CMAKE_SYSTEM_NAME STREQUAL
"Android"
)
find_library
(
log-lib log
)
find_library
(
log-lib log
)
target_link_libraries
(
example spdlog::s
tatic
Threads::Threads log
)
target_link_libraries
(
example spdlog::s
pdlog
Threads::Threads log
)
else
()
else
()
target_link_libraries
(
example spdlog::s
tatic
Threads::Threads
)
target_link_libraries
(
example spdlog::s
pdlog
Threads::Threads
)
endif
()
endif
()
add_executable
(
multisink multisink.cpp
)
add_executable
(
multisink multisink.cpp
)
target_link_libraries
(
multisink spdlog::s
tatic
Threads::Threads
)
target_link_libraries
(
multisink spdlog::s
pdlog
Threads::Threads
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
...
...
include/spdlog/common.h
View file @
8dd85285
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include <locale>
#include <locale>
#endif
#endif
#ifdef SPDLOG_
STATIC
_LIB
#ifdef SPDLOG_
COMPILED
_LIB
#undef SPDLOG_HEADER_ONLY
#undef SPDLOG_HEADER_ONLY
#define SPDLOG_INLINE
#define SPDLOG_INLINE
#else
#else
...
@@ -216,4 +216,4 @@ std::unique_ptr<T> make_unique(Args &&... args)
...
@@ -216,4 +216,4 @@ std::unique_ptr<T> make_unique(Args &&... args)
#ifdef SPDLOG_HEADER_ONLY
#ifdef SPDLOG_HEADER_ONLY
#include "common-inl.h"
#include "common-inl.h"
#endif
#endif
\ No newline at end of file
include/spdlog/sinks/base_sink.h
View file @
8dd85285
...
@@ -37,6 +37,6 @@ protected:
...
@@ -37,6 +37,6 @@ protected:
}
// namespace sinks
}
// namespace sinks
}
// namespace spdlog
}
// namespace spdlog
#ifndef SPDLOG_
STATIC
_LIB
#ifndef SPDLOG_
COMPILED
_LIB
#include "base_sink-inl.h"
#include "base_sink-inl.h"
#endif
#endif
\ No newline at end of file
src/spdlog.cpp
View file @
8dd85285
// Copyright(c) 2015-present Gabi Melman & spdlog contributors.
// Copyright(c) 2015-present Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#ifndef SPDLOG_
STATIC
_LIB
#ifndef SPDLOG_
COMPILED
_LIB
#error Please define SPDLOG_
STATIC
_LIB to compile this file.
#error Please define SPDLOG_
COMPILED
_LIB to compile this file.
#endif
#endif
#include <mutex>
#include <mutex>
...
@@ -100,4 +100,4 @@ template FMT_API int internal::char_traits<wchar_t>::format_float(wchar_t *, std
...
@@ -100,4 +100,4 @@ template FMT_API int internal::char_traits<wchar_t>::format_float(wchar_t *, std
template
FMT_API
std
::
wstring
internal
::
vformat
<
wchar_t
>
(
wstring_view
,
basic_format_args
<
wformat_context
>
);
template
FMT_API
std
::
wstring
internal
::
vformat
<
wchar_t
>
(
wstring_view
,
basic_format_args
<
wformat_context
>
);
FMT_END_NAMESPACE
FMT_END_NAMESPACE
#endif
#endif
\ No newline at end of file
tests/CMakeLists.txt
View file @
8dd85285
...
@@ -21,7 +21,7 @@ set(SPDLOG_UTESTS_SOURCES
...
@@ -21,7 +21,7 @@ set(SPDLOG_UTESTS_SOURCES
add_executable
(
${
PROJECT_NAME
}
${
SPDLOG_UTESTS_SOURCES
}
)
add_executable
(
${
PROJECT_NAME
}
${
SPDLOG_UTESTS_SOURCES
}
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE Threads::Threads
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE Threads::Threads
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE spdlog::s
tatic
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE spdlog::s
pdlog
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment