vgmstream/audacious/CMakeLists.txt
Naram Qashat 30506a084a 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)
2019-03-18 00:17:08 -04:00

68 lines
1.9 KiB
CMake

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)