Skip to content

Commit

Permalink
fix build of testing with flac
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Feb 14, 2024
1 parent 318d0e7 commit 4d7b7d3
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ include_directories (
${CMAKE_BINARY_DIR}/noson/public
${CMAKE_SOURCE_DIR}/noson/src)

find_package(FLAC)
find_package(FLACXX)

###############################################################################
# add targets
add_executable (testdevice src/testdevice.cpp)
Expand All @@ -44,16 +47,20 @@ add_executable (testintrinsic src/testintrinsic.cpp)
add_dependencies (testintrinsic noson)
target_link_libraries (testintrinsic noson)

add_executable (tests16le2flac src/tests16le2flac.cpp)
add_dependencies (tests16le2flac noson)
target_link_libraries (tests16le2flac noson)

if (FLACXX_FOUND AND FLAC_FOUND)
include_directories (BEFORE SYSTEM ${FLACXX_INCLUDE_DIR})
add_executable (tests16le2flac src/tests16le2flac.cpp)
add_dependencies (tests16le2flac noson)
target_link_libraries (tests16le2flac noson)
endif ()

###############################################################################
# add unit tests
include(UnitTestProject)

unittest_project(NAME check_flac_encoder SOURCES src/check_flac_encoder.cpp TARGET noson)
if (FLACXX_FOUND AND FLAC_FOUND)
unittest_project(NAME check_flac_encoder SOURCES src/check_flac_encoder.cpp TARGET noson)
endif ()
unittest_project(NAME check_compressor SOURCES src/check_compressor.cpp TARGET noson)
unittest_project(NAME check_soap_parser SOURCES src/check_soap_parser.cpp TARGET noson)
unittest_project(NAME check_intrinsic SOURCES src/check_intrinsic.cpp TARGET noson)
26 changes: 26 additions & 0 deletions tests/cmake/FindFLAC.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Find and configure FLAC package
#
if(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES)
set(FLAC_FIND_QUIETLY true)
endif()

find_path(FLAC_INCLUDE_DIR FLAC/metadata.h)
find_library(FLAC_LIBRARIES FLAC)

if(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES)
set(FLAC_FOUND true)
if(NOT FLAC_FIND_QUIETLY)
message(STATUS "Found Flac: ${FLAC_LIBRARIES}")
endif()
else()
if(FLAC_FIND_REQUIRED)
message(FATAL_ERROR "Could not find FLAC")
endif()
if(NOT FLAC_FIND_QUIETLY)
message(STATUS "Could not find FLAC")
endif()
endif()

mark_as_advanced(FLAC_INCLUDE_DIR FLAC_LIBRARIES)

25 changes: 25 additions & 0 deletions tests/cmake/FindFLACXX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Find and configure FLACXX package
#
if(FLACXX_INCLUDE_DIR AND FLACXX_LIBRARIES)
set(FLACXX_FIND_QUIETLY true)
endif()

find_path(FLACXX_INCLUDE_DIR FLAC++/metadata.h)
find_library(FLACXX_LIBRARIES FLAC++)

if(FLACXX_INCLUDE_DIR AND FLACXX_LIBRARIES)
set(FLACXX_FOUND true)
if(NOT FLACXX_FIND_QUIETLY)
message(STATUS "Found Flac++: ${FLACXX_LIBRARIES}")
endif()
else()
if(FLACXX_FIND_REQUIRED)
message(FATAL_ERROR "Could not find FLAC++")
endif()
if(NOT FLACXX_FIND_QUIETLY)
message(STATUS "Could not find FLAC++")
endif()
endif()

mark_as_advanced(FLACXX_INCLUDE_DIR FLACXX_LIBRARIES)

0 comments on commit 4d7b7d3

Please sign in to comment.