From 5d251aaf54c9f93416034c94ff6fc263e5e76e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Tue, 7 Jan 2020 03:48:42 +0800 Subject: [PATCH] [sdl2pp] Fix find dependencies (#9428) * [sdl2pp] Fix find dependencies * [sdl2pp] Re-fix dependencies --- ports/sdl2pp/CONTROL | 2 +- ports/sdl2pp/find-debug-libs.patch | 54 ------------------- ports/sdl2pp/fix-dependencies.patch | 82 +++++++++++++++++++++++++++++ ports/sdl2pp/portfile.cmake | 15 ++++-- 4 files changed, 93 insertions(+), 60 deletions(-) delete mode 100644 ports/sdl2pp/find-debug-libs.patch create mode 100644 ports/sdl2pp/fix-dependencies.patch diff --git a/ports/sdl2pp/CONTROL b/ports/sdl2pp/CONTROL index 6a3f7c50936..1121405378d 100644 --- a/ports/sdl2pp/CONTROL +++ b/ports/sdl2pp/CONTROL @@ -1,5 +1,5 @@ Source: sdl2pp -Version: 0.16.0-1 +Version: 0.16.0-2 Description: C++11 bindings/wrapper for SDL2 Homepage: https://sdl2pp.amdmi3.ru Build-Depends: sdl2, sdl2-mixer, sdl2-image, sdl2-ttf diff --git a/ports/sdl2pp/find-debug-libs.patch b/ports/sdl2pp/find-debug-libs.patch deleted file mode 100644 index 282324345e0..00000000000 --- a/ports/sdl2pp/find-debug-libs.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake -index 8b2addb..4def5f3 100644 ---- a/cmake/FindSDL2.cmake -+++ b/cmake/FindSDL2.cmake -@@ -8,8 +8,8 @@ - - FIND_PATH(SDL2_INCLUDE_DIR NAMES SDL.h PATH_SUFFIXES SDL2) - --FIND_LIBRARY(SDL2_LIBRARY NAMES SDL2) --FIND_LIBRARY(SDL2MAIN_LIBRARY NAMES SDL2main) -+FIND_LIBRARY(SDL2_LIBRARY NAMES SDL2d SDL2) -+FIND_LIBRARY(SDL2MAIN_LIBRARY NAMES SDL2maind SDL2main) - - INCLUDE(FindPackageHandleStandardArgs) - -diff --git a/cmake/FindSDL2_image.cmake b/cmake/FindSDL2_image.cmake -index 88adb3f..d6e829d 100644 ---- a/cmake/FindSDL2_image.cmake -+++ b/cmake/FindSDL2_image.cmake -@@ -8,7 +8,7 @@ - - FIND_PATH(SDL2_IMAGE_INCLUDE_DIR NAMES SDL_image.h PATH_SUFFIXES SDL2) - --FIND_LIBRARY(SDL2_IMAGE_LIBRARY NAMES SDL2_image) -+FIND_LIBRARY(SDL2_IMAGE_LIBRARY NAMES SDL2_imaged SDL2_image) - - INCLUDE(FindPackageHandleStandardArgs) - -diff --git a/cmake/FindSDL2_mixer.cmake b/cmake/FindSDL2_mixer.cmake -index ef5748b..c2dbbde 100644 ---- a/cmake/FindSDL2_mixer.cmake -+++ b/cmake/FindSDL2_mixer.cmake -@@ -8,7 +8,7 @@ - - FIND_PATH(SDL2_MIXER_INCLUDE_DIR NAMES SDL_mixer.h PATH_SUFFIXES SDL2) - --FIND_LIBRARY(SDL2_MIXER_LIBRARY NAMES SDL2_mixer) -+FIND_LIBRARY(SDL2_MIXER_LIBRARY NAMES SDL2_mixerd SDL2_mixer) - - INCLUDE(FindPackageHandleStandardArgs) - -diff --git a/cmake/FindSDL2_ttf.cmake b/cmake/FindSDL2_ttf.cmake -index b480d55..9fb65b9 100644 ---- a/cmake/FindSDL2_ttf.cmake -+++ b/cmake/FindSDL2_ttf.cmake -@@ -8,7 +8,7 @@ - - FIND_PATH(SDL2_TTF_INCLUDE_DIR NAMES SDL_ttf.h PATH_SUFFIXES SDL2) - --FIND_LIBRARY(SDL2_TTF_LIBRARY NAMES SDL2_ttf) -+FIND_LIBRARY(SDL2_TTF_LIBRARY NAMES SDL2_ttfd SDL2_ttf) - - INCLUDE(FindPackageHandleStandardArgs) - diff --git a/ports/sdl2pp/fix-dependencies.patch b/ports/sdl2pp/fix-dependencies.patch new file mode 100644 index 00000000000..ba4f6b9ce89 --- /dev/null +++ b/ports/sdl2pp/fix-dependencies.patch @@ -0,0 +1,82 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2a02376..ecd34d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,11 +27,15 @@ ENDIF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + + # depends + FIND_PACKAGE(SDL2 REQUIRED) +-SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_INCLUDE_DIR}) +-SET(SDL2_ALL_LIBRARIES ${SDL2_LIBRARY}) ++SET(SDL2_ALL_INCLUDE_DIRS ) ++IF (BUILD_SHARED_LIBS) ++ SET(SDL2_ALL_LIBRARIES SDL2::SDL2) ++ELSE() ++ SET(SDL2_ALL_LIBRARIES SDL2::SDL2-static) ++ENDIF() + SET(SDL2_ALL_PKGCONFIG_MODULES sdl2) +-SET(SDL2PP_EXTRA_LIBRARIES ${SDL2MAIN_LIBRARY}) +-SET(SDL2PP_EXTRA_PKGCONFIG_LIBRARIES ${SDL2MAIN_LIBRARY}) ++SET(SDL2PP_EXTRA_LIBRARIES SDL2::SDL2main) ++SET(SDL2PP_EXTRA_PKGCONFIG_LIBRARIES SDL2::SDL2main) + + IF(MINGW) + SET(MINGW32_LIBRARY "mingw32" CACHE STRING "mingw32 library") +@@ -40,27 +44,27 @@ IF(MINGW) + ENDIF(MINGW) + + IF(SDL2PP_WITH_IMAGE) +- FIND_PACKAGE(SDL2_image REQUIRED) +- SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIR}) +- SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} ${SDL2_IMAGE_LIBRARY}) ++ FIND_PACKAGE(sdl2-image CONFIG REQUIRED) ++ SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS}) ++ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_image) + SET(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_image") + ELSE(SDL2PP_WITH_IMAGE) + MESSAGE(STATUS "SDL2_image support disabled") + ENDIF(SDL2PP_WITH_IMAGE) + + IF(SDL2PP_WITH_TTF) +- FIND_PACKAGE(SDL2_ttf REQUIRED) +- SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIR}) +- SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} ${SDL2_TTF_LIBRARY}) ++ FIND_PACKAGE(sdl2-ttf CONFIG REQUIRED) ++ SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS}) ++ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_ttf) + SET(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_ttf") + ELSE(SDL2PP_WITH_TTF) + MESSAGE(STATUS "SDL2_ttf support disabled") + ENDIF(SDL2PP_WITH_TTF) + + IF(SDL2PP_WITH_MIXER) +- FIND_PACKAGE(SDL2_mixer REQUIRED) +- SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIR}) +- SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} ${SDL2_MIXER_LIBRARY}) ++ FIND_PACKAGE(sdl2-mixer CONFIG REQUIRED) ++ SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS}) ++ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_mixer) + SET(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_mixer") + ELSE(SDL2PP_WITH_MIXER) + MESSAGE(STATUS "SDL2_mixer support disabled") +@@ -94,7 +98,6 @@ ELSE(MSVC) + #APPEND_CXX_FLAG_IF_SUPPORTED(-Wno-padded SDL2PP_WARNINGS) + ENDIF(MSVC) + +-LIST(REMOVE_DUPLICATES SDL2_ALL_INCLUDE_DIRS) + + INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}) + INCLUDE_DIRECTORIES(SYSTEM ${SDL2_ALL_INCLUDE_DIRS}) +@@ -217,10 +220,10 @@ IF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + OPTION(SDL2PP_STATIC "Build static library instead of shared one" OFF) + + # library +- IF(SDL2PP_STATIC) ++ IF(0) + ADD_LIBRARY(SDL2pp STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS}) + ELSE(SDL2PP_STATIC) +- ADD_LIBRARY(SDL2pp SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS}) ++ ADD_LIBRARY(SDL2pp ${LIBRARY_SOURCES} ${LIBRARY_HEADERS}) + TARGET_LINK_LIBRARIES(SDL2pp ${SDL2_ALL_LIBRARIES}) + SET_TARGET_PROPERTIES(SDL2pp PROPERTIES VERSION 8.3.0 SOVERSION 8) + ENDIF(SDL2PP_STATIC) diff --git a/ports/sdl2pp/portfile.cmake b/ports/sdl2pp/portfile.cmake index 7fbaf9c693a..3d843a65114 100644 --- a/ports/sdl2pp/portfile.cmake +++ b/ports/sdl2pp/portfile.cmake @@ -1,11 +1,16 @@ -include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libSDL2pp/libSDL2pp REF 0.16.0 SHA512 36603a0b1c3ba9294fffa5368357866e5689ceed9743352ff52c096d8b0070cc3f8708a5e837c10c871b410b6bda3ed7e8e3b95cb9afc136d91afb035cde6361 HEAD_REF master - PATCHES "${CMAKE_CURRENT_LIST_DIR}/find-debug-libs.patch" + PATCHES fix-dependencies.patch +) + +file(REMOVE ${SOURCE_PATH}/cmake/FindSDL2.cmake + ${SOURCE_PATH}/cmake/FindSDL2_image.cmake + ${SOURCE_PATH}/cmake/FindSDL2_mixer.cmake + ${SOURCE_PATH}/cmake/FindSDL2_ttf.cmake ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SDL2PP_STATIC) @@ -21,8 +26,8 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -# Handle copyright -file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2pp RENAME copyright) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file