mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 00:20:47 +01:00
Add vgmstream123 to CMake scripts (and make compile), other cleanups
For some reason vgmstream123 doesn't actually play anything for me...
This commit is contained in:
parent
2dda273627
commit
4b99dd6a7f
@ -85,19 +85,27 @@ else()
|
|||||||
if(USE_MPEG)
|
if(USE_MPEG)
|
||||||
find_package(MPG123)
|
find_package(MPG123)
|
||||||
if(NOT MPG123_FOUND)
|
if(NOT MPG123_FOUND)
|
||||||
set(USE_MPEG FALSE)
|
set(USE_MPEG OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(USE_VORBIS)
|
if(USE_VORBIS)
|
||||||
find_package(Vorbis)
|
find_package(VorbisFile)
|
||||||
if(NOT VORBIS_FOUND)
|
if(NOT VORBISFILE_FOUND)
|
||||||
set(USE_VORBIS FALSE)
|
set(USE_VORBIS OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(USE_FFMPEG)
|
if(USE_FFMPEG)
|
||||||
find_package(FFmpeg)
|
find_package(FFmpeg)
|
||||||
if(NOT FFMPEG_LIBRARIES)
|
if(NOT FFMPEG_LIBRARIES)
|
||||||
set(USE_FFMPEG FALSE)
|
set(USE_FFMPEG OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If building the CLI, we need to include AO as well
|
||||||
|
if(BUILD_CLI)
|
||||||
|
find_package(AO)
|
||||||
|
if(NOT AO_FOUND)
|
||||||
|
message(FATAL_ERROR "Cannot build vgmstream123 without libao")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -231,25 +239,27 @@ message(STATUS "")
|
|||||||
# Build Summary
|
# Build Summary
|
||||||
message(STATUS " Building")
|
message(STATUS " Building")
|
||||||
message(STATUS "=========================")
|
message(STATUS "=========================")
|
||||||
message(STATUS " CLI: ${BUILD_CLI}")
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
message(STATUS " CLI: ${BUILD_CLI}")
|
||||||
message(STATUS "foobar2000 component: ${BUILD_FB2K}")
|
message(STATUS "foobar2000 component: ${BUILD_FB2K}")
|
||||||
message(STATUS " Winamp plugin: ${BUILD_WINAMP}")
|
message(STATUS " Winamp plugin: ${BUILD_WINAMP}")
|
||||||
message(STATUS " XMPlay plugin: ${BUILD_XMPLAY}")
|
message(STATUS " XMPlay plugin: ${BUILD_XMPLAY}")
|
||||||
else()
|
else()
|
||||||
message(STATUS " Audacious plugin: ${BUILD_AUDACIOUS}")
|
message(STATUS "CLI/vgmstream123: ${BUILD_CLI}")
|
||||||
|
message(STATUS "Audacious plugin: ${BUILD_AUDACIOUS}")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
|
|
||||||
# Install Summary
|
# Install Summary
|
||||||
message(STATUS " Install Paths")
|
message(STATUS " Install Paths")
|
||||||
message(STATUS "=========================")
|
message(STATUS "=========================")
|
||||||
message(STATUS " CLI: ${CMAKE_INSTALL_PREFIX}/bin")
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
message(STATUS " CLI: ${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
message(STATUS "foobar2000 component: ${FB2K_COMPONENT_INSTALL_PREFIX}")
|
message(STATUS "foobar2000 component: ${FB2K_COMPONENT_INSTALL_PREFIX}")
|
||||||
message(STATUS " Winamp plugin: ${WINAMP_INSTALL_PREFIX}/Plugins")
|
message(STATUS " Winamp plugin: ${WINAMP_INSTALL_PREFIX}/Plugins")
|
||||||
message(STATUS " XMPlay plugin: ${XMPLAY_INSTALL_PREFIX}")
|
message(STATUS " XMPlay plugin: ${XMPLAY_INSTALL_PREFIX}")
|
||||||
else()
|
else()
|
||||||
message(STATUS " Audacious plugin: ${AUDACIOUS_PLUGIN_DIR}/Input")
|
message(STATUS "CLI/vgmstream123: ${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
|
message(STATUS "Audacious plugin: ${AUDACIOUS_PLUGIN_DIR}/Input")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
|
@ -4,6 +4,12 @@ add_library(audacious_vgmstream SHARED
|
|||||||
plugin.cc
|
plugin.cc
|
||||||
vfs.cc)
|
vfs.cc)
|
||||||
|
|
||||||
|
# Link to the vgmstream library and audacious library
|
||||||
|
target_link_libraries(audacious_vgmstream
|
||||||
|
libvgmstream
|
||||||
|
${AUDACIOUS_LINK_LIBRARIES}
|
||||||
|
${GTK_LINK_LIBRARIES})
|
||||||
|
|
||||||
setup_target(audacious_vgmstream TRUE)
|
setup_target(audacious_vgmstream TRUE)
|
||||||
|
|
||||||
# Remove the prefix and set output name
|
# Remove the prefix and set output name
|
||||||
@ -46,12 +52,6 @@ target_include_directories(audacious_vgmstream PRIVATE
|
|||||||
${AUDACIOUS_INCLUDE_DIRS}
|
${AUDACIOUS_INCLUDE_DIRS}
|
||||||
${GTK_INCLUDE_DIRS})
|
${GTK_INCLUDE_DIRS})
|
||||||
|
|
||||||
# Link to the vgmstream library and audacious library
|
|
||||||
target_link_libraries(audacious_vgmstream
|
|
||||||
libvgmstream
|
|
||||||
${AUDACIOUS_LINK_LIBRARIES}
|
|
||||||
${GTK_LINK_LIBRARIES})
|
|
||||||
|
|
||||||
# Make sure that whatever compiler we use can handle these features
|
# Make sure that whatever compiler we use can handle these features
|
||||||
target_compile_features(audacious_vgmstream PRIVATE
|
target_compile_features(audacious_vgmstream PRIVATE
|
||||||
cxx_auto_type
|
cxx_auto_type
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
|
# CLI
|
||||||
|
|
||||||
add_executable(vgmstream_cli
|
add_executable(vgmstream_cli
|
||||||
vgmstream_cli.c)
|
vgmstream_cli.c)
|
||||||
|
|
||||||
setup_target(vgmstream_cli TRUE)
|
|
||||||
|
|
||||||
# Link to the vgmstream library
|
# Link to the vgmstream library
|
||||||
target_link_libraries(vgmstream_cli libvgmstream)
|
target_link_libraries(vgmstream_cli libvgmstream)
|
||||||
|
|
||||||
|
setup_target(vgmstream_cli TRUE)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Add the preprocessor definitions
|
# Add the preprocessor definitions
|
||||||
target_compile_definitions(vgmstream_cli PRIVATE _CONSOLE)
|
target_compile_definitions(vgmstream_cli PRIVATE _CONSOLE)
|
||||||
@ -43,3 +45,30 @@ endif()
|
|||||||
# Install the CLI program
|
# Install the CLI program
|
||||||
install(TARGETS vgmstream_cli
|
install(TARGETS vgmstream_cli
|
||||||
RUNTIME DESTINATION bin)
|
RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
|
# TODO: Make it so vgmstream123 can build with Windows (this probably needs a libao.dll included with vgmstream, though)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
# vgmstream123
|
||||||
|
|
||||||
|
add_executable(vgmstream123
|
||||||
|
vgmstream123.c)
|
||||||
|
|
||||||
|
# Link to the vgmstream library as well as libao
|
||||||
|
target_link_libraries(vgmstream123
|
||||||
|
libvgmstream
|
||||||
|
${AO_LIBRARY})
|
||||||
|
|
||||||
|
setup_target(vgmstream123 TRUE)
|
||||||
|
|
||||||
|
# Add AO include directory
|
||||||
|
target_include_directories(vgmstream123 PRIVATE
|
||||||
|
${AO_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# Include the version string
|
||||||
|
target_compile_definitions(vgmstream123 PRIVATE VERSION="${VGMSTREAM_VERSION}")
|
||||||
|
|
||||||
|
# Install vgmstream123
|
||||||
|
install(TARGETS vgmstream123
|
||||||
|
RUNTIME DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
@ -33,12 +33,14 @@
|
|||||||
#else
|
#else
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../src/vgmstream.h"
|
#include "../src/vgmstream.h"
|
||||||
|
|
||||||
#undef VERSION
|
#ifndef VERSION
|
||||||
#include "../version.h"
|
# include "version.h"
|
||||||
|
#endif
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
# define VERSION "(unknown version)"
|
# define VERSION "(unknown version)"
|
||||||
#endif
|
#endif
|
||||||
|
42
cmake/FindAO.cmake
Normal file
42
cmake/FindAO.cmake
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
if(AO_INCLUDE_DIR)
|
||||||
|
# Already in cache, be silent
|
||||||
|
set(AO_FIND_QUIETLY TRUE)
|
||||||
|
endif(AO_INCLUDE_DIR)
|
||||||
|
|
||||||
|
find_path(AO_INCLUDE_DIR ao/ao.h
|
||||||
|
/opt/local/include
|
||||||
|
/usr/local/include
|
||||||
|
/usr/include
|
||||||
|
)
|
||||||
|
|
||||||
|
set(AO_NAMES ao)
|
||||||
|
find_library(AO_LIBRARY
|
||||||
|
NAMES ${AO_NAMES}
|
||||||
|
PATHS /usr/lib /usr/local/lib /opt/local/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if(AO_INCLUDE_DIR AND AO_LIBRARY)
|
||||||
|
set(AO_FOUND TRUE)
|
||||||
|
set(AO_LIBRARIES ${AO_LIBRARY})
|
||||||
|
else(AO_INCLUDE_DIR AND AO_LIBRARY)
|
||||||
|
set(AO_FOUND FALSE)
|
||||||
|
set(AO_LIBRARIES)
|
||||||
|
endif(AO_INCLUDE_DIR AND AO_LIBRARY)
|
||||||
|
|
||||||
|
if(AO_FOUND)
|
||||||
|
if(NOT AO_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found AO: ${AO_LIBRARY}")
|
||||||
|
endif(NOT AO_FIND_QUIETLY)
|
||||||
|
else(AO_FOUND)
|
||||||
|
if(AO_FIND_REQUIRED)
|
||||||
|
message(STATUS "Looked for ao libraries named ${AO_NAMES}.")
|
||||||
|
message(STATUS "Include file detected: [${AO_INCLUDE_DIR}].")
|
||||||
|
message(STATUS "Lib file detected: [${AO_LIBRARY}].")
|
||||||
|
message(FATAL_ERROR "=========> Could NOT find ao library")
|
||||||
|
endif(AO_FIND_REQUIRED)
|
||||||
|
endif(AO_FOUND)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
AO_LIBRARY
|
||||||
|
AO_INCLUDE_DIR
|
||||||
|
)
|
@ -29,6 +29,8 @@
|
|||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
# Comes from https://github.com/snikulov/cmake-modules/blob/master/FindFFmpeg.cmake
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
# MPG123_LIBRARIES - List of libraries when using mpg123.
|
# MPG123_LIBRARIES - List of libraries when using mpg123.
|
||||||
# MPG123_FOUND - True if mpg123 found.
|
# MPG123_FOUND - True if mpg123 found.
|
||||||
|
|
||||||
|
# Comes from https://github.com/coelckers/gzdoom/blob/master/cmake/FindMPG123.cmake
|
||||||
|
|
||||||
if(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
|
if(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
set(MPG123_FIND_QUIETLY TRUE)
|
set(MPG123_FIND_QUIETLY TRUE)
|
||||||
|
@ -1,25 +1,63 @@
|
|||||||
# - Find ogg
|
# - Find ogg
|
||||||
# Find the native ogg includes and libraries
|
# Find the native ogg includes and libraries
|
||||||
#
|
#
|
||||||
# OGG_INCLUDE_DIR - where to find ogg.h, etc.
|
# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
|
||||||
# OGG_LIBRARIES - List of libraries when using ogg.
|
# OGG_LIBRARIES - List of libraries when using ogg.
|
||||||
# OGG_FOUND - True if ogg found.
|
# OGG_FOUND - True if ogg found.
|
||||||
|
|
||||||
|
# Comes from https://github.com/erikd/libsndfile/blob/master/cmake/FindOgg.cmake
|
||||||
|
|
||||||
if(OGG_INCLUDE_DIR)
|
if(OGG_INCLUDE_DIR)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
set(OGG_FIND_QUIETLY TRUE)
|
set(OGG_FIND_QUIETLY TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
|
find_package(PkgConfig QUIET)
|
||||||
|
pkg_check_modules(PC_OGG QUIET ogg>=1.3.0)
|
||||||
|
|
||||||
|
set(OGG_VERSION ${PC_OGG_VERSION})
|
||||||
|
|
||||||
|
find_path(OGG_INCLUDE_DIR ogg/ogg.h
|
||||||
|
HINTS
|
||||||
|
${PC_OGG_INCLUDEDIR}
|
||||||
|
${PC_OGG_INCLUDE_DIRS}
|
||||||
|
${OGG_ROOT}
|
||||||
|
)
|
||||||
# MSVC built ogg may be named ogg_static.
|
# MSVC built ogg may be named ogg_static.
|
||||||
# The provided project files name the library with the lib prefix.
|
# The provided project files name the library with the lib prefix.
|
||||||
find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static)
|
find_library(OGG_LIBRARY
|
||||||
|
NAMES
|
||||||
|
ogg
|
||||||
|
ogg_static
|
||||||
|
libogg
|
||||||
|
libogg_static
|
||||||
|
HINTS
|
||||||
|
${PC_OGG_LIBDIR}
|
||||||
|
${PC_OGG_LIBRARY_DIRS}
|
||||||
|
${OGG_ROOT}
|
||||||
|
)
|
||||||
# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
|
# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
|
||||||
# to TRUE if all listed variables are TRUE.
|
# to TRUE if all listed variables are TRUE.
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(OGG DEFAULT_MSG OGG_INCLUDE_DIR OGG_LIBRARY)
|
find_package_handle_standard_args (Ogg
|
||||||
|
REQUIRED_VARS
|
||||||
|
OGG_LIBRARY
|
||||||
|
OGG_INCLUDE_DIR
|
||||||
|
VERSION_VAR
|
||||||
|
OGG_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
set(OGG_LIBRARIES ${OGG_LIBRARY})
|
if(OGG_FOUND)
|
||||||
|
set(OGG_LIBRARIES ${OGG_LIBRARY})
|
||||||
|
set(OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
|
||||||
|
|
||||||
mark_as_advanced(OGG_INCLUDE_DIR)
|
if(NOT TARGET Ogg::Ogg)
|
||||||
mark_as_advanced(OGG_LIBRARY)
|
add_library(Ogg::Ogg UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(Ogg::Ogg PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
|
||||||
|
IMPORTED_LOCATION "${OGG_LIBRARIES}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY)
|
||||||
|
@ -1,33 +1,66 @@
|
|||||||
# - Find vorbis
|
# - Find vorbisenc
|
||||||
# Find the native vorbis includes and libraries
|
# Find the native vorbisenc includes and libraries
|
||||||
#
|
#
|
||||||
# VORBIS_INCLUDE_DIR - where to find vorbis.h, etc.
|
# VORBIS_INCLUDE_DIRS - where to find vorbis.h, etc.
|
||||||
# VORBIS_LIBRARIES - List of libraries when using vorbis(file).
|
# VORBIS_LIBRARIES - List of libraries when using vorbis.
|
||||||
# VORBIS_FOUND - True if vorbis found.
|
# VORBIS_FOUND - True if vorbis found.
|
||||||
|
|
||||||
|
# Comes from https://github.com/erikd/libsndfile/blob/master/cmake/FindVorbis.cmake
|
||||||
|
|
||||||
if(VORBIS_INCLUDE_DIR)
|
if(VORBIS_INCLUDE_DIR)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
set(VORBIS_FIND_QUIETLY TRUE)
|
set(VORBIS_FIND_QUIETLY TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Ogg)
|
find_package(Ogg QUIET)
|
||||||
if(OGG_FOUND)
|
|
||||||
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
|
find_package(PkgConfig QUIET)
|
||||||
# MSVC built vorbis may be named vorbis_static
|
pkg_check_modules(PC_VORBIS QUIET vorbis)
|
||||||
# The provided project files name the library with the lib prefix.
|
|
||||||
find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static libvorbis libvorbis_static)
|
set(VORBIS_VERSION ${PC_VORBIS_VERSION})
|
||||||
find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static libvorbisfile libvorbisfile_static)
|
|
||||||
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
|
find_path(VORBIS_INCLUDE_DIR vorbis/codec.h
|
||||||
# to TRUE if all listed variables are TRUE.
|
HINTS
|
||||||
include(FindPackageHandleStandardArgs)
|
${PC_VORBIS_INCLUDEDIR}
|
||||||
find_package_handle_standard_args(VORBIS DEFAULT_MSG VORBIS_INCLUDE_DIR VORBIS_LIBRARY VORBISFILE_LIBRARY)
|
${PC_VORBIS_INCLUDE_DIRS}
|
||||||
endif()
|
${VORBIS_ROOT}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(VORBIS_LIBRARY
|
||||||
|
NAMES
|
||||||
|
vorbis
|
||||||
|
vorbis_static
|
||||||
|
libvorbis
|
||||||
|
libvorbis_static
|
||||||
|
HINTS
|
||||||
|
${PC_VORBIS_LIBDIR}
|
||||||
|
${PC_VORBIS_LIBRARY_DIRS}
|
||||||
|
${VORBIS_ROOT}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
|
||||||
|
# to TRUE if all listed variables are TRUE.
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Vorbis
|
||||||
|
REQUIRED_VARS
|
||||||
|
VORBIS_LIBRARY
|
||||||
|
VORBIS_INCLUDE_DIR
|
||||||
|
OGG_FOUND
|
||||||
|
VERSION_VAR
|
||||||
|
VORBIS_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
if(VORBIS_FOUND)
|
if(VORBIS_FOUND)
|
||||||
set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
|
set(VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
|
||||||
else()
|
set(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
|
||||||
set(VORBIS_LIBRARIES)
|
if(NOT TARGET Vorbis::Vorbis)
|
||||||
|
add_library(Vorbis::Vorbis UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(Vorbis::Vorbis PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${VORBIS_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LOCATION "${VORBIS_LIBRARY}"
|
||||||
|
INTERFACE_LINK_LIBRARIES Ogg::Ogg
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(VORBIS_INCLUDE_DIR)
|
mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_LIBRARY)
|
||||||
mark_as_advanced(VORBIS_LIBRARY VORBISFILE_LIBRARY)
|
|
||||||
|
66
cmake/FindVorbisFile.cmake
Normal file
66
cmake/FindVorbisFile.cmake
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# - Find vorbisfile
|
||||||
|
# Find the native vorbisfile includes and libraries
|
||||||
|
#
|
||||||
|
# VORBISFILE_INCLUDE_DIRS - where to find vorbisfile.h, etc.
|
||||||
|
# VORBISFILE_LIBRARIES - List of libraries when using vorbisfile.
|
||||||
|
# VORBISFILE_FOUND - True if vorbisfile found.
|
||||||
|
|
||||||
|
# Adapted from https://github.com/erikd/libsndfile/blob/master/cmake/FindVorbisEnc.cmake
|
||||||
|
|
||||||
|
if(VORBISFILE_INCLUDE_DIR)
|
||||||
|
# Already in cache, be silent
|
||||||
|
set(VORBISFILE_FIND_QUIETLY TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(Vorbis QUIET)
|
||||||
|
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
pkg_check_modules(PC_VORBISFILE QUIET vorbisfile)
|
||||||
|
|
||||||
|
set(VORBISFILE_VERSION ${PC_VORBISFILE_VERSION})
|
||||||
|
|
||||||
|
find_path(VORBISFILE_INCLUDE_DIR vorbis/vorbisfile.h
|
||||||
|
HINTS
|
||||||
|
${PC_VORBISFILE_INCLUDEDIR}
|
||||||
|
${PC_VORBISFILE_INCLUDE_DIRS}
|
||||||
|
${VORBISFILE_ROOT}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(VORBISFILE_LIBRARY
|
||||||
|
NAMES
|
||||||
|
vorbisfile
|
||||||
|
vorbisfile_static
|
||||||
|
libvorbisfile
|
||||||
|
libvorbisfile_static
|
||||||
|
HINTS
|
||||||
|
${PC_VORBISFILE_LIBDIR}
|
||||||
|
${PC_VORBISFILE_LIBRARY_DIRS}
|
||||||
|
${VORBISFILE_ROOT}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Handle the QUIETLY and REQUIRED arguments and set VORBISFILE_FOUND
|
||||||
|
# to TRUE if all listed variables are TRUE.
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(VorbisFile
|
||||||
|
REQUIRED_VARS
|
||||||
|
VORBISFILE_LIBRARY
|
||||||
|
VORBISFILE_INCLUDE_DIR
|
||||||
|
VORBIS_FOUND
|
||||||
|
VERSION_VAR
|
||||||
|
VORBISFILE_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
|
if(VORBISFILE_FOUND)
|
||||||
|
set(VORBISFILE_INCLUDE_DIRS ${VORBISFILE_INCLUDE_DIR})
|
||||||
|
set(VORBISFILE_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARIES})
|
||||||
|
if(NOT TARGET Vorbis::VorbisFile)
|
||||||
|
add_library(Vorbis::VorbisFile UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(Vorbis::VorbisFile PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${VORBISFILE_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LOCATION "${VORBISFILE_LIBRARY}"
|
||||||
|
INTERFACE_LINK_LIBRARIES Vorbis::Vorbis
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(VORBISFILE_INCLUDE_DIR VORBISFILE_LIBRARY)
|
@ -13,10 +13,8 @@ macro(setup_target TARGET)
|
|||||||
target_compile_definitions(${TARGET} PRIVATE
|
target_compile_definitions(${TARGET} PRIVATE
|
||||||
_WIN32_WINNT=0x501
|
_WIN32_WINNT=0x501
|
||||||
_CRT_SECURE_NO_WARNINGS)
|
_CRT_SECURE_NO_WARNINGS)
|
||||||
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/ext_includes)
|
|
||||||
else()
|
|
||||||
target_include_directories(${TARGET} PRIVATE AFTER ${CMAKE_SOURCE_DIR}/ext_includes)
|
|
||||||
endif()
|
endif()
|
||||||
|
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/ext_includes)
|
||||||
# Set up position-independent code for all targets
|
# Set up position-independent code for all targets
|
||||||
set_target_properties(${TARGET} PROPERTIES
|
set_target_properties(${TARGET} PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE TRUE)
|
POSITION_INDEPENDENT_CODE TRUE)
|
||||||
@ -60,9 +58,9 @@ macro(setup_target TARGET)
|
|||||||
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libvorbis.lib)
|
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libvorbis.lib)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
target_include_directories(${TARGET} PRIVATE ${VORBIS_INCLUDE_DIR})
|
target_include_directories(${TARGET} PRIVATE ${VORBISFILE_INCLUDE_DIRS})
|
||||||
if(LINK)
|
if(LINK)
|
||||||
target_link_libraries(${TARGET} ${VORBIS_LIBRARIES})
|
target_link_libraries(${TARGET} Vorbis::VorbisFile)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -15,6 +15,11 @@ add_library(foo_input_vgmstream SHARED
|
|||||||
foo_vgmstream.cpp
|
foo_vgmstream.cpp
|
||||||
${RESOURCES})
|
${RESOURCES})
|
||||||
|
|
||||||
|
# Link to the vgmstream library and foobar2000's shared library
|
||||||
|
target_link_libraries(foo_input_vgmstream
|
||||||
|
libvgmstream
|
||||||
|
${FB2K_SDK_PATH}/foobar2000/shared/shared.lib)
|
||||||
|
|
||||||
setup_target(foo_input_vgmstream TRUE)
|
setup_target(foo_input_vgmstream TRUE)
|
||||||
|
|
||||||
# Remove the prefix and set the suffix to .dll
|
# Remove the prefix and set the suffix to .dll
|
||||||
@ -37,11 +42,6 @@ target_include_directories(foo_input_vgmstream PRIVATE
|
|||||||
${FB2K_SDK_PATH}/foobar2000
|
${FB2K_SDK_PATH}/foobar2000
|
||||||
${WTL_INCLUDE_PATH})
|
${WTL_INCLUDE_PATH})
|
||||||
|
|
||||||
# Link to the vgmstream library and foobar2000's shared library
|
|
||||||
target_link_libraries(foo_input_vgmstream
|
|
||||||
libvgmstream
|
|
||||||
${FB2K_SDK_PATH}/foobar2000/shared/shared.lib)
|
|
||||||
|
|
||||||
# Add dependencies to foobar2000's SDK
|
# Add dependencies to foobar2000's SDK
|
||||||
add_dependencies(foo_input_vgmstream
|
add_dependencies(foo_input_vgmstream
|
||||||
fb2k_sdk
|
fb2k_sdk
|
||||||
|
@ -11,6 +11,9 @@ add_library(in_vgmstream SHARED
|
|||||||
in_vgmstream.c
|
in_vgmstream.c
|
||||||
${RESOURCES})
|
${RESOURCES})
|
||||||
|
|
||||||
|
# Link to the vgmstream library
|
||||||
|
target_link_libraries(in_vgmstream libvgmstream)
|
||||||
|
|
||||||
setup_target(in_vgmstream TRUE)
|
setup_target(in_vgmstream TRUE)
|
||||||
|
|
||||||
# Remove the prefix and set the suffix to .dll
|
# Remove the prefix and set the suffix to .dll
|
||||||
@ -28,9 +31,6 @@ target_compile_definitions(in_vgmstream PRIVATE
|
|||||||
# Make sure that the binary directory is included (for version.h)
|
# Make sure that the binary directory is included (for version.h)
|
||||||
target_include_directories(in_vgmstream PRIVATE ${CMAKE_BINARY_DIR})
|
target_include_directories(in_vgmstream PRIVATE ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
# Link to the vgmstream library
|
|
||||||
target_link_libraries(in_vgmstream libvgmstream)
|
|
||||||
|
|
||||||
# Include the version string
|
# Include the version string
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_dependencies(in_vgmstream version_h)
|
add_dependencies(in_vgmstream version_h)
|
||||||
|
@ -4,6 +4,9 @@ add_library(xmp-vgmstream SHARED
|
|||||||
xmp_vgmstream.c
|
xmp_vgmstream.c
|
||||||
xmpin.def)
|
xmpin.def)
|
||||||
|
|
||||||
|
# Link to the vgmstream library
|
||||||
|
target_link_libraries(xmp-vgmstream libvgmstream)
|
||||||
|
|
||||||
setup_target(xmp-vgmstream TRUE)
|
setup_target(xmp-vgmstream TRUE)
|
||||||
|
|
||||||
# Remove the prefix and set the suffix to .dll
|
# Remove the prefix and set the suffix to .dll
|
||||||
@ -14,9 +17,6 @@ set_target_properties(xmp-vgmstream PROPERTIES
|
|||||||
# Make sure that the binary directory is included (for version.h)
|
# Make sure that the binary directory is included (for version.h)
|
||||||
target_include_directories(xmp-vgmstream PRIVATE ${CMAKE_BINARY_DIR})
|
target_include_directories(xmp-vgmstream PRIVATE ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
# Link to the vgmstream library
|
|
||||||
target_link_libraries(xmp-vgmstream libvgmstream)
|
|
||||||
|
|
||||||
# Include the version string
|
# Include the version string
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_dependencies(xmp-vgmstream version_h)
|
add_dependencies(xmp-vgmstream version_h)
|
||||||
|
Loading…
Reference in New Issue
Block a user