ddiakopoulos / libnyquist

:microphone: Cross platform C++11 library for decoding audio (mp3, wav, ogg, opus, flac, etc)
BSD 2-Clause "Simplified" License
540 stars 66 forks source link

Use cmake FetchContent, instead of copying 3rd parties? #39

Closed ArthurSonzogni closed 5 years ago

ArthurSonzogni commented 5 years ago

One possible improvement to this library. Maybe CMake FetchContent could be used: https://cmake.org/cmake/help/v3.11/module/FetchContent.html

libnyquist include many other libraries by copy-pasting them. Maybe you can move them out of libnyquist and get them at configure time:

FetchContent_Declare(opus
  GIT_REPOSITORY https://github.com/xiph/opus
  GIT_TAG v1.3.1
)

FetchContent_GetProperties(opus)
if(NOT opus_POPULATED)
  FetchContent_Populate(opus)
  // Do whatever you want in ${opus_SOURCE_DIR}
endif()
ddiakopoulos commented 5 years ago

Thanks @ArthurSonzogni. I'm familiar with FetchContent but I've had to modify some of the dependencies in a very minor ways to make them cleanly compile, so I've found that source copies of the dependencies in the repo is the most ideal path forward.