You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
2.1 KiB
56 lines
2.1 KiB
3 years ago
|
include(FetchContent)
|
||
|
|
||
3 years ago
|
# https://github.com/pongasoft/vst-sam-spl-64/blob/master/libsndfile.cmake
|
||
|
# https://github.com/popojan/goban/blob/master/CMakeLists.txt#L38
|
||
|
# https://github.com/ddiakopoulos/libnyquist/blob/master/CMakeLists.txt
|
||
|
|
||
|
if(LIBSNDFILE_ROOT_DIR)
|
||
|
# instructs FetchContent to not download or update but use the location instead
|
||
|
set(FETCHCONTENT_SOURCE_DIR_LIBSNDFILE ${LIBSNDFILE_ROOT_DIR})
|
||
|
else()
|
||
|
set(FETCHCONTENT_SOURCE_DIR_LIBSNDFILE "")
|
||
|
endif()
|
||
3 years ago
|
|
||
3 years ago
|
set(LIBSNDFILE_GIT_REPO "https://github.com/libsndfile/libsndfile.git" CACHE STRING "libsndfile git repository url" FORCE)
|
||
|
set(LIBSNDFILE_GIT_TAG 1.0.31 CACHE STRING "libsndfile git tag" FORCE)
|
||
3 years ago
|
|
||
|
FetchContent_Declare(libsndfile
|
||
|
GIT_REPOSITORY ${LIBSNDFILE_GIT_REPO}
|
||
|
GIT_TAG ${LIBSNDFILE_GIT_TAG}
|
||
3 years ago
|
GIT_CONFIG advice.detachedHead=false
|
||
|
# GIT_SHALLOW true
|
||
|
CONFIGURE_COMMAND ""
|
||
3 years ago
|
BUILD_COMMAND ""
|
||
|
INSTALL_COMMAND ""
|
||
|
TEST_COMMAND ""
|
||
|
)
|
||
|
|
||
3 years ago
|
FetchContent_GetProperties(libsndfile)
|
||
|
if(NOT libsndfile_POPULATED)
|
||
|
if(FETCHCONTENT_SOURCE_DIR_LIBSNDFILE)
|
||
|
message(STATUS "Using libsndfile from local ${FETCHCONTENT_SOURCE_DIR_LIBSNDFILE}")
|
||
|
else()
|
||
|
message(STATUS "Fetching libsndfile ${LIBSNDFILE_GIT_REPO}/tree/${LIBSNDFILE_GIT_TAG}")
|
||
|
endif()
|
||
|
FetchContent_Populate(libsndfile)
|
||
|
endif()
|
||
3 years ago
|
|
||
|
set(LIBSNDFILE_ROOT_DIR ${libsndfile_SOURCE_DIR})
|
||
|
set(LIBSNDFILE_INCLUDE_DIR "${libsndfile_BINARY_DIR}/src")
|
||
|
|
||
3 years ago
|
function(libsndfile_build)
|
||
|
option(BUILD_PROGRAMS "Build programs" OFF)
|
||
|
option(BUILD_EXAMPLES "Build examples" OFF)
|
||
|
option(BUILD_TESTING "Build examples" OFF)
|
||
|
option(ENABLE_CPACK "Enable CPack support" OFF)
|
||
|
option(ENABLE_PACKAGE_CONFIG "Generate and install package config file" OFF)
|
||
|
option(BUILD_REGTEST "Build regtest" OFF)
|
||
|
# finally we include libsndfile itself
|
||
|
add_subdirectory(${libsndfile_SOURCE_DIR} ${libsndfile_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||
|
# copying .hh for c++ support
|
||
3 years ago
|
#file(COPY "${libsndfile_SOURCE_DIR}/src/sndfile.hh" DESTINATION ${LIBSNDFILE_INCLUDE_DIR})
|
||
3 years ago
|
endfunction()
|
||
|
|
||
|
libsndfile_build()
|
||
3 years ago
|
|
||
|
include_directories(${LIBSNDFILE_INCLUDE_DIR})
|