mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-05 03:17:57 +01:00
55 lines
1.6 KiB
CMake
55 lines
1.6 KiB
CMake
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})
|
|
|
|
add_library(in_vgmstream SHARED
|
|
${WINAMP_SDK_HEADERS}
|
|
resource.h
|
|
in_vgmstream.c
|
|
${RESOURCES})
|
|
|
|
# Link to the vgmstream library
|
|
target_link_libraries(in_vgmstream libvgmstream)
|
|
|
|
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})
|
|
|
|
# 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()
|
|
|
|
# Install the DLLs
|
|
install_dlls(${WINAMP_INSTALL_PREFIX})
|
|
|
|
# Install the plugin
|
|
install(TARGETS in_vgmstream
|
|
DESTINATION ${WINAMP_INSTALL_PREFIX}/Plugins)
|