From 43ddf619edf4ce8353e7d5154115d8d1f504221b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sun, 18 Aug 2019 18:22:51 +0200 Subject: [PATCH] Some Build Fixes --- .travis.yml | 4 +++- cmake/FindFFMPEG.cmake | 32 +++++++++++++++----------------- cmake/FindSDL2.cmake | 7 +++++-- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index c898925..0b7c1b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,8 +43,9 @@ matrix: - opus - openssl@1.1 - nasm + - sdl2 env: - - CMAKE_PREFIX_PATH="/usr/local/opt/openssl@1.1;/usr/local/opt/qt" + - CMAKE_PREFIX_PATH="$TRAVIS_BUILD_DIR/ffmpeg-prefix;/usr/local/opt/openssl@1.1;/usr/local/opt/qt" - CMAKE_EXTRA_ARGS="" - DEPLOY_FILE="Chiaki.dmg" after_success: @@ -59,6 +60,7 @@ script: - mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=Release + -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DCHIAKI_ENABLE_TESTS=ON -DCHIAKI_ENABLE_CLI=OFF diff --git a/cmake/FindFFMPEG.cmake b/cmake/FindFFMPEG.cmake index cfd46e6..8ad5ec9 100644 --- a/cmake/FindFFMPEG.cmake +++ b/cmake/FindFFMPEG.cmake @@ -46,14 +46,20 @@ function (_ffmpeg_find component headername) if(PKG_CONFIG_FOUND) pkg_check_modules(FFMPEG_${component} lib${component} IMPORTED_TARGET) if(FFMPEG_${component}_FOUND) - join(FFMPEG_LDFLAGS_STRING " " ${FFMPEG_${component}_LDFLAGS}) - string(REGEX REPLACE "-Wl,-framework,([^ ]+)" "-framework \\1" FFMPEG_LDFLAGS_STRING_CLEAN ${FFMPEG_LDFLAGS_STRING}) - string(REGEX MATCHALL "-framework [^ ]+" FFMPEG_FRAMEWORKS ${FFMPEG_LDFLAGS_STRING_CLEAN}) - list(APPEND FFMPEG_${component}_LIBRARIES ${FFMPEG_FRAMEWORKS}) - set_target_properties(PkgConfig::FFMPEG_${component} PROPERTIES - IMPORTED_GLOBAL TRUE - INTERFACE_LINK_DIRECTORIES "${FFMPEG_${component}_LIBRARY_DIRS}" - INTERFACE_LINK_LIBRARIES "${FFMPEG_${component}_LIBRARIES}") + if(APPLE) + join(FFMPEG_LDFLAGS_STRING " " ${FFMPEG_${component}_LDFLAGS}) + string(REGEX REPLACE "-Wl,-framework,([^ ]+)" "-framework \\1" FFMPEG_LDFLAGS_STRING_CLEAN ${FFMPEG_LDFLAGS_STRING}) + string(REGEX MATCHALL "-framework [^ ]+" FFMPEG_FRAMEWORKS ${FFMPEG_LDFLAGS_STRING_CLEAN}) + list(APPEND FFMPEG_${component}_LIBRARIES ${FFMPEG_FRAMEWORKS}) + set_target_properties(PkgConfig::FFMPEG_${component} PROPERTIES + INTERFACE_LINK_DIRECTORIES "${FFMPEG_${component}_LIBRARY_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFMPEG_${component}_LIBRARIES}" + INTERFACE_LINK_OPTIONS "") + message("set libs to \"${FFMPEG_${component}_LIBRARIES}\"") + message("set lib dirs to \"${FFMPEG_${component}_LIBRARY_DIRS}\"") + message("set lib otps not to \"${FFMPEG_${component}_LDFLAGS}\"") + endif() + set_target_properties(PkgConfig::FFMPEG_${component} PROPERTIES IMPORTED_GLOBAL TRUE) add_library(FFMPEG::${component} ALIAS PkgConfig::FFMPEG_${component}) return() endif() @@ -223,17 +229,9 @@ foreach (_ffmpeg_component IN LISTS FFMPEG_FIND_COMPONENTS) endforeach () unset(_ffmpeg_component) -if (FFMPEG_INCLUDE_DIRS) - list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) -endif () - -if(_ffmpeg_required_vars) - set(_ffmpeg_required_vars REQUIRED_VARS ${_ffmpeg_required_vars}) -endif() - include(FindPackageHandleStandardArgs) find_package_handle_standard_args(FFMPEG - ${_ffmpeg_required_vars} + REQUIRED_VARS FFMPEG_LIBRARIES VERSION_VAR FFMPEG_VERSION HANDLE_COMPONENTS) unset(_ffmpeg_required_vars) diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake index d5cfcc9..2bc61b5 100644 --- a/cmake/FindSDL2.cmake +++ b/cmake/FindSDL2.cmake @@ -1,8 +1,11 @@ find_package(SDL2 NO_MODULE QUIET) -if(SDL2_FOUND AND NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 UNKNOWN IMPORTED) +if(SDL2_FOUND AND (NOT TARGET SDL2::SDL2)) + add_library(SDL2::SDL2 UNKNOWN IMPORTED GLOBAL) + if(NOT SDL2_LIBDIR) + set(SDL2_LIBDIR "${libdir}") + endif() find_library(SDL2_LIBRARY SDL2 PATHS "${SDL2_LIBDIR}" NO_DEFAULT_PATH) if(SDL2_LIBRARY) set_target_properties(SDL2::SDL2 PROPERTIES