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 )
2021-04-18 13:04:00 +02:00
file ( GLOB WINAMP_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h" )
file ( GLOB WINAMP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c" )
2019-03-18 00:38:06 +01:00
# 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 }
2021-04-18 13:04:00 +02:00
$ { W I N A M P _ H E A D E R S }
$ { W I N A M P _ S O U R C E S }
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 )
2021-08-07 20:41:50 +02:00
target_compile_definitions ( in_vgmstream PRIVATE VGMSTREAM_VERSION= "${VGMSTREAM_VERSION}" )
2019-03-17 19:36:55 +01:00
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 )