2019-03-18 00:38:06 +01:00
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 } )
2019-03-17 19:36:55 +01:00
add_library ( in_vgmstream SHARED
2019-03-18 00:38:06 +01:00
$ { W I N A M P _ S D K _ H E A D E R S }
r e s o u r c e . h
2019-03-17 19:36:55 +01:00
i n _ v g m s t r e a m . c
2019-03-18 00:38:06 +01:00
$ { R E S O U R C E S } )
2019-03-17 19:36:55 +01:00
2019-03-21 03:23:47 +01:00
# Link to the vgmstream library
target_link_libraries ( in_vgmstream libvgmstream )
2019-03-17 19:36:55 +01:00
setup_target ( in_vgmstream TRUE )
# Remove the prefix and set the suffix to .dll
set_target_properties ( in_vgmstream PROPERTIES
P R E F I X " "
S U F F I X " . d l l " )
# Add the preprocessor definitions
target_compile_definitions ( in_vgmstream PRIVATE
V G M _ W I N A M P _ U N I C O D E
_ _ S T D C _ C O N S T A N T _ M A C R O S
U N I C O D E
_ U N I C O D E )
# Make sure that the binary directory is included (for version.h)
2020-01-11 19:14:13 +01:00
target_include_directories ( in_vgmstream PRIVATE ${ VGM_BINARY_DIR } )
2019-03-17 19:36:55 +01:00
# Include the version string
if ( MSVC )
add_dependencies ( in_vgmstream version_h )
elseif ( MINGW )
if ( VGMSTREAM_VERSION )
target_compile_definitions ( in_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 ( in_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
2019-03-30 04:07:58 +01:00
install_dlls ( ${ WINAMP_INSTALL_PREFIX } )
2019-03-20 03:00:48 +01:00
# Install the plugin
install ( TARGETS in_vgmstream
D E S T I N A T I O N $ { W I N A M P _ I N S T A L L _ P R E F I X } / P l u g i n s )