mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-23 22:41:05 +01:00
Add Audacious CMake script, cleanup
Also had to fix a few of the audacious files to get them to compile, mainly not using NULL in the input plugin constructor and casting the STREAMFILE functions (maybe some *nix compilers would've accepted those, but FreeBSD 12's Clang did not)
This commit is contained in:
parent
4fc51407e9
commit
30506a084a
@ -38,6 +38,8 @@ if(WIN32)
|
||||
set(WTL_INCLUDE_PATH CACHE PATH "Path to WTL include directory")
|
||||
option(BUILD_WINAMP "Build Winamp plugin" ON)
|
||||
option(BUILD_XMPLAY "Build XMPlay plugin" ON)
|
||||
else()
|
||||
option(BUILD_AUDACIOUS "Build Audacious plugin" ON)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@ -95,6 +97,13 @@ else()
|
||||
set(USE_FFMPEG FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If building Audacious, we need to make sure we can find its pkg-config module as well as GTK's
|
||||
if(BUILD_AUDACIOUS)
|
||||
include(FindPkgConfig)
|
||||
pkg_search_module(AUDACIOUS REQUIRED audacious>=3.6)
|
||||
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set compiler flags
|
||||
@ -178,6 +187,10 @@ if(WIN32)
|
||||
if(BUILD_XMPLAY)
|
||||
add_subdirectory(xmplay)
|
||||
endif()
|
||||
else()
|
||||
if(BUILD_AUDACIOUS)
|
||||
add_subdirectory(audacious)
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_CLI)
|
||||
if(WIN32)
|
||||
@ -210,5 +223,7 @@ if(WIN32)
|
||||
message(STATUS "foobar2000 component: ${BUILD_FB2K}")
|
||||
message(STATUS " Winamp plugin: ${BUILD_WINAMP}")
|
||||
message(STATUS " XMPlay plugin: ${BUILD_XMPLAY}")
|
||||
else()
|
||||
message(STATUS " Audacious plugin: ${BUILD_AUDACIOUS}")
|
||||
endif()
|
||||
message(STATUS "")
|
||||
|
67
audacious/CMakeLists.txt
Normal file
67
audacious/CMakeLists.txt
Normal file
@ -0,0 +1,67 @@
|
||||
add_library(audacious_vgmstream SHARED
|
||||
plugin.h
|
||||
vfs.h
|
||||
plugin.cc
|
||||
vfs.cc)
|
||||
|
||||
setup_target(audacious_vgmstream TRUE)
|
||||
|
||||
# Remove the prefix and set output name
|
||||
set_target_properties(audacious_vgmstream PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "vgmstream")
|
||||
|
||||
macro(extract_defines CFLAGS CFLAGS_COPY)
|
||||
set(${CFLAGS_COPY} ${${CFLAGS}})
|
||||
if(${CFLAGS_COPY})
|
||||
list(FILTER ${CFLAGS_COPY} INCLUDE REGEX "^-D.*")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(extract_non_defines CFLAGS CFLAGS_COPY)
|
||||
set(${CFLAGS_COPY} ${${CFLAGS}})
|
||||
if(${CFLAGS_COPY})
|
||||
list(FILTER ${CFLAGS_COPY} EXCLUDE REGEX "^-D.*")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
extract_defines(AUDACIOUS_CFLAGS_OTHER AUDACIOUS_DEFINES)
|
||||
extract_defines(GTK_CFLAGS_OTHER GTK_DEFINES)
|
||||
extract_non_defines(AUDACIOUS_CFLAGS_OTHER AUDACIOUS_CFLAGS_OTHER)
|
||||
extract_non_defines(GTK_CFLAGS_OTHER GTK_CFLAGS_OTHER)
|
||||
|
||||
# Include compile definitions for Audacious and GTK, as well as the version string
|
||||
target_compile_definitions(audacious_vgmstream PRIVATE
|
||||
${AUDACIOUS_DEFINES}
|
||||
${GTK_DEFINES}
|
||||
VERSION="${VGMSTREAM_VERSION}")
|
||||
|
||||
# Include compile flags for Audacious and GTK
|
||||
set_target_properties(audacious_vgmstream PROPERTIES
|
||||
COMPILE_FLAGS "${AUDACIOUS_CFLAGS_OTHER} ${GTK_CFLAGS_OTHER}")
|
||||
|
||||
# Make sure that the binary directory is included (for version.h) as well as the Audacious and GTK include directories
|
||||
target_include_directories(audacious_vgmstream PRIVATE
|
||||
${CMAKE_BINARY_DIR}
|
||||
${AUDACIOUS_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
|
||||
target_compile_features(audacious_vgmstream PRIVATE
|
||||
cxx_auto_type
|
||||
cxx_constexpr
|
||||
cxx_decltype
|
||||
cxx_defaulted_move_initializers
|
||||
cxx_deleted_functions
|
||||
cxx_nullptr
|
||||
cxx_rvalue_references
|
||||
cxx_static_assert
|
||||
cxx_strong_enums
|
||||
cxx_variadic_macros
|
||||
cxx_variadic_templates)
|
@ -22,7 +22,7 @@ extern "C" {
|
||||
|
||||
|
||||
#ifndef VERSION
|
||||
#include "../version.h"
|
||||
#include "version.h"
|
||||
#endif
|
||||
#ifndef VERSION
|
||||
#define VERSION "(unknown version)"
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
//constexpr VgmstreamPlugin() : InputPlugin(info, iinfo) {}
|
||||
//constexpr VgmstreamPlugin() : InputPlugin (info, InputInfo().with_exts(exts)) {}
|
||||
|
||||
constexpr VgmstreamPlugin() : InputPlugin (info, NULL) {}
|
||||
constexpr VgmstreamPlugin() : InputPlugin (info, InputInfo()) {}
|
||||
|
||||
bool init();
|
||||
void cleanup();
|
||||
|
@ -70,12 +70,12 @@ STREAMFILE *open_vfs_by_VFSFILE(VFSFile *file, const char *path) {
|
||||
// success, set our pointers
|
||||
memset(streamfile, 0, sizeof(VFSSTREAMFILE));
|
||||
|
||||
streamfile->sf.read = read_vfs;
|
||||
streamfile->sf.get_size = get_size_vfs;
|
||||
streamfile->sf.get_offset = get_offset_vfs;
|
||||
streamfile->sf.get_name = get_name_vfs;
|
||||
streamfile->sf.open = open_vfs_impl;
|
||||
streamfile->sf.close = close_vfs;
|
||||
streamfile->sf.read = (size_t (*)(STREAMFILE *, uint8_t *, off_t, size_t))read_vfs;
|
||||
streamfile->sf.get_size = (size_t (*)(STREAMFILE *))get_size_vfs;
|
||||
streamfile->sf.get_offset = (off_t (*)(STREAMFILE *))get_offset_vfs;
|
||||
streamfile->sf.get_name = (void (*)(STREAMFILE *, char *, size_t))get_name_vfs;
|
||||
streamfile->sf.open = (STREAMFILE *(*)(STREAMFILE *, const char *, size_t))open_vfs_impl;
|
||||
streamfile->sf.close = (void (*)(STREAMFILE *))close_vfs;
|
||||
|
||||
streamfile->vfsFile = file;
|
||||
streamfile->offset = 0;
|
||||
|
@ -77,3 +77,7 @@ target_include_directories(fdk-aac PRIVATE
|
||||
|
||||
# Make sure that whatever compiler we use can handle these features
|
||||
target_compile_features(fdk-aac PRIVATE cxx_long_long_type)
|
||||
|
||||
# Set up position-independent code
|
||||
set_target_properties(fdk-aac PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
@ -109,3 +109,7 @@ target_include_directories(mp4v2 PRIVATE
|
||||
target_compile_features(mp4v2 PRIVATE
|
||||
cxx_long_long_type
|
||||
cxx_variadic_macros)
|
||||
|
||||
# Set up position-independent code
|
||||
set_target_properties(mp4v2 PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
@ -17,6 +17,9 @@ macro(setup_target TARGET)
|
||||
else()
|
||||
target_include_directories(${TARGET} PRIVATE AFTER ${CMAKE_SOURCE_DIR}/ext_includes)
|
||||
endif()
|
||||
# Set up position-independent code for all targets
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
if(USE_FDKAAC)
|
||||
target_compile_definitions(${TARGET} PRIVATE
|
||||
|
@ -1,4 +1,3 @@
|
||||
set(SOURCES
|
||||
add_library(getopt STATIC
|
||||
getopt.h
|
||||
getopt.c)
|
||||
|
||||
add_library(getopt STATIC ${SOURCES})
|
||||
|
@ -54,7 +54,9 @@ add_dependencies(foo_input_vgmstream
|
||||
target_compile_features(foo_input_vgmstream PRIVATE
|
||||
cxx_auto_type
|
||||
cxx_nullptr
|
||||
cxx_static_assert)
|
||||
cxx_rvalue_references
|
||||
cxx_static_assert
|
||||
cxx_variadic_templates)
|
||||
|
||||
# Include the version string
|
||||
if(MSVC)
|
||||
|
Loading…
Reference in New Issue
Block a user