Skip to content

Commit

Permalink
Merge branch 'main' into reorganize-BE-v1.0
Browse files Browse the repository at this point in the history
*Task: Merge all the changes
  • Loading branch information
prakash-2002-ramanathan committed Oct 23, 2024
2 parents 24f1799 + 621b6a3 commit 7b8057b
Show file tree
Hide file tree
Showing 29 changed files with 973 additions and 193 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/build-mediaprocessor.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/build_test_and_format_core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build, Test and Format Core

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y ffmpeg cmake nlohmann-json3-dev libsndfile1-dev g++
- name: Build with Tests Enabled
run: |
mkdir -p build
cd build
cmake -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release ../MediaProcessor
make -j$(nproc)
- name: Run Tests
run: |
cd build
ctest --output-on-failure
format:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Dependencies
run: sudo apt update && sudo apt install -y clang-format

- name: Run clang-format Check on MediaProcessor
run: |
find MediaProcessor/src -regex '.*\.\(cpp\|h\)' -exec clang-format --dry-run --Werror {} +
- name: Display Message if Formatting Fails
if: failure()
run: echo "Code formatting issues found in MediaProcessor. Please run clang-format to fix them."
28 changes: 0 additions & 28 deletions .github/workflows/clang-format_check.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Formatting Check
name: Backend Formatter

on:
push:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# VSCode
.vscode/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
30 changes: 12 additions & 18 deletions MediaProcessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,25 @@ endif()

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")

include_directories(include)
include_directories(${CMAKE_SOURCE_DIR}/third_party/nlohmann)

add_executable(MediaProcessor
src/main.cpp
src/ConfigManager.cpp
src/AudioProcessor.cpp
src/VideoProcessor.cpp
src/Utils.cpp
src/CommandBuilder.cpp
src/HardwareUtils.cpp
src/FFmpegSettingsManager.cpp
)
# Tests are excluded by default, use `cmake -DBUILD_TESTING=ON` to build with tests.
option(BUILD_TESTING "Test Build" OFF)

# Set include directories
include(CTest)
include_directories(${CMAKE_SOURCE_DIR}/include)

# Threads is required
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(MediaProcessor PRIVATE Threads::Threads)

# Link the DeepFilter library
target_link_libraries(MediaProcessor PRIVATE ${CMAKE_SOURCE_DIR}/lib/libdf.so)

# SNDFILE: for read/write of sampled audio files
# https://github.com/libsndfile/libsndfile
find_package(PkgConfig REQUIRED)
pkg_check_modules(SNDFILE REQUIRED sndfile)
include_directories(${SNDFILE_INCLUDE_DIRS})
target_link_libraries(MediaProcessor PRIVATE ${SNDFILE_LIBRARIES})

# Include the cmake files under cmake/
include(cmake/src.cmake)
if(BUILD_TESTING)
include(cmake/test.cmake)
endif()
21 changes: 21 additions & 0 deletions MediaProcessor/cmake/src.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CMake configuration for building the main MediaProcessor executable

add_executable(MediaProcessor
${CMAKE_SOURCE_DIR}/src/main.cpp
${CMAKE_SOURCE_DIR}/src/ConfigManager.cpp
${CMAKE_SOURCE_DIR}/src/AudioProcessor.cpp
${CMAKE_SOURCE_DIR}/src/VideoProcessor.cpp
${CMAKE_SOURCE_DIR}/src/Utils.cpp
${CMAKE_SOURCE_DIR}/src/CommandBuilder.cpp
${CMAKE_SOURCE_DIR}/src/HardwareUtils.cpp
${CMAKE_SOURCE_DIR}/src/FFmpegSettingsManager.cpp
${CMAKE_SOURCE_DIR}/src/DeepFilterCommandBuilder.cpp
)

target_link_libraries(MediaProcessor PRIVATE Threads::Threads)
target_link_libraries(MediaProcessor PRIVATE ${CMAKE_SOURCE_DIR}/lib/libdf.so)
target_link_libraries(MediaProcessor PRIVATE ${SNDFILE_LIBRARIES})

set_target_properties(MediaProcessor PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
71 changes: 71 additions & 0 deletions MediaProcessor/cmake/test.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
include(FetchContent)
cmake_policy(SET CMP0135 NEW) # Use the latest policy for FetchContent consistency

find_package(GTest QUIET)
if(NOT GTEST_FOUND)
# Fetch GTest if not found
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
endif()

# Setup test media directory
set(TEST_MEDIA_DIR "${CMAKE_SOURCE_DIR}/tests/TestMedia" CACHE PATH "Path to test media files")

# Common libraries for all test targets
set(COMMON_LIBRARIES gtest_main ${CMAKE_SOURCE_DIR}/lib/libdf.so ${SNDFILE_LIBRARIES})

# Macro for adding a test executable
macro(add_test_executable name)
add_executable(${name} ${ARGN})
target_compile_definitions(${name} PRIVATE TEST_MEDIA_DIR="${TEST_MEDIA_DIR}")
target_link_libraries(${name} PRIVATE ${COMMON_LIBRARIES})
add_test(NAME ${name} COMMAND ${name})
endmacro()

# Add test executables using the macro
add_test_executable(ConfigManagerTester
${CMAKE_SOURCE_DIR}/tests/ConfigManagerTester.cpp
${CMAKE_SOURCE_DIR}/src/ConfigManager.cpp
${CMAKE_SOURCE_DIR}/src/CommandBuilder.cpp
${CMAKE_SOURCE_DIR}/src/HardwareUtils.cpp
${CMAKE_SOURCE_DIR}/src/Utils.cpp
${CMAKE_SOURCE_DIR}/tests/TestUtils.cpp
)

add_test_executable(UtilsTester
${CMAKE_SOURCE_DIR}/tests/UtilsTester.cpp
${CMAKE_SOURCE_DIR}/src/Utils.cpp
${CMAKE_SOURCE_DIR}/src/CommandBuilder.cpp
)

add_test_executable(AudioProcessorTester
${CMAKE_SOURCE_DIR}/tests/AudioProcessorTester.cpp
${CMAKE_SOURCE_DIR}/src/AudioProcessor.cpp
${CMAKE_SOURCE_DIR}/src/CommandBuilder.cpp
${CMAKE_SOURCE_DIR}/src/Utils.cpp
${CMAKE_SOURCE_DIR}/src/HardwareUtils.cpp
${CMAKE_SOURCE_DIR}/src/ConfigManager.cpp
${CMAKE_SOURCE_DIR}/tests/TestUtils.cpp
)

add_test_executable(VideoProcessorTester
${CMAKE_SOURCE_DIR}/tests/VideoProcessorTester.cpp
${CMAKE_SOURCE_DIR}/src/VideoProcessor.cpp
${CMAKE_SOURCE_DIR}/src/CommandBuilder.cpp
${CMAKE_SOURCE_DIR}/src/Utils.cpp
${CMAKE_SOURCE_DIR}/src/ConfigManager.cpp
${CMAKE_SOURCE_DIR}/src/HardwareUtils.cpp
${CMAKE_SOURCE_DIR}/tests/TestUtils.cpp
)

add_test_executable(CommandBuilderTester
${CMAKE_SOURCE_DIR}/tests/CommandBuilderTester.cpp
${CMAKE_SOURCE_DIR}/src/CommandBuilder.cpp
${CMAKE_SOURCE_DIR}/src/Utils.cpp
)

Loading

0 comments on commit 7b8057b

Please sign in to comment.