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
64028851
Commit
64028851
authored
Jun 18, 2016
by
gabime
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'header-tests' of
https://github.com/godbyk/spdlog
into godbyk-header-tests
parents
fafe88c3
cb3b7728
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
2 deletions
+98
-2
CMakeLists.txt
CMakeLists.txt
+9
-2
stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+1
-0
CMakeLists.txt
tests/CMakeLists.txt
+19
-0
CMakeLists.txt
tests/header_dependencies/CMakeLists.txt
+58
-0
main.c
tests/header_dependencies/main.c
+7
-0
main.cpp
tests/header_dependencies/main.cpp
+4
-0
No files found.
CMakeLists.txt
View file @
64028851
...
...
@@ -12,6 +12,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library
(
spdlog INTERFACE
)
option
(
SPDLOG_BUILD_EXAMPLES
"Build examples"
OFF
)
option
(
SPDLOG_BUILD_TESTS
"Build tests"
OFF
)
target_include_directories
(
spdlog
...
...
@@ -20,9 +21,15 @@ target_include_directories(
"$<INSTALL_INTERFACE:include>"
)
set
(
HEADER_BASE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
)
include
(
CTest
)
if
(
SPDLOG_BUILD_EXAMPLES
)
enable_testing
()
add_subdirectory
(
example
)
add_subdirectory
(
example
)
endif
()
if
(
SPDLOG_BUILD_TESTS
)
add_subdirectory
(
tests
)
endif
()
### Install ###
...
...
include/spdlog/sinks/stdout_sinks.h
View file @
64028851
...
...
@@ -6,6 +6,7 @@
#pragma once
#include <spdlog/details/null_mutex.h>
#include <spdlog/sinks/base_sink.h>
#include <cstdio>
#include <memory>
...
...
tests/CMakeLists.txt
0 → 100644
View file @
64028851
#
# Tests
#
enable_testing
()
# Build Catch unit tests
add_library
(
catch INTERFACE
)
target_include_directories
(
catch INTERFACE
${
CMAKE_CURRENT_SOURCE_DIR
}
)
file
(
GLOB catch_tests LIST_DIRECTORIES false RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
add_executable
(
catch_tests
${
catch_tests
}
)
target_link_libraries
(
catch_tests spdlog
)
add_test
(
NAME catch_tests COMMAND catch_tests
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
# Ensure headers include their own dependencies
add_subdirectory
(
header_dependencies
)
tests/header_dependencies/CMakeLists.txt
0 → 100644
View file @
64028851
#
# Ensure all headers include all dependencies
#
set
(
IGNORED_HEADERS
""
)
set
(
COMMON_TEST_LIBRARIES spdlog
)
add_custom_target
(
header_dependencies
)
file
(
GLOB_RECURSE headers RELATIVE
"
${
HEADER_BASE
}
"
${
HEADER_BASE
}
/*.h
)
set
(
test_index 0
)
foreach
(
HEADER
${
headers
}
)
# Sample of relevant variables computed here
# HEADER: details/line_logger_impl.h
# symbolname: spdlog_details_line_logger_impl
# Compute symbolname
string
(
REPLACE
".h"
""
symbolname
"
${
HEADER
}
"
)
string
(
MAKE_C_IDENTIFIER
"
${
symbolname
}
"
symbolname
)
list
(
FIND IGNORED_HEADERS
"
${
HEADER
}
"
_index
)
# If we didn't explicitly ignore this and if we built this target
if
(
${
_index
}
EQUAL -1
)
#message(STATUS "${HEADER}: '${symbolname}'")
set
(
extension cpp
)
# Name the test and output file with a number, to dodge Windows path length limits.
# Call it header, instead of test, to avoid polluting the 'executable namespace'
set
(
test_name
"header_
${
extension
}
_
${
test_index
}
"
)
set
(
source_file
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/main.
${
extension
}
"
)
add_executable
(
${
test_name
}
"
${
source_file
}
"
)
target_compile_definitions
(
${
test_name
}
PRIVATE HEADER_TO_TEST=
"
${
HEADER
}
"
)
target_include_directories
(
${
test_name
}
PRIVATE
${
BUILDTREE_HEADER_BASE
}
${
HEADER_BASE
}
)
set_target_properties
(
${
test_name
}
PROPERTIES
FOLDER
"Header dependency tests"
)
target_link_libraries
(
${
test_name
}
PRIVATE
${
COMMON_TEST_LIBRARIES
}
${
LIBRARIES_
${
symbolname
}}
${
LIBRARIES_
${
libname
}}
)
add_test
(
NAME
${
test_name
}
_builds COMMAND
${
test_name
}
)
add_dependencies
(
header_dependencies
${
test_name
}
)
math
(
EXPR test_index
"
${
test_index
}
+ 1"
)
endif
()
endforeach
()
tests/header_dependencies/main.c
0 → 100644
View file @
64028851
#include HEADER_TO_TEST
int
main
(
int
argc
,
char
**
argv
)
{
return
0
;
}
tests/header_dependencies/main.cpp
0 → 100644
View file @
64028851
#include HEADER_TO_TEST
int
main
(
int
argc
,
char
*
argv
[])
{
return
0
;
}
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