vgmstream/cmake/dependencies/atrac9.cmake
KatieFrogs bf89c3503d Cmake: Fixes for dependencies
- Sets dependencies for targets
  - Fixes not being able to build single targets, like `make vgmstream_cli`
  - Fixes not being able to build with multiple jobs, like `make -j 5`
- Compiles dependencies out of the source directory
- Fixes double lib suffix, renaming liblibvgmstream.a to libvgmstream.a
- Removes zlib dependency from static builds, previously required by ffmpeg
- If ARCHIVE_EXTRACT is not available in cmake, mpg123 will be downloaded through svn, then fall back to git if that is not available either
2021-10-02 09:02:27 +03:00

29 lines
796 B
CMake

if(NOT WIN32 AND USE_ATRAC9)
FetchDependency(ATRAC9
DIR LibAtrac9
GIT_REPOSITORY https://github.com/Thealexbarney/LibAtrac9
GIT_TAG 6a9e00f6c7abd74d037fd210b6670d3cdb313049
)
if(ATRAC9_PATH)
set(ATRAC9_LINK_PATH ${ATRAC9_BIN}/bin/libatrac9.a)
add_custom_target(ATRAC9_MAKE
COMMAND make static CFLAGS="-fPIC" OBJDIR="${ATRAC9_BIN}/obj" BINDIR="${ATRAC9_BIN}/bin" CC="${CMAKE_C_COMPILER}" AR="${CMAKE_AR}"
WORKING_DIRECTORY ${ATRAC9_PATH}/C
BYPRODUCTS ${ATRAC9_LINK_PATH} ${ATRAC9_BIN}
)
add_library(atrac9 STATIC IMPORTED)
if(NOT EXISTS ${ATRAC9_LINK_PATH})
add_dependencies(atrac9 ATRAC9_MAKE)
endif()
set_target_properties(atrac9 PROPERTIES
IMPORTED_LOCATION ${ATRAC9_LINK_PATH}
)
endif()
endif()
if(NOT USE_ATRAC9)
unset(ATRAC9_SOURCE)
endif()