Improved build system to check compile time dependencies
This commit is contained in:
+4
-1
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.12)
|
|||||||
|
|
||||||
project(lms)
|
project(lms)
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
@@ -11,6 +10,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|||||||
include(CTest)
|
include(CTest)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
find_package(Filesystem REQUIRED)
|
find_package(Filesystem REQUIRED)
|
||||||
|
find_package(FFMPEGAV REQUIRED)
|
||||||
|
find_package(Taglib REQUIRED)
|
||||||
|
find_package(Boost REQUIRED COMPONENTS system)
|
||||||
|
find_package(PStreams REQUIRED)
|
||||||
pkg_check_modules(GRAPHICSMAGICKXX REQUIRED GraphicsMagick++)
|
pkg_check_modules(GRAPHICSMAGICKXX REQUIRED GraphicsMagick++)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Quick and dirty av* includes discoverer
|
||||||
|
|
||||||
|
find_path(AVCODEC_INCLUDE_DIR NAMES libavcodec/avcodec.h PATH_SUFFIXES ffmpeg)
|
||||||
|
find_library(AVCODEC_LIBRARY avcodec)
|
||||||
|
|
||||||
|
find_path(AVFORMAT_INCLUDE_DIR NAMES libavformat/avformat.h PATH_SUFFIXES ffmpeg)
|
||||||
|
find_library(AVFORMAT_LIBRARY avformat)
|
||||||
|
|
||||||
|
find_path(AVUTIL_INCLUDE_DIR NAMES libavutil/avutil.h PATH_SUFFIXES ffmpeg)
|
||||||
|
find_library(AVUTIL_LIBRARY avutil)
|
||||||
|
|
||||||
|
find_path(AVDEVICE_INCLUDE_DIR NAMES libavdevice/avdevice.h PATH_SUFFIXES ffmpeg)
|
||||||
|
find_library(AVDEVICE_LIBRARY avdevice)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||||
|
FFMPEGAV
|
||||||
|
FOUND_VAR FFMPEGAV_FOUND
|
||||||
|
REQUIRED_VARS AVUTIL_LIBRARY AVFORMAT_LIBRARY
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(AVFORMAT_LIBRARY)
|
||||||
|
mark_as_advanced(AVUTIL_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# If already in cache, be silent
|
||||||
|
if(PSTREAMS_INCLUDE_DIRS)
|
||||||
|
set (PSTREAMS_FIND_QUIETLY TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
FIND_PATH(PSTREAMS_INCLUDE_DIR NAMES pstream.h
|
||||||
|
PATH_SUFFIXES pstreams
|
||||||
|
HINTS ${PSTREAMS_ROOT}/include $ENV{PSTREAMS_ROOT})
|
||||||
|
|
||||||
|
set(PSTREAMS_INCLUDE_DIRS ${PSTREAMS_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# Handle the QUIETLY and REQUIRED arguments and set PSTREAMS_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE.
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pstreams DEFAULT_MSG PSTREAMS_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(PSTREAMS_INCLUDE_DIRS)
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
# - Try to find the Taglib library
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# TAGLIB_FOUND - system has the taglib library
|
||||||
|
# TAGLIB_CFLAGS - the taglib cflags
|
||||||
|
# TAGLIB_LIBRARIES - The libraries needed to use taglib
|
||||||
|
|
||||||
|
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
IF(TAGLIB_FOUND)
|
||||||
|
MESSAGE(STATUS "Using manually specified taglib locations")
|
||||||
|
ELSE()
|
||||||
|
|
||||||
|
if(NOT TAGLIB_MIN_VERSION)
|
||||||
|
set(TAGLIB_MIN_VERSION "1.6")
|
||||||
|
endif(NOT TAGLIB_MIN_VERSION)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS
|
||||||
|
${BIN_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
endif(NOT WIN32)
|
||||||
|
|
||||||
|
#reset vars
|
||||||
|
set(TAGLIB_LIBRARIES)
|
||||||
|
set(TAGLIB_CFLAGS)
|
||||||
|
|
||||||
|
# MESSAGE( STATUS "PATHS: ${PATHS}")
|
||||||
|
# if taglib-config has been found
|
||||||
|
if(TAGLIBCONFIG_EXECUTABLE)
|
||||||
|
|
||||||
|
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION)
|
||||||
|
|
||||||
|
if(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
|
||||||
|
message(STATUS "TagLib version not found: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}")
|
||||||
|
set(TAGLIB_FOUND FALSE)
|
||||||
|
else(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
|
||||||
|
|
||||||
|
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES)
|
||||||
|
|
||||||
|
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS)
|
||||||
|
|
||||||
|
if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
|
||||||
|
set(TAGLIB_FOUND TRUE)
|
||||||
|
# message(STATUS "Found taglib: ${TAGLIB_LIBRARIES}")
|
||||||
|
endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
|
||||||
|
string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES "${TAGLIB_CFLAGS}")
|
||||||
|
endif(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
|
||||||
|
mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES)
|
||||||
|
|
||||||
|
else(TAGLIBCONFIG_EXECUTABLE)
|
||||||
|
|
||||||
|
include(FindLibraryWithDebug)
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_path(TAGLIB_INCLUDES
|
||||||
|
NAMES
|
||||||
|
tag.h
|
||||||
|
PATH_SUFFIXES taglib
|
||||||
|
PATHS
|
||||||
|
${INCLUDE_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library_with_debug(TAGLIB_LIBRARIES
|
||||||
|
WIN32_DEBUG_POSTFIX d
|
||||||
|
NAMES tag
|
||||||
|
PATHS
|
||||||
|
${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(Taglib DEFAULT_MSG
|
||||||
|
TAGLIB_INCLUDES TAGLIB_LIBRARIES)
|
||||||
|
endif(TAGLIBCONFIG_EXECUTABLE)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
if(TAGLIB_FOUND)
|
||||||
|
if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
|
||||||
|
message(STATUS "Found TagLib: ${TAGLIB_LIBRARIES}")
|
||||||
|
endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
|
||||||
|
else(TAGLIB_FOUND)
|
||||||
|
if(Taglib_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find Taglib")
|
||||||
|
endif(Taglib_FIND_REQUIRED)
|
||||||
|
endif(TAGLIB_FOUND)
|
||||||
@@ -8,11 +8,20 @@ add_library(lmsav SHARED
|
|||||||
|
|
||||||
target_include_directories(lmsav INTERFACE
|
target_include_directories(lmsav INTERFACE
|
||||||
include
|
include
|
||||||
|
${AVFORMAT_INCLUDE_DIR}
|
||||||
|
${AVUTIL_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
# ${AVCODEC_INCLUDE_DIR}
|
||||||
|
# ${AVDEVICE_INCLUDE_DIR}
|
||||||
|
|
||||||
target_include_directories(lmsav PRIVATE
|
target_include_directories(lmsav PRIVATE
|
||||||
include/
|
include/
|
||||||
|
|
||||||
|
${AVFORMAT_INCLUDE_DIR}
|
||||||
|
${AVUTIL_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
# ${AVCODEC_INCLUDE_DIR}
|
||||||
|
# ${AVDEVICE_INCLUDE_DIR}
|
||||||
|
|
||||||
# TODO make these private
|
# TODO make these private
|
||||||
target_link_libraries(lmsav PUBLIC
|
target_link_libraries(lmsav PUBLIC
|
||||||
@@ -21,6 +30,8 @@ target_link_libraries(lmsav PUBLIC
|
|||||||
avutil
|
avutil
|
||||||
std::filesystem
|
std::filesystem
|
||||||
wt
|
wt
|
||||||
|
${AVFORMAT_LIBRARY}
|
||||||
|
${AVUTIL_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS lmsav DESTINATION lib)
|
install(TARGETS lmsav DESTINATION lib)
|
||||||
|
|||||||
Reference in New Issue
Block a user