Add install rules to CMake scripts

This commit is contained in:
Naram Qashat 2019-03-19 22:00:48 -04:00
parent 30506a084a
commit 2dda273627
7 changed files with 94 additions and 0 deletions

View File

@ -36,8 +36,11 @@ if(WIN32)
option(BUILD_FB2K "Build foobar2000 component" ON)
set(FB2K_SDK_PATH CACHE PATH "Path to foobar2000 SDK")
set(WTL_INCLUDE_PATH CACHE PATH "Path to WTL include directory")
set(FB2K_COMPONENT_INSTALL_PREFIX CACHE PATH "Path to foobar2000 component installation directory")
option(BUILD_WINAMP "Build Winamp plugin" ON)
set(WINAMP_INSTALL_PREFIX CACHE PATH "Path to Winamp installation directory")
option(BUILD_XMPLAY "Build XMPlay plugin" ON)
set(XMPLAY_INSTALL_PREFIX CACHE PATH "Path to XMPlay installation directory")
else()
option(BUILD_AUDACIOUS "Build Audacious plugin" ON)
endif()
@ -102,6 +105,7 @@ else()
if(BUILD_AUDACIOUS)
include(FindPkgConfig)
pkg_search_module(AUDACIOUS REQUIRED audacious>=3.6)
pkg_get_variable(AUDACIOUS_PLUGIN_DIR audacious plugin_dir)
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
endif()
endif()
@ -168,6 +172,9 @@ add_subdirectory(src)
if(WIN32)
add_subdirectory(ext_libs)
if(BUILD_WINAMP)
if(NOT WINAMP_INSTALL_PREFIX)
message(FATAL_ERROR "The path to Winamp must be set. (Use WINAMP_INSTALL_PREFIX, the plugin will be installed into the Plugins directory)")
endif()
add_subdirectory(winamp)
endif()
if(BUILD_FB2K)
@ -177,6 +184,9 @@ if(WIN32)
if(NOT WTL_INCLUDE_PATH)
message(FATAL_ERROR "The path to the WTL include directory must be set. (Use WTL_INCLUDE_PATH)")
endif()
if(NOT FB2K_COMPONENT_INSTALL_PREFIX)
message(FATAL_ERROR "The path to foobar2000 must be set. (Use FB2K_COMPONENT_INSTALL_PREFIX, this is where the component will be installed)")
endif()
include_external_msproject(fb2k_sdk ${FB2K_SDK_PATH}/foobar2000/SDK/foobar2000_SDK.vcxproj)
include_external_msproject(fb2k_sdk_helpers ${FB2K_SDK_PATH}/foobar2000/helpers/foobar2000_sdk_helpers.vcxproj)
include_external_msproject(fb2k_atl_helpers ${FB2K_SDK_PATH}/foobar2000/ATLHelpers/foobar2000_ATL_helpers.vcxproj)
@ -185,6 +195,9 @@ if(WIN32)
add_subdirectory(fb2k)
endif()
if(BUILD_XMPLAY)
if(NOT XMPLAY_INSTALL_PREFIX)
message(FATAL_ERROR "The path to XMPlay must be set. (Use XMPlay_INSTALL_PREFIX, this is where the plugin will be installed)")
endif()
add_subdirectory(xmplay)
endif()
else()
@ -227,3 +240,16 @@ else()
message(STATUS " Audacious plugin: ${BUILD_AUDACIOUS}")
endif()
message(STATUS "")
# Install Summary
message(STATUS " Install Paths")
message(STATUS "=========================")
message(STATUS " CLI: ${CMAKE_INSTALL_PREFIX}/bin")
if(WIN32)
message(STATUS "foobar2000 component: ${FB2K_COMPONENT_INSTALL_PREFIX}")
message(STATUS " Winamp plugin: ${WINAMP_INSTALL_PREFIX}/Plugins")
message(STATUS " XMPlay plugin: ${XMPLAY_INSTALL_PREFIX}")
else()
message(STATUS " Audacious plugin: ${AUDACIOUS_PLUGIN_DIR}/Input")
endif()
message(STATUS "")

View File

@ -65,3 +65,7 @@ target_compile_features(audacious_vgmstream PRIVATE
cxx_strong_enums
cxx_variadic_macros
cxx_variadic_templates)
# Install the plugin
install(TARGETS audacious_vgmstream
DESTINATION ${AUDACIOUS_PLUGIN_DIR}/Input)

View File

@ -32,7 +32,14 @@ if(WIN32)
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${CMAKE_INSTALL_PREFIX}/bin)
elseif(VGMSTREAM_VERSION)
# Include the version string
target_compile_definitions(vgmstream_cli PRIVATE VERSION="${VGMSTREAM_VERSION}")
endif()
# Install the CLI program
install(TARGETS vgmstream_cli
RUNTIME DESTINATION bin)

View File

@ -127,3 +127,39 @@ macro(setup_target TARGET)
endif()
endif()
endmacro()
# Installs the DLLs to the given install prefix
macro(install_dlls INSTALL_PREFIX)
# Paths to the DLLs
set(MPEG_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libmpg123-0.dll)
set(VORBIS_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libvorbis.dll)
set(G7221_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libg7221_decode.dll)
set(G719_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libg719_decode.dll)
set(FFMPEG_DLL
${CMAKE_SOURCE_DIR}/ext_libs/avcodec-vgmstream-58.dll
${CMAKE_SOURCE_DIR}/ext_libs/avformat-vgmstream-58.dll
${CMAKE_SOURCE_DIR}/ext_libs/avutil-vgmstream-56.dll
${CMAKE_SOURCE_DIR}/ext_libs/swresample-vgmstream-3.dll)
set(ATRAC9_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libatrac9.dll)
set(CELT_DLL
${CMAKE_SOURCE_DIR}/ext_libs/libcelt-0061.dll
${CMAKE_SOURCE_DIR}/ext_libs/libcelt-0110.dll)
# List of DLLs to check for install
set(DLLS
MPEG
VORBIS
G7221
G719
FFMPEG
ATRAC9
CELT)
# Loop over DLLs and only install if the USE_* is set for that DLL
foreach(DLL ${DLLS})
if(${USE_${DLL}})
install(FILES ${${DLL}_DLL}
DESTINATION ${INSTALL_PREFIX})
endif()
endforeach()
endmacro()

View File

@ -72,3 +72,10 @@ elseif(MINGW)
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${FB2K_COMPONENT_INSTALL_PREFIX}/foo_input_vgmstream)
# Install the component
install(TARGETS foo_input_vgmstream
DESTINATION ${FB2K_COMPONENT_INSTALL_PREFIX}/foo_input_vgmstream)

View File

@ -45,3 +45,10 @@ elseif(MINGW)
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${XMPLAY_INSTALL_PREFIX})
# Install the plugin
install(TARGETS in_vgmstream
DESTINATION ${WINAMP_INSTALL_PREFIX}/Plugins)

View File

@ -31,3 +31,10 @@ elseif(MINGW)
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${XMPLAY_INSTALL_PREFIX})
# Install the plugin
install(TARGETS xmp-vgmstream
DESTINATION ${XMPLAY_INSTALL_PREFIX})