2019-03-18 00:38:06 +01:00
add_library ( xmp-vgmstream SHARED
x m p f u n c . h
x m p i n . h
x m p _ v g m s t r e a m . c
x m p i n . d e f )
2019-03-21 03:23:47 +01:00
# Link to the vgmstream library
target_link_libraries ( xmp-vgmstream libvgmstream )
2019-03-18 00:38:06 +01:00
setup_target ( xmp-vgmstream TRUE )
# Remove the prefix and set the suffix to .dll
set_target_properties ( xmp-vgmstream PROPERTIES
P R E F I X " "
S U F F I X " . d l l " )
# Make sure that the binary directory is included (for version.h)
2020-01-11 19:14:13 +01:00
target_include_directories ( xmp-vgmstream PRIVATE ${ VGM_BINARY_DIR } )
2019-03-18 00:38:06 +01:00
# 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
L I N K _ F L A G S " - s t a t i c - l i b g c c - s t a t i c - l i b s t d c + + " )
endif ( )
endif ( )
2019-03-20 03:00:48 +01:00
# Install the DLLs
install_dlls ( ${ XMPLAY_INSTALL_PREFIX } )
# Install the plugin
install ( TARGETS xmp-vgmstream
D E S T I N A T I O N $ { X M P L A Y _ I N S T A L L _ P R E F I X } )