vgmstream/winamp/CMakeLists.txt

57 lines
1.7 KiB
CMake
Raw Normal View History

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")
# 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}
2021-04-18 13:04:00 +02:00
${WINAMP_HEADERS}
${WINAMP_SOURCES}
${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 ${VGM_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 VGMSTREAM_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()
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
DESTINATION ${WINAMP_INSTALL_PREFIX}/Plugins)