Relativized CMake

This commit is contained in:
Lukas Cone 2020-01-07 18:42:33 +01:00
parent c479bdb590
commit d170b10812
3 changed files with 19 additions and 16 deletions

View File

@ -10,7 +10,7 @@ if(MINGW)
message(FATAL_ERROR "Cannot currently build with MinGW")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH})
include(vgmstream)
# Options

View File

@ -1,3 +1,5 @@
set(VGMSTREAM_EXT_INCLUDES ../ext_includes)
if(MSVC)
if(USE_MPEG)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.exp
@ -7,8 +9,8 @@ if(MSVC)
add_custom_target(libmpg123
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib
SOURCES
${CMAKE_SOURCE_DIR}/ext_includes/fmt123.h
${CMAKE_SOURCE_DIR}/ext_includes/mpg123.h)
${VGMSTREAM_EXT_INCLUDES}/fmt123.h
${VGMSTREAM_EXT_INCLUDES}/mpg123.h)
endif()
if(USE_VORBIS)
@ -16,8 +18,8 @@ if(MSVC)
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def)
file(GLOB OGG_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/ogg/*.h")
file(GLOB VORBIS_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/vorbis/*h")
file(GLOB OGG_HEADERS "${VGMSTREAM_EXT_INCLUDES}/ogg/*.h")
file(GLOB VORBIS_HEADERS "${VGMSTREAM_EXT_INCLUDES}/vorbis/*h")
add_custom_target(libvorbis
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
SOURCES
@ -34,7 +36,7 @@ if(MSVC)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg7221_decode.def)
add_custom_target(libg7221_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/g7221.h)
SOURCES ${VGMSTREAM_EXT_INCLUDES}/g7221.h)
endif()
if(USE_G719)
@ -44,7 +46,7 @@ if(MSVC)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg719_decode.def)
add_custom_target(libg719_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/g719.h)
SOURCES ${VGMSTREAM_EXT_INCLUDES}/g719.h)
endif()
if(USE_FFMPEG)
@ -64,10 +66,10 @@ if(MSVC)
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/swresample.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def)
file(GLOB AVCODEC_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavcodec/*.h")
file(GLOB AVFORMAT_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavformat/*.h")
file(GLOB AVUTIL_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavutil/*.h")
file(GLOB SWRESAMPLE_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libswresample/*.h")
file(GLOB AVCODEC_HEADERS "${VGMSTREAM_EXT_INCLUDES}/libavcodec/*.h")
file(GLOB AVFORMAT_HEADERS "${VGMSTREAM_EXT_INCLUDES}/libavformat/*.h")
file(GLOB AVUTIL_HEADERS "${VGMSTREAM_EXT_INCLUDES}/libavutil/*.h")
file(GLOB SWRESAMPLE_HEADERS "${VGMSTREAM_EXT_INCLUDES}/libswresample/*.h")
add_custom_target(ffmpeg
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib
@ -92,7 +94,7 @@ if(MSVC)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libatrac9.def)
add_custom_target(libatrac9
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/libatrac9.h)
SOURCES ${VGMSTREAM_EXT_INCLUDES}/libatrac9.h)
endif()
if(USE_CELT)
@ -104,7 +106,7 @@ if(MSVC)
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def)
file(GLOB CELT_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/celt/*.h")
file(GLOB CELT_HEADERS "${VGMSTREAM_EXT_INCLUDES}/celt/*.h")
add_custom_target(libcelt
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib

View File

@ -5,10 +5,10 @@ file(GLOB LAYOUT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/layout/*.c")
file(GLOB META_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/meta/*.h")
file(GLOB META_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/meta/*.c")
set(EXT_HEADERS
${CMAKE_SOURCE_DIR}/ext_includes/clHCA.h
${CMAKE_SOURCE_DIR}/ext_includes/pstdint.h)
${CMAKE_CURRENT_SOURCE_DIR}/../ext_includes/clHCA.h
${CMAKE_CURRENT_SOURCE_DIR}/../ext_includes/pstdint.h)
set(EXT_SOURCES
${CMAKE_SOURCE_DIR}/ext_libs/clHCA.c)
${CMAKE_CURRENT_SOURCE_DIR}/../ext_libs/clHCA.c)
file(GLOB MAIN_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
file(GLOB MAIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
@ -42,6 +42,7 @@ setup_target(libvgmstream)
# Set up the proper include directories
target_include_directories(libvgmstream PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../ext_includes
coding
layout
meta)