Commit 5d95b7bf authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/main-pc' into 1314-basop-port-mr1273

parents c505de67 e93e1892
Loading
Loading
Loading
Loading
Loading
+703 −121

File changed.

Preview size limit exceeded, changes collapsed.

+0 −2
Original line number Diff line number Diff line
@@ -2,7 +2,5 @@

<!--- Remember to add issue and MR links to the status page in wiki here https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/wikis/IVAS-PC-MR-conversion-status -->
- Original merge request in float repo:
- Branch for float ref update:
- Branch for BASOP update:

/label ~Type:FloatUpdatePorting ~Status::ToDo
+1 −1
Original line number Diff line number Diff line

- Link to issue in BASOP repo:
- Link to original issue in float repo:
- Link to original MR in float repo:
- Requested reviewers:

/label Type:FloatUpdatePorting

CMakeLists.txt

0 → 100644
+221 −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.1)

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")
  # 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)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # make Visual Studio projects look nicer
include(CTest)

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_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_com)
target_include_directories(lib_debug PUBLIC lib_debug PRIVATE 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_com lib_debug)
target_include_directories(lib_enc PUBLIC lib_enc PRIVATE 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_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_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_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_rend lib_debug lib_isar)
target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE 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_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_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_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_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)
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_isar lib_util)
target_include_directories(ISAR_post_rend PRIVATE lib_isar)

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_com lib_util ARCHIVE DESTINATION lib)
+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
Loading