[thor] Support UNIX, re-fix dependency sfml (#17766)

* [thor] Support UNIX, re-fix dependency sfml

* update baseline

* update version record

* improve portfile.cmake

* update version record
This commit is contained in:
Jack·Boos·Yu 2021-05-14 04:16:46 +08:00 committed by GitHub
parent 104b3c7625
commit ab364a7e56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 40 deletions

View File

@ -1,4 +0,0 @@
Source: thor
Version: 2.0-3
Description: Extends the multimedia library SFML with higher-level features
Build-Depends: sfml, aurora

View File

@ -0,0 +1,31 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03536be..abcff44 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,11 +115,10 @@ set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/;${CMAKE_MODULE_PATH
if(NOT THOR_SHARED_LIBS)
set(SFML_STATIC_LIBRARIES TRUE)
endif()
-find_package(SFML 2 COMPONENTS audio graphics window system)
+find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED)
+set(SFML_LIBRARIES sfml-system sfml-network sfml-graphics sfml-window)
-if(SFML_FOUND)
- include_directories(${SFML_INCLUDE_DIR})
-else()
+if(0)
set(SFML_ROOT "" CACHE PATH "SFML top-level directory")
message("\n-> SFML directory not found. Set SFML_ROOT to SFML's top-level path (containing \"include\" and \"lib\" directories).")
message("-> Make sure the SFML libraries with the same configuration (Release/Debug, Static/Dynamic) exist.\n")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 75e118e..0f90ac8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -72,6 +72,7 @@ else()
add_library(${THOR_LIB} STATIC ${THOR_SRC})
set_target_properties(${THOR_LIB} PROPERTIES DEBUG_POSTFIX -s-d)
set_target_properties(${THOR_LIB} PROPERTIES RELEASE_POSTFIX -s)
+ thor_link_sfml(${THOR_LIB})
endif()

View File

@ -4,8 +4,9 @@ vcpkg_from_github(ARCHIVE
REF v2.0
SHA512 634fa5286405d9a8a837c082ace98bbb02e609521418935855b9e2fcad57003dbe35088bd771cf6a9292e55d3787f7e463d7a4cca0d0f007509de2520d9a8cf9
HEAD_REF master
PATCHES "${CMAKE_CURRENT_LIST_DIR}/sfml-no-depend-libjpeg.patch"
PATCHES fix-dependency-sfml.patch
)
file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindSFML.cmake)
file(REMOVE_RECURSE ${SOURCE_PATH}/extlibs)
file(COPY ${CURRENT_INSTALLED_DIR}/include/Aurora DESTINATION ${SOURCE_PATH}/extlibs/aurora/include)
@ -24,15 +25,17 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
set(CONFIG_FILE "${CURRENT_PACKAGES_DIR}/include/Thor/Config.hpp")
vcpkg_copy_pdbs()
file(READ ${CONFIG_FILE} CONFIG_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(REPLACE "defined(SFML_STATIC)" "1" CONFIG_H "${CONFIG_H}")
else()
string(REPLACE "defined(SFML_STATIC)" "0" CONFIG_H "${CONFIG_H}")
endif()
file(WRITE ${CONFIG_FILE} "${CONFIG_H}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/Thor/Config.hpp"
"defined(SFML_STATIC)" "1"
)
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/Thor/Config.hpp"
"defined(SFML_STATIC)" "0"
)
endif()
file(GLOB LICENSE
"${CURRENT_PACKAGES_DIR}/debug/LicenseThor.txt"
@ -45,12 +48,10 @@ if(LICENSE)
file(REMOVE ${LICENSE})
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/Aurora)
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/include/Aurora)
if(NOT VCPKG_TARGET_IS_WINDOWS)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
endif()
file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/thor RENAME copyright)
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -1,16 +0,0 @@
diff --git a/cmake/Modules/FindSFML.cmake b/cmake/Modules/FindSFML.cmake
index 48873ef..a1834f6 100644
--- a/cmake/Modules/FindSFML.cmake
+++ b/cmake/Modules/FindSFML.cmake
@@ -312,10 +312,9 @@ if(SFML_STATIC_LIBRARIES)
# find libraries
find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
- find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg)
# update the list
- set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
+ set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY})
set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
endif()

11
ports/thor/vcpkg.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "thor",
"version": "2.0",
"port-version": 4,
"description": "Extends the multimedia library SFML with higher-level features",
"homepage": "www.bromeon.ch/libraries/thor",
"dependencies": [
"aurora",
"sfml"
]
}

View File

@ -1570,8 +1570,6 @@ theia:x64-windows = skip
theia:x64-windows-static = skip
theia:x64-windows-static-md=skip
theia:x86-windows = skip
thor:x64-linux=fail
thor:x64-osx=fail
tidy-html5:arm-uwp=fail
tidy-html5:x64-uwp=fail
tinkerforge:arm-uwp=fail

View File

@ -5997,8 +5997,8 @@
"port-version": 0
},
"thor": {
"baseline": "2.0-3",
"port-version": 0
"baseline": "2.0",
"port-version": 4
},
"threadpool": {
"baseline": "0.2.5",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cada171d405874f848790c8e10a7f332bbed1e6c",
"version": "2.0",
"port-version": 4
},
{
"git-tree": "99d8374185d4ab57f61811b3d65a2c542a8ad42e",
"version-string": "2.0-3",