mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
Some CMake updates.
* Remove a couple TODO messages as they have already been done. * Add check for parent directory to stop warning about there being no parent scope if building vgmstream directly. * Remove the options for FDK-AAC and QAAC. * Fix a few uses of CMAKE_CURRENT_SOURCE_DIR to use VGM_SOURCE_DIR (for consistency sake). * Fix a few uses of CMAKE_BINARY_DIR to use VGM_BINARY_DIR. * Add some conditionals for the install paths so they don't show if you aren't building something.
This commit is contained in:
parent
987641d866
commit
1441caccc5
@ -2,25 +2,23 @@ cmake_minimum_required(VERSION 3.5)
|
||||
project(vgmstream C)
|
||||
enable_language(CXX)
|
||||
|
||||
# TODO: Figure out how to build audacious plugin via CMake
|
||||
# TODO: Figure out how to build XMPlay plugin via CMake
|
||||
# TODO: Figure out why MinGW-w64 doesn't build
|
||||
|
||||
if(MINGW)
|
||||
message(FATAL_ERROR "Cannot currently build with MinGW")
|
||||
endif()
|
||||
|
||||
set(VGM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
|
||||
set(VGM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
|
||||
get_directory_property(hasParent PARENT_DIRECTORY)
|
||||
if(hasParent)
|
||||
set(VGM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
|
||||
set(VGM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
|
||||
endif()
|
||||
set(VGM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(VGM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH ${VGM_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH})
|
||||
include(vgmstream)
|
||||
|
||||
# Options
|
||||
option(USE_FDKAAC "Use FDK-AAC/QAAC for support of MP4 AAC" ON)
|
||||
set(QAAC_PATH CACHE PATH "Path to QAAC")
|
||||
set(FDK_AAC_PATH CACHE PATH "Path to FDK-AAC")
|
||||
option(USE_MPEG "Use libmpg123 for support of MPEG (MP1/MP2/MP3)" ON)
|
||||
option(USE_VORBIS "Use libvorbis for support of Vorbis" ON)
|
||||
option(USE_FFMPEG "Use FFmpeg for support of many codecs" ON)
|
||||
@ -62,15 +60,15 @@ if(WIN32)
|
||||
if(MSVC)
|
||||
file(TO_NATIVE_PATH "${VGM_BINARY_DIR}/version.h" VERSION_H_PATH)
|
||||
add_custom_command(OUTPUT ${VGM_BINARY_DIR}/version.h
|
||||
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/version.bat"
|
||||
COMMAND "${VGM_SOURCE_DIR}/version.bat"
|
||||
ARGS ${VERSION_H_PATH} VERSION
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.bat)
|
||||
DEPENDS ${VGM_SOURCE_DIR}/version.bat)
|
||||
add_custom_target(version_h DEPENDS ${VGM_BINARY_DIR}/version.h)
|
||||
else()
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --tags
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
WORKING_DIRECTORY ${VGM_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE VGMSTREAM_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
@ -80,7 +78,7 @@ else()
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --tags
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
WORKING_DIRECTORY ${VGM_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE VGMSTREAM_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
@ -161,21 +159,9 @@ elseif(MSVC)
|
||||
endif()
|
||||
|
||||
# Add other projects and subdirectories as needed
|
||||
if(USE_FDKAAC)
|
||||
if(FDK_AAC_PATH)
|
||||
include(fdk-aac)
|
||||
else()
|
||||
message(FATAL_ERROR "Path to FDK-AAC must be set. (Use FDK_AAC_PATH)")
|
||||
endif()
|
||||
if(QAAC_PATH)
|
||||
include(mp4v2)
|
||||
else()
|
||||
message(FATAL_ERROR "Path to QAAC must be set. (Use QAAC_PATH)")
|
||||
endif()
|
||||
endif()
|
||||
if(USE_MAIATRAC3PLUS)
|
||||
if(MAIATRAC3PLUS_PATH)
|
||||
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${CMAKE_CURRENT_BINARY_DIR}/maitrac3plus)
|
||||
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${VGM_BINARY_DIR}/maitrac3plus)
|
||||
else()
|
||||
message(FATAL_ERROR "Path to MAIATRAC3+ must be set. (Use MAIATRAC3PLUS_PATH)")
|
||||
endif()
|
||||
@ -227,7 +213,6 @@ endif()
|
||||
# Option Summary
|
||||
message(STATUS " Option Summary")
|
||||
message(STATUS "=================")
|
||||
message(STATUS "FKD-AAC/QAAC: ${USE_FDKAAC}")
|
||||
message(STATUS " MPEG: ${USE_MPEG}")
|
||||
message(STATUS " Vorbis: ${USE_VORBIS}")
|
||||
message(STATUS " FFmpeg: ${USE_FFMPEG}")
|
||||
@ -258,12 +243,24 @@ message(STATUS "")
|
||||
message(STATUS " Install Paths")
|
||||
message(STATUS "=========================")
|
||||
if(WIN32)
|
||||
message(STATUS " CLI: ${CMAKE_INSTALL_PREFIX}/bin")
|
||||
message(STATUS "foobar2000 component: ${FB2K_COMPONENT_INSTALL_PREFIX}")
|
||||
message(STATUS " Winamp plugin: ${WINAMP_INSTALL_PREFIX}")
|
||||
message(STATUS " XMPlay plugin: ${XMPLAY_INSTALL_PREFIX}")
|
||||
if(BUILD_CLI)
|
||||
message(STATUS " CLI: ${CMAKE_INSTALL_PREFIX}/bin")
|
||||
endif()
|
||||
if(BUILD_FB2K)
|
||||
message(STATUS "foobar2000 component: ${FB2K_COMPONENT_INSTALL_PREFIX}")
|
||||
endif()
|
||||
if(BUILD_WINAMP)
|
||||
message(STATUS " Winamp plugin: ${WINAMP_INSTALL_PREFIX}")
|
||||
endif()
|
||||
if(BUILD_XMPLAY)
|
||||
message(STATUS " XMPlay plugin: ${XMPLAY_INSTALL_PREFIX}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "CLI/vgmstream123: ${CMAKE_INSTALL_PREFIX}/bin")
|
||||
message(STATUS "Audacious plugin: ${AUDACIOUS_PLUGIN_DIR}/Input")
|
||||
if(BUILD_CLI)
|
||||
message(STATUS "CLI/vgmstream123: ${CMAKE_INSTALL_PREFIX}/bin")
|
||||
endif()
|
||||
if(BUILD_AUDACIOUS)
|
||||
message(STATUS "Audacious plugin: ${AUDACIOUS_PLUGIN_DIR}/Input")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "")
|
||||
|
@ -48,7 +48,7 @@ set_target_properties(audacious_vgmstream PROPERTIES
|
||||
|
||||
# Make sure that the binary directory is included (for version.h) as well as the Audacious and GTK include directories
|
||||
target_include_directories(audacious_vgmstream PRIVATE
|
||||
${CMAKE_BINARY_DIR}
|
||||
${VGM_BINARY_DIR}
|
||||
${AUDACIOUS_INCLUDE_DIRS}
|
||||
${GTK_INCLUDE_DIRS})
|
||||
|
||||
|
@ -24,22 +24,6 @@ macro(setup_target TARGET)
|
||||
target_link_libraries(${TARGET} m)
|
||||
endif()
|
||||
|
||||
if(USE_FDKAAC)
|
||||
target_compile_definitions(${TARGET} PRIVATE
|
||||
VGM_USE_MP4V2
|
||||
VGM_USE_FDKAAC)
|
||||
target_include_directories(${TARGET} PRIVATE
|
||||
${QAAC_PATH}/mp4v2/include
|
||||
${VGM_BINARY_DIR}/mp4v2/include
|
||||
${FDK_AAC_PATH}/libSYS/include
|
||||
${FDK_AAC_PATH}/libAACdec/include)
|
||||
if(LINK)
|
||||
target_link_libraries(${TARGET}
|
||||
fdk-aac
|
||||
mp4v2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_MPEG)
|
||||
target_compile_definitions(${TARGET} PRIVATE VGM_USE_MPEG)
|
||||
if(WIN32)
|
||||
|
@ -35,7 +35,7 @@ target_compile_definitions(foo_input_vgmstream PRIVATE
|
||||
|
||||
# Make sure that the binary directory is included (for version.h), as well as foobar2000's include directories and the WTL include directory
|
||||
target_include_directories(foo_input_vgmstream PRIVATE
|
||||
${CMAKE_BINARY_DIR}
|
||||
${VGM_BINARY_DIR}
|
||||
${FB2K_SDK_PATH}/foobar2000/SDK
|
||||
${FB2K_SDK_PATH}/foobar2000/ATLHelpers
|
||||
${FB2K_SDK_PATH}/foobar2000/shared
|
||||
|
Loading…
Reference in New Issue
Block a user