Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
PooyaEimandar committed Feb 23, 2023
1 parent 8ba1653 commit 56f0aad
Show file tree
Hide file tree
Showing 45 changed files with 603 additions and 719 deletions.
33 changes: 33 additions & 0 deletions wolf/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Google
# This defaults to 'Auto'. Explicitly set it for a while, so that
# 'vector<vector<int> >' in existing files gets formatted to
# 'vector<vector<int>>'. ('Auto' means that clang-format will only use
# 'int>>' if the file already contains at least one such instance.)
Standard: Cpp11
SortIncludes: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BreakStringLiterals: false
DerivePointerAlignment: true
PointerAlignment: Left
ColumnLimit: 100
ForEachMacros: ['list_for_every_entry','list_for_every_entry_safe']
IncludeBlocks: Regroup
IncludeCategories:
# This specific header must come last in kernel source files. Its
# matching rule must come first so the lower-priority rules don't match.
- Regex: '^<ktl/enforce\.h>'
Priority: 1000
# C Header: <foo.h>, <net/foo.h>, etc
- Regex: '^(<((zircon/|lib/|fuchsia/|arpa/|net/|netinet/|sys/|fidl/)[a-zA-Z0-9_/\.-]+\.h|[a-zA-Z0-9_-]+\.h)>)'
Priority: 1
# Cpp Header: <foo> and <experimental/foo>
- Regex: '^(<(experimental/)*[a-zA-Z0-9_-]+>)'
Priority: 2
# Libraries: <foo/bar.h>
- Regex: '^(<[a-zA-Z0-9_/-]+\.h>)'
Priority: 3
# Local headers: "foo/bar.h"
- Regex: '^("[.a-zA-Z0-9_/-]+\.h")'
Priority: 4
63 changes: 45 additions & 18 deletions wolf/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,22 +1,52 @@
---
Checks: '*,boost-*,bugprone-*,cert-*,clang-analyzer-*,concurrency-*,cppcoreguidelines-*,modernize-*,performance-*,portability-*,readability-*,-llvmlibc-restrict-system-libc-headers,-llvmlibc-*,-fuchsia-trailing-return,-llvm-header-guard,-clang-diagnostic-pragma-once-outside-header,-modernize-use-trailing-return-type,-clang-diagnostic-c++98-compat,-hicpp-use-auto,-modernize-use-auto, -fuchsia-default-arguments-calls'
WarningsAsErrors: true
HeaderFilterRegex: ''
Checks: >
-*,
bugprone-*,
clang-diagnostic-*,
-clang-diagnostic-unused-command-line-argument,
google-*,
-google-runtime-references,
misc-*,
-misc-noexcept*,
-misc-unused-parameters,
-misc-const-correctness,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-deprecated-headers,
-modernize-raw-string-literal,
-modernize-return-braced-init-list,
-modernize-use-auto,
-modernize-use-equals-delete,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
performance-*,
readability-*,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-qualified-auto,
-readability-uppercase-literal-suffix,
-readability-identifier-length,
-readability-named-parameter,
WarningsAsErrors: false
AnalyzeTemporaryDtors: false
FormatStyle: file
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: '0'
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: bugprone-signed-char-misuse.CharTypdefsToIgnore
value: 'int8_t'
- key: bugprone-assert-side-effect.AssertMacros
value: 'FXL_DCHECK'
- key: google-readability-braces-around-statements.ShortStatementLines
value: '2'
- 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: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: modernize-loop-convert.MaxCopySize
value: '16'
Expand All @@ -28,15 +58,12 @@ CheckOptions:
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-bool-literals.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.UseAssignment
value: '1'
- key: modernize-use-emplace.IgnoreImplicitConstructors
value: '1'
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: readability-braces-around-statements.ShortStatementLines
value: '0'
...

value: '2'
...
44 changes: 9 additions & 35 deletions wolf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ set(TEST_PROJECT_NAME "${PROJECT_NAME}_tests")
message("CXX Compiler ID is ${CMAKE_CXX_COMPILER_ID}")

# set the options and enviroment variables
set(WEBRTC_SRC $ENV{WEBRTC_ROOT} CACHE STRING "path to the root folder of webrtc folder")

# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME})
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME})
#set(WEBRTC_SRC $ENV{WEBRTC_ROOT} CACHE STRING "path to the root folder of webrtc folder")

# check the OS
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Expand Down Expand Up @@ -96,11 +93,8 @@ option(WOLF_SYSTEM_SOCKET "Enable TCP/UDP protocol over socket" OFF)
option(WOLF_SYSTEM_STACKTRACE "Enable boost stacktrace" OFF)
option(WOLF_SYSTEM_POSTGRESQL "Enable postgresql database client" OFF)

#option(WOLF_SYSTEM_WASM3 "Enable WebAssembly interpreter" OFF)
#option(WOLF_SYSTEM_ZLIB "Enable zlib for compression" OFF)

# machine learing modules
option(WOLF_ML_OCR "Enable machine learning referee ocr" ON)
option(WOLF_ML_OCR "Enable machine learning referee ocr" OFF)
option(WOLF_ML_NUDITY_DETECTION "Enable machine learning nudity detection" OFF)

#option(WOLF_ENABLE_LTO "Enable cross language linking time optimization" OFF)
Expand All @@ -121,36 +115,17 @@ if(ENABLE_LTO)
endif()
endif()

# media modules
#
# option(WOLF_MEDIA_IMAGE "Enable WebP/BMP/JPG/PNG formats" OFF)
#

# stream modules
# option(WOLF_STREAM_KAFKA_CLIENT "Enable Kafka API connector" OFF)

# option(WOLF_STREAM_RTSP_CLIENT "Enable RTSP for client" OFF)
# option(WOLF_STREAM_RTSP_SERVER "Enable RTSP for server" OFF)
#option(WOLF_STREAM_WEBRTC "Enable native webRTC" OFF)

# system modules
# option(WOLF_SYSTEM_AVX2 "Enable avx2" OFF)
# option(WOLF_SYSTEM_AVX512 "Enable avx512" OFF)
# option(WOLF_SYSTEM_BROTLI "Enable brotli compression" OFF)
# option(WOLF_SYSTEM_RAFT "Enable raft algorithm" OFF)

# set C/CXX ios standards
# set C/CXX standards
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)

#set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
#set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
endif()
#set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")

# set C++ flags based on compiler
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
Expand Down Expand Up @@ -190,11 +165,12 @@ endif()
# include cmakes
include(cmake/boost.cmake)
include(cmake/media.cmake)
include(cmake/rust.cmake)
include(cmake/system.cmake)
include(cmake/stream.cmake)
include(cmake/ml.cmake)

# disable build testing
set(BUILD_TESTING OFF CACHE BOOL "BUILD_TESTING")

if (WOLF_ENABLE_ASAN)
set(ENABLE_ASAN TRUE)
Expand All @@ -208,9 +184,9 @@ endif()
# https://devblogs.microsoft.com/cppblog/visual-studio-code-c-december-2021-update-clang-tidy/
# can be enabled with .CLANG-TIDY from Visual Studio
# https://devblogs.microsoft.com/cppblog/code-analysis-with-clang-tidy-in-visual-studio/
#set(CMAKE_CXX_CLANG_TIDY
# clang-tidy;
# -format-style=file;)
set(CMAKE_CXX_CLANG_TIDY
clang-tidy;
-format-style=file;)

# add definitions

Expand Down Expand Up @@ -311,8 +287,6 @@ source_group("media/ffmpeg" FILES ${WOLF_MEDIA_FFMPEG_SRC})
source_group("media" FILES ${WOLF_MEDIA_OPENAL_SRC} ${WOLF_MEDIA_STB_SRC})
source_group("ml/referee_ocr" FILES ${WOLF_ML_OCR_SRC})

# file(COPY ${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE} DESTINATION ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE})

# add compile options
if (NOT WIN32)
target_compile_options(${PROJECT_NAME} PRIVATE -std=c++2b -fPIC)
Expand Down
1 change: 0 additions & 1 deletion wolf/DISABLE_ANALYSIS_BEGIN
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// NOLINTBEGIN
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning (disable:ALL_CODE_ANALYSIS_WARNINGS)
Expand Down
4 changes: 2 additions & 2 deletions wolf/DISABLE_ANALYSIS_END
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// NOLINTEND
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
// NOLINTEND
22 changes: 0 additions & 22 deletions wolf/cmake/rust.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions wolf/cmake/stream.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ if (WOLF_STREAM_GRPC)
GIT_TAG master
)

set(ABSL_BUILD_TESTING OFF CACHE BOOL "BUILD_TESTING")
set(BUILD_TESTING OFF CACHE BOOL "BUILD_TESTING")
set(ABSL_BUILD_TESTING OFF CACHE BOOL "ABSL_BUILD_TESTING")

set(gRPC_BUILD_CSHARP_EXT OFF CACHE BOOL "GRPC_BUILD_CSHARP_EXT")
set(gRPC_BUILD_GRPC_CPP_PLUGIN ON CACHE BOOL "gRPC_BUILD_GRPC_CPP_PLUGIN")
Expand Down
Loading

0 comments on commit 56f0aad

Please sign in to comment.