vgmstream/winamp/CMakeLists.txt
Naram Qashat 78748393db Add CMake scripts
Needed to change how version.h was included to let it pick up the one from CMake's build location.

NOTE: Does not build with MinGW-w64 currently, does not have a way to build the audacious or XMPlay plugins.
2019-03-17 14:36:55 -04:00

39 lines
1.1 KiB
CMake

add_library(in_vgmstream SHARED
in_vgmstream.c
resource.rc)
setup_target(in_vgmstream TRUE)
# Remove the prefix and set the suffix to .dll
set_target_properties(in_vgmstream PROPERTIES
PREFIX ""
SUFFIX ".dll")
# Add the preprocessor definitions
target_compile_definitions(in_vgmstream PRIVATE
VGM_WINAMP_UNICODE
__STDC_CONSTANT_MACROS
UNICODE
_UNICODE)
# Make sure that the binary directory is included (for version.h)
target_include_directories(in_vgmstream PRIVATE ${CMAKE_BINARY_DIR})
# Link to the vgmstream library
target_link_libraries(in_vgmstream libvgmstream)
# 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
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()