2019-03-21 03:23:47 +01:00
# CLI
2019-03-17 19:36:55 +01:00
add_executable ( vgmstream_cli
v g m s t r e a m _ c l i . c )
# Link to the vgmstream library
target_link_libraries ( vgmstream_cli libvgmstream )
2019-03-21 03:23:47 +01:00
setup_target ( vgmstream_cli TRUE )
2019-03-17 19:36:55 +01:00
if ( WIN32 )
# Add the preprocessor definitions
target_compile_definitions ( vgmstream_cli PRIVATE _CONSOLE )
# Link to the getopt library
target_link_libraries ( vgmstream_cli getopt )
# Make sure that the binary directory is included (for version.h), as well as the getopt library include directory
target_include_directories ( vgmstream_cli PRIVATE
$ { C M A K E _ B I N A R Y _ D I R }
$ { C M A K E _ S O U R C E _ D I R } / e x t _ l i b s / G e t o p t )
# Include the version string
if ( MSVC )
add_dependencies ( vgmstream_cli version_h )
elseif ( MINGW )
if ( VGMSTREAM_VERSION )
target_compile_definitions ( vgmstream_cli 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 EXE
if ( NOT CMAKE_CXX_COMPILER_ID MATCHES Clang )
set_target_properties ( vgmstream_cli 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 ( ${ CMAKE_INSTALL_PREFIX } /bin )
2019-03-17 19:36:55 +01:00
elseif ( VGMSTREAM_VERSION )
# Include the version string
target_compile_definitions ( vgmstream_cli PRIVATE VERSION= "${VGMSTREAM_VERSION}" )
endif ( )
2019-03-20 03:00:48 +01:00
# Install the CLI program
install ( TARGETS vgmstream_cli
R U N T I M E D E S T I N A T I O N b i n )
2019-03-21 03:23:47 +01:00
# TODO: Make it so vgmstream123 can build with Windows (this probably needs a libao.dll included with vgmstream, though)
if ( NOT WIN32 )
# vgmstream123
add_executable ( vgmstream123
v g m s t r e a m 1 2 3 . c )
# Link to the vgmstream library as well as libao
target_link_libraries ( vgmstream123
l i b v g m s t r e a m
$ { A O _ L I B R A R Y } )
setup_target ( vgmstream123 TRUE )
# Add AO include directory
target_include_directories ( vgmstream123 PRIVATE
$ { A O _ I N C L U D E _ D I R } )
# Include the version string
target_compile_definitions ( vgmstream123 PRIVATE VERSION= "${VGMSTREAM_VERSION}" )
# Install vgmstream123
install ( TARGETS vgmstream123
R U N T I M E D E S T I N A T I O N b i n )
endif ( )