diff --git a/CMakeLists.txt b/CMakeLists.txt index fb9400ee..df92046e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ if(WIN32) set(FB2K_SDK_PATH CACHE PATH "Path to foobar2000 SDK") 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) endif() if(WIN32) @@ -174,6 +175,9 @@ if(WIN32) include_external_msproject(pfc ${FB2K_SDK_PATH}/pfc/pfc.vcxproj) add_subdirectory(fb2k) endif() + if(BUILD_XMPLAY) + add_subdirectory(xmplay) + endif() endif() if(BUILD_CLI) if(WIN32) @@ -205,5 +209,6 @@ message(STATUS " CLI: ${BUILD_CLI}") if(WIN32) message(STATUS "foobar2000 component: ${BUILD_FB2K}") message(STATUS " Winamp plugin: ${BUILD_WINAMP}") + message(STATUS " XMPlay plugin: ${BUILD_XMPLAY}") endif() message(STATUS "") diff --git a/cmake/vgmstream.cmake b/cmake/vgmstream.cmake index 791fc220..a3419268 100644 --- a/cmake/vgmstream.cmake +++ b/cmake/vgmstream.cmake @@ -121,7 +121,6 @@ macro(setup_target TARGET) target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libcelt-0061.lib ${CMAKE_BINARY_DIR}/ext_libs/libcelt-0110.lib) - endif() endif() endif() endmacro() diff --git a/fb2k/CMakeLists.txt b/fb2k/CMakeLists.txt index 1c9d1e7f..d91207c6 100644 --- a/fb2k/CMakeLists.txt +++ b/fb2k/CMakeLists.txt @@ -1,10 +1,19 @@ # NOTE: Although this does include a section for handling MinGW, it might not be possible to build the foobar2000 component using MinGW using only CMake, as foobar2000's SDK only includes Visual Studio projects +set(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/foo_input_vgmstream.rc) + +# Setup source groups, mainly for Visual Studio +source_group("Resource Files" FILES ${RESOURCES}) + add_library(foo_input_vgmstream SHARED + foo_filetypes.h + foo_prefs.h + foo_vgmstream.h + resource.h foo_prefs.cpp foo_streamfile.cpp foo_vgmstream.cpp - foo_input_vgmstream.rc) + ${RESOURCES}) setup_target(foo_input_vgmstream TRUE) diff --git a/winamp/CMakeLists.txt b/winamp/CMakeLists.txt index 70849ba9..f29be1bf 100644 --- a/winamp/CMakeLists.txt +++ b/winamp/CMakeLists.txt @@ -1,6 +1,15 @@ +file(GLOB WINAMP_SDK_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/sdk/*.h") +set(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/resource.rc) + +# Setup source groups, mainly for Visual Studio +source_group("Header Files\\sdk" FILES ${WINAMP_SDK_HEADERS}) +source_group("Resource Files" FILES ${RESOURCES}) + add_library(in_vgmstream SHARED + ${WINAMP_SDK_HEADERS} + resource.h in_vgmstream.c - resource.rc) + ${RESOURCES}) setup_target(in_vgmstream TRUE) diff --git a/xmplay/CMakeLists.txt b/xmplay/CMakeLists.txt new file mode 100644 index 00000000..96361396 --- /dev/null +++ b/xmplay/CMakeLists.txt @@ -0,0 +1,33 @@ +add_library(xmp-vgmstream SHARED + xmpfunc.h + xmpin.h + xmp_vgmstream.c + xmpin.def) + +setup_target(xmp-vgmstream TRUE) + +# Remove the prefix and set the suffix to .dll +set_target_properties(xmp-vgmstream PROPERTIES + PREFIX "" + SUFFIX ".dll") + +# Make sure that the binary directory is included (for version.h) +target_include_directories(xmp-vgmstream PRIVATE ${CMAKE_BINARY_DIR}) + +# Link to the vgmstream library +target_link_libraries(xmp-vgmstream libvgmstream) + +# Include the version string +if(MSVC) + add_dependencies(xmp-vgmstream version_h) +elseif(MINGW) + if(VGMSTREAM_VERSION) + target_compile_definitions(xmp-vgmstream PRIVATE VERSION="${VGMSTREAM_VERSION}") + endif() + + # Also, on MinGW when using GCC, these flags need to be included to prevent requiring MinGW's runtime DLLs from being included, which does unfortunately increase the size of the DLL + if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang) + set_target_properties(xmp-vgmstream PROPERTIES + LINK_FLAGS "-static-libgcc -static-libstdc++") + endif() +endif() diff --git a/xmplay/xmp-vgmstream.vcxproj b/xmplay/xmp-vgmstream.vcxproj index 56bc7e63..b7aeb179 100644 --- a/xmplay/xmp-vgmstream.vcxproj +++ b/xmplay/xmp-vgmstream.vcxproj @@ -1,4 +1,4 @@ - + @@ -61,7 +61,7 @@ Disabled - ../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) + ..;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks @@ -86,7 +86,7 @@ - ../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) + ..;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) _WIN32_WINNT=0x501;WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions) MultiThreaded Level3 diff --git a/xmplay/xmp_vgmstream.c b/xmplay/xmp_vgmstream.c index 7c0e093e..a836a103 100644 --- a/xmplay/xmp_vgmstream.c +++ b/xmplay/xmp_vgmstream.c @@ -16,7 +16,7 @@ #ifndef VERSION -#include "../version.h" +#include "version.h" #endif #ifndef VERSION #define VERSION "(unknown version)"