Skip to content

Commit

Permalink
switched libsamplerate lib integration to git submodule and disabled …
Browse files Browse the repository at this point in the history
…libsamplerate ctests
  • Loading branch information
vackva committed Sep 16, 2024
1 parent cc8a3c3 commit bbb24c0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake-build*
CMakeFiles/*
modules/*
!modules/RnboExport/
!modules/onnxruntime/
modules/RnboExport/
modules/onnxruntime/
modules/onnxruntime-1.14.1-win-x86_64_Debug
Builds
BinaryData.h
BinaryData*.cpp
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
shallow = true


[submodule "modules/libsamplerate"]
path = modules/libsamplerate
url = https://github.com/libsndfile/libsamplerate.git
40 changes: 3 additions & 37 deletions cmake/setup_libsamplerate.cmake
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
cmake_minimum_required(VERSION 3.15)
set(LIBSAMPLERATE_TESTS OFF CACHE BOOL "Disable deprecated LIBSAMPLERATE_TESTS option" FORCE)

# Use cmake -DCMAKE_BUILD_TYPE=Release .. to make a release build.

set(BUILD_TESTING OFF)
# disabled build testing for now, to avoid having to integrate libsndfile and FFTW libraries
# more information here: https://github.com/libsndfile/libsamplerate/blob/master/docs/win32.md
set(LIBSAMPLERATE_INSTALL OFF)
set(LIBSAMPLERATE_EXAMPLES OFF)
# libsamplerate itself does not require any dependencies,
# but if you want to build examples and tests, you will need the libsndfile and FFTW libraries
# Find dependencies (e.g., libsndfile if used)
# find_package(SndFile REQUIRED)

# Define the library name (as defined in libsamplerate's CMakeLists.txt)
set(LIBSAMPLERATE_LIB "samplerate")

# Check for 32-bit build on Windows
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
message(WARNING "You are trying to compile the project for a 32-bit (Win32) system. This might not work as expected. Please check https://github.com/libsndfile/libsamplerate/blob/master/docs/win32.md")
endif()

# Download libsamplerate from a remote repository
include(FetchContent)
FetchContent_Declare(
libsamplerate
GIT_REPOSITORY https://github.com/libsndfile/libsamplerate.git
GIT_TAG 0.2.2 # The version of libsamplerate you wish to use
)
FetchContent_MakeAvailable(libsamplerate)

if(NOT TARGET ${LIBSAMPLERATE_LIB})
message(FATAL_ERROR "Failed to build or find libsamplerate")
endif()


# Used in main CMakeLists.txt to link the target
target_link_libraries(${TARGET_NAME} PRIVATE ${LIBSAMPLERATE_LIB})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/modules/libsamplerate)

target_link_libraries(${TARGET_NAME} PRIVATE samplerate)
1 change: 1 addition & 0 deletions modules/libsamplerate
Submodule libsamplerate added at 4858fb

0 comments on commit bbb24c0

Please sign in to comment.