Commit bce6e1fb authored by multrus's avatar multrus
Browse files

merge from main

parents 79cc0ba4 c686cdd1
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+86 −0
Original line number Diff line number Diff line
# .gitignore for IVAS public collaboration Git repository

# Compiler output Unix
IVAS_cod
IVAS_dec
IVAS_rend
ISAR_post_rend
ambi_converter
obj/
*.a
*.o
*.P

# default CMake
build*/**/*

# Compiler output VS2017
IVAS_cod.exe
IVAS_dec.exe
IVAS_rend.exe
ISAR_post_rend.exe
ambi_converter.exe
*.user
.vs/
Debug_*/
Release_*/
*.obj
*.pdb

# Standalone TD object renderer
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone.exe

# General/scripts
.DS_Store
.vscode
.cache
.idea
*.log
*.bak
.\#*
scripts/c-code_instrument/
scripts/ifdef_instrument.list
scripts/ref/
scripts/test/
scripts/out/
scripts/self_test_summary.txt
scripts/cppp/
binary/
tests/**/[c|d]ut
tests/**/ref
tests/*/testv
tests/hrtf_binary_loading/bitstream/*
tests/hrtf_binary_loading/dec_out_*/*
scripts/testv/*_cut*.pcm
scripts/testv/*_cut*.wav
scripts/testv/stvOMASA_*.met
scripts/testv/stvOMASA_*.csv
scripts/testv/stvOMASA_2ISM_1MASA1TC48c.wav
scripts/testv/stvOMASA_3ISM_1MASA1TC48c.wav
scripts/testv/stvO*
# default reference binary name
IVAS_cod_ref*
IVAS_dec_ref*
IVAS_rend_ref*
ISAR_post_rend_ref*

# Python files that pop up when running scripts
__pycache__/
*.py[cod]
*$py.class

# history
.history/

#externals
Externals/

# coan output files that are created when cleaning out switches
coan_out_*

# Additional ignored locations for the BASOP repo
/ci
/scripts
/tests
/pytest.ini
+10 −2140

File changed.

Preview size limit exceeded, changes collapsed.

+53 −0
Original line number Diff line number Diff line
# overwrites the default rules in the IVAS CI repository
# should be refactored and unified
.rules-basis:
  rules:
    # see https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
      when: never
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
      variables:
        IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME'
    ### disabled for now because pipeline cd is redundant with MR pipeline with current workflow
    # - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main
    #   variables:
    #     IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'default' # for testing
      variables:
        IVAS_PIPELINE_NAME: 'Web run pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare'
      variables:
        IVAS_PIPELINE_NAME: 'Run comparison tools against float ref: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare-enc-dmx'
      variables:
        IVAS_PIPELINE_NAME: 'Run encoder dmx comparison against float ref: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare-long'
      variables:
        IVAS_PIPELINE_NAME: 'Run comparison tools against float ref (long test vectors): $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare-to-input'
      variables:
        IVAS_PIPELINE_NAME: 'Run comparison tools against input (pass-through only): $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-saturation-smoke-test'
      variables:
        IVAS_PIPELINE_NAME: 'Run saturation smoke-test: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'evs-26444'
      variables:
        IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'sanitizer'
      variables:
        IVAS_PIPELINE_NAME: 'Short testvectors sanitizers'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-renderer'
      variables:
        IVAS_PIPELINE_NAME: 'Renderer test: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'complexity'
      variables:
        IVAS_PIPELINE_NAME: 'Complexity Measurement on $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'voip-be-test'
      variables:
        IVAS_PIPELINE_NAME: 'Voip BE test on $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'peaq-enc-passthrough'
      variables:
        IVAS_PIPELINE_NAME: 'PEAQ encoder pass-through test: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch
      variables:
        IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH'
+107 −0
Original line number Diff line number Diff line
variables:
  TESTV_DIR: "/usr/local/testv"
  LTV_DIR: "/usr/local/ltv"
  EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop"
  # TODO: cleanup and use global var defined in ivas-codec-ci
  FLOAT_REF_BRANCH: "ivas-float-update"
  FLOAT_REF_BRANCH_MERGE_SOURCE: ""
  BUILD_OUTPUT: "build_output.txt"
  SCRIPTS_DIR: "/usr/local/scripts"
  EXIT_CODE_NON_BE: 123
  EXIT_CODE_FAIL: 1
  LONG_TEST_SUITE: "tests/codec_be_on_mr_nonselection tests/renderer --param_file scripts/config/self_test_ltv.prm --use_ltv"
  LONG_TEST_SUITE_NO_RENDERER: "tests/codec_be_on_mr_nonselection --param_file scripts/config/self_test_ltv.prm --use_ltv"
  SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection"
  SHORT_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_basop_encoder.prm"
  LONG_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_ltv_basop_encoder.prm"
  TEST_SUITE: ""
  # These path variables are used by the pytest calls.
  # They can be overwritten in the job templates to e.g. only test encoder or decoder in the chain
  DUT_ENCODER_PATH: "./IVAS_cod_dut"
  DUT_DECODER_PATH: "./IVAS_dec_dut"
  DUT_RENDERER_PATH: "./IVAS_rend_dut"
  DUT_POST_RENDERER_PATH: "./ISAR_post_rend_dut"
  REF_ENCODER_PATH: "./IVAS_cod_ref"
  REF_DECODER_PATH: "./IVAS_dec_ref"
  REF_RENDERER_PATH: "./IVAS_rend_ref"
  REF_POST_RENDERER_PATH: "./ISAR_post_rend_ref"
  MERGE_TARGET_ENCODER_PATH: "./IVAS_cod_merge_target"
  MERGE_TARGET_DECODER_PATH: "./IVAS_dec_merge_target"
  MERGE_TARGET_RENDERER_PATH: "./IVAS_rend_merge_target"
  MERGE_TARGET_POST_RENDERER_PATH: "./ISAR_post_rend_merge_target"
  MERGE_SOURCE_FLOAT_REF_ENCODER_PATH: "./IVAS_cod_merge_source_float_ref"
  MERGE_SOURCE_FLOAT_REF_DECODER_PATH: "./IVAS_dec_merge_source_float_ref"
  MERGE_SOURCE_FLOAT_REF_RENDERER_PATH: "./IVAS_rend_merge_source_float_ref"
  MERGE_SOURCE_FLOAT_REF_POST_RENDERER_PATH: "./ISAR_post_rend_merge_source_float_ref"
  # These path variables are used for building the binaries
  # They should never be overwritten!
  DUT_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_dut"
  DUT_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_dut"
  DUT_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_rend_dut"
  DUT_POST_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./ISAR_post_rend_dut"
  REF_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_ref"
  REF_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_ref"
  REF_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_rend_ref"
  REF_POST_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./ISAR_post_rend_ref"
  MERGE_TARGET_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_merge_target"
  MERGE_TARGET_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_merge_target"
  MERGE_TARGET_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_rend_merge_target"
  MERGE_TARGET_POST_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./ISAR_post_rend_merge_target"
  MERGE_SOURCE_FLOAT_REF_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_merge_source_float_ref"
  MERGE_SOURCE_FLOAT_REF_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_merge_source_float_ref"
  MERGE_SOURCE_FLOAT_REF_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_rend_merge_source_float_ref"
  MERGE_SOURCE_FLOAT_REF_POST_RENDERER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./ISAR_post_rend_merge_source_float_ref"
  LEVEL_SCALING: "1.0"
  IVAS_PIPELINE_NAME: ''
  PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm"
  TESTCASE_TIMEOUT_STV: 900
  TESTCASE_TIMEOUT_LTV: 2400
  TESTCASE_TIMEOUT_LTV_SANITIZERS: 10800
  CI_REGRESSION_THRESH_MLD: "0.1"
  CI_REGRESSION_THRESH_MAX_ABS_DIFF: "50"
  CI_REGRESSION_THRESH_SSNR: "-1"
  CI_REGRESSION_THRESH_ODG: "-0.05"
  GIT_CLEAN_FLAGS: -ffdxq
  INSTR_DIR: "scripts/c-code_instrument"
  TESTS_DIR_CODEC_BE_ON_MR: "tests/codec_be_on_mr_nonselection"
  BUILD_WITH_DEBUG_MODE_INFO: ""
  ENCODER_TEST: ""
  DELTA_ODG: ""
  COMPARE_DMX: ""
  SPLIT_COMPARISON: ""
  SKIP_REGRESSION_CHECK: ""
  FAILED_TESTCASES_LIST: "failed-testcases.txt"
  ERRORS_TESTCASES_LIST: "errors-testcases.txt"
  PYTEST_CACHE_ARTIFACT: "pytest_cache.zip"
  MEASURES_FOR_REPORT: "MLD MAX_ABS_DIFF MIN_SSNR MIN_ODG"
  FLOAT_REF_COMMIT_FILE: "float-ref-git-sha.txt"
  CUT_COMMIT_FILE: "CuT-git-sha.txt"
  MERGE_TARGET_COMMIT_FILE: "merge-target-git-sha.txt"
  MERGE_SOURCE_FLOAT_REF_COMMIT_FILE: "merge-source-float-ref-git-sha.txt"
  RUNNER_TAG: "ivas-basop-linux"
  LOGS_BACKUP_SOURCE_DIR: ""
  LOGS_BACKUP_TARGET_DIR: ""
  # set this to true to skip the external HRTF testcases in pytest calls
  DISABLE_HRTF: "false"
  MANUAL_PIPELINE_TYPE:
    description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec."
    value: 'default'
    options:
      - 'default'
      - 'pytest-compare'
      - 'pytest-compare-enc-dmx'
      - 'pytest-compare-long'
      - 'pytest-compare-long-fx-fx'
      - 'pytest-compare-to-input'
      - 'pytest-saturation-smoke-test'
      - 'evs-26444'
      - 'sanitizer'
      - 'pytest-renderer'
      - 'complexity'
      - 'coverage'
      - 'voip-be-test'
      - 'renderer-framesize-be'
      - 'peaq-enc-passthrough'
      - 'long-term-logs'
      - 'backup-long-term-logs'
      - 'test-long-self-test'

CMakeLists.txt

0 → 100644
+237 −0
Original line number Diff line number Diff line
# CMake file for IVAS
#
# Usage with Unix Makefiles (Linux, OS/X):
#   # create build directory
#   mkdir build ; cd build
#   # call CMake to generate build system, e.g. one of the following:
#   cmake -D CMAKE_BUILD_TYPE=Debug ../
#   cmake -D CMAKE_BUILD_TYPE=Release ../
#   cmake -D CMAKE_BUILD_TYPE=Debug -D TARGET_PLATFORM=x86_64 ../
#   # build project
#   make -j8
#
# Usage with Visual Studio
#   1) download CMake from https://cmake.org/download/, don't use the Cygwin version!
#   2.1) build project using IDE
#        In CMake GUI select the source dir (root of stereo-evs) and a new binary directory
#        and press "Configure" and "Generate". Then open the Visual Studio solution file generated
#        in the build directory.
#   2.2) build project using command line
#        # create build directory
#        mkdir build ; cd build
#        # call CMake to generate build system, e.g. one of the following:
#        cmake ../
#        cmake -G "Visual Studio 12 2013" ../
#        cmake -G "Visual Studio 12 2013 Win64" ../
#        # open the Visual Studio solution file generated in the build directory
#        # or build on command line, e.g.:
#        cmake --build . --config Debug
#        cmake --build . --config Release


cmake_minimum_required(VERSION 3.10)

set(CMAKE_C_STANDARD 99)

# configuration options for UNIX
if(UNIX)
  set(TARGET_PLATFORM ""  CACHE STRING "i686 / x86_64")
  set(CLANG           ""  CACHE STRING "1=msan / 2=asan / 3=usan")
  set(GCOV            OFF CACHE BOOL   "enable GCOV")
  set(STRIP           OFF CACHE BOOL   "enable STRIP")

  if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "")
  endif()
  # TARGET_PLATFORM
  if("${TARGET_PLATFORM}" MATCHES "i386" OR
     "${TARGET_PLATFORM}" MATCHES "i586" OR
     "${TARGET_PLATFORM}" MATCHES "i686"
  )
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
  elseif("${TARGET_PLATFORM}" MATCHES "x86_64")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
  endif()
  # C compiler flags
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffp-contract=off")  # disable floating point operation contraction
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-implicit-fallthrough")
  # to be uncommented in CI
  # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")

  # CLANG
  if(CLANG)
    find_program(clangBin NAMES /home/amm-archiv/soft/Linux/clang/current/bin/clang clang REQUIRED)
    set(CMAKE_C_COMPILER "${clangBin}" CACHE STRING "")
    if("${CLANG}" MATCHES "1" OR "${CLANG}" MATCHES "msan")
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory")
      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory")
    elseif("${CLANG}" MATCHES "2" OR "${CLANG}" MATCHES "asan")
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
    elseif("${CLANG}" MATCHES "3" OR "${CLANG}" MATCHES "usan")
      # NOTE: keep in sync with list in Makefile
      set(USAN_CHECKS_ENABLE
        undefined # Default checks
        # Extra checks
        float-divide-by-zero
        implicit-conversion
        local-bounds
      )
      list(JOIN USAN_CHECKS_ENABLE "," USAN_CHECKS_ENABLE)

      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${USAN_CHECKS_ENABLE} -fsanitize-recover=${USAN_CHECKS_ENABLE}")
      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${USAN_CHECKS_ENABLE} -fsanitize-recover=${USAN_CHECKS_ENABLE}")
    else()
      message(FATAL_ERROR "Unknown CLANG setting: ${CLANG}")
    endif()
  endif()
  # GCOV
  if(GCOV)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage -fprofile-update=atomic")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -fprofile-update=atomic")
  endif()
  # STRIP
  if(STRIP)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -ffunction-sections")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-gc-sections -static")
  endif()

  message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
  message("CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
  # write settings in CMake cache
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "")
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "")
  set(CMAKE_C_FLAGS_DEBUG   "-O0 -g3" CACHE STRING "")
  set(CMAKE_C_FLAGS_RELEASE "-O2 -DRELEASE" CACHE STRING "") # TODO should contain -DNDEBUG to disable assert()
elseif(WIN32)
  # MSVC compiler flags
  add_definitions(
    -D_CRT_SECURE_NO_WARNINGS
    /MP
  )
endif()

# configuration options for all platforms
set(WMOPS OFF CACHE BOOL "enable WMOPS")
if(WMOPS)
  add_definitions("-DWMOPS=1")
endif()

project(stereo-evs LANGUAGES C)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # make Visual Studio projects look nicer
include(CTest)

file(GLOB libBasopSrcs "lib_basop/*.c")
file(GLOB libBasopHeaders "lib_basop/*.h")
add_library(lib_basop ${libBasopSrcs} ${libBasopHeaders})
if(UNIX)
  target_link_libraries(lib_basop PRIVATE m)
endif()
target_include_directories(lib_basop PUBLIC lib_basop PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug lib_isar)
target_include_directories(lib_basop PRIVATE lib_lc3plus)

file(GLOB libComSrcs "lib_com/*.c")
file(GLOB libComHeaders "lib_com/*.h")
add_library(lib_com ${libComSrcs} ${libComHeaders})
if(UNIX)
  target_link_libraries(lib_com PRIVATE m)
endif()
target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_basop lib_enc lib_dec lib_rend lib_debug lib_isar)
target_include_directories(lib_com PRIVATE lib_lc3plus)

file(GLOB libDebugSrcs "lib_debug/*.c")
file(GLOB libDebugHeaders "lib_debug/*.h")
add_library(lib_debug ${libDebugSrcs} ${libDebugHeaders})
target_link_libraries(lib_debug lib_basop lib_com)
target_include_directories(lib_debug PUBLIC lib_debug PRIVATE lib_basop lib_enc lib_dec lib_rend lib_isar)

file(GLOB libEncSrcs "lib_enc/*.c")
file(GLOB libEncHeaders "lib_enc/*.h")
add_library(lib_enc ${libEncSrcs} ${libEncHeaders})
target_link_libraries(lib_enc lib_basop lib_com lib_debug)
target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_basop lib_dec lib_rend lib_isar)
target_include_directories(lib_enc PRIVATE lib_lc3plus)

file(GLOB libLC3plusSrcs "lib_lc3plus/*.c")
file(GLOB libLC3plusHeaders "lib_lc3plus/*.h")
add_library(lib_lc3plus ${libLC3plusSrcs} ${libLC3plusHeaders})
target_include_directories(lib_lc3plus PUBLIC lib_lc3plus PRIVATE lib_basop lib_com lib_debug)

file(GLOB libRendSrcs "lib_rend/*.c")
file(GLOB libRendHeaders "lib_rend/*.h")

add_library(lib_rend ${libRendSrcs} ${libRendHeaders})
target_link_libraries(lib_rend lib_dec lib_basop lib_com lib_debug) # Todo refactor: This dependency on lib_dec should be removed.
target_link_libraries(lib_rend lib_lc3plus lib_isar)
target_include_directories(lib_rend PUBLIC lib_rend PRIVATE lib_basop lib_enc lib_isar)


file(GLOB libDecSrcs "lib_dec/*.c")
file(GLOB libDecHeaders "lib_dec/*.h")
add_library(lib_dec ${libDecSrcs} ${libDecHeaders})
target_link_libraries(lib_dec lib_com lib_basop lib_rend lib_debug lib_isar)
target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_basop lib_enc lib_isar)

file(GLOB libUtilSrcs "lib_util/*.c")
file(GLOB libUtilHeaders "lib_util/*.h")
add_library(lib_util ${libUtilSrcs} ${libUtilHeaders})
target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_basop lib_com lib_enc lib_dec lib_rend lib_debug)
target_include_directories(lib_util PRIVATE lib_lc3plus lib_isar)

if(NOT WMOPS)
  add_executable(ivas_lc3plus_unit_test ${CMAKE_SOURCE_DIR}/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c)
  target_link_libraries(ivas_lc3plus_unit_test lib_rend lib_dec lib_util lib_com lib_basop lib_debug lib_isar)
endif()

file(GLOB libISARSrcs "lib_isar/*.c")
file(GLOB libISARHeaders "lib_isar/*.h")

add_library(lib_isar ${libISARSrcs} ${libISARHeaders})
target_link_libraries(lib_isar lib_basop lib_com lib_debug lib_lc3plus) # Todo refactor: This dependency on lib_dec should be removed.
target_include_directories(lib_isar PUBLIC lib_isar PRIVATE lib_basop lib_enc lib_dec lib_rend)


add_executable(IVAS_cod apps/encoder.c)
target_link_libraries(IVAS_cod lib_enc lib_util)
if(WIN32)
  target_link_libraries(IVAS_cod Ws2_32)
endif()

add_executable(IVAS_dec apps/decoder.c)
target_link_libraries(IVAS_dec lib_dec lib_util)
if(WIN32)
  target_link_libraries(IVAS_dec Ws2_32)
endif()

add_executable(IVAS_rend apps/renderer.c)
target_link_libraries(IVAS_rend lib_rend lib_util lib_isar lib_com)
target_include_directories(IVAS_rend PRIVATE lib_enc)

add_executable(ISAR_post_rend apps/isar_post_rend.c)
target_link_libraries(ISAR_post_rend lib_basop lib_isar lib_util lib_com)
target_include_directories(ISAR_post_rend PRIVATE lib_basop lib_isar)

add_executable(ambi_converter apps/ambi_converter.c)
target_link_libraries(ambi_converter lib_util lib_com lib_basop lib_debug)
if(UNIX)
  target_link_libraries(ambi_converter m)
endif()
target_include_directories(ambi_converter PRIVATE lib_basop lib_util lib_com lib_debug)

if(COPY_EXECUTABLES_FROM_BUILD_DIR)
  # Optionally copy executables to the same place where Make puts them (useful for tests that expect executables in specific places)
  add_custom_command(TARGET IVAS_cod POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_cod>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET IVAS_dec POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_dec>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET IVAS_rend POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_rend>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET ISAR_post_rend POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:ISAR_post_rend>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  if (NOT WMOPS)
    add_custom_command(TARGET ivas_lc3plus_unit_test POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:ivas_lc3plus_unit_test>" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/split_rendering/lc3plus_basop")
  endif()
endif()

# Allow creating packages for CMake install
install(TARGETS lib_enc lib_dec lib_rend lib_basop lib_com lib_util ARCHIVE DESTINATION lib)
Loading