Skip to content

Commit

Permalink
[thor] Support UNIX, re-fix dependency sfml (#17766)
Browse files Browse the repository at this point in the history
* [thor] Support UNIX, re-fix dependency sfml

* update baseline

* update version record

* improve portfile.cmake

* update version record
  • Loading branch information
JackBoosY authored May 13, 2021
1 parent 104b3c7 commit ab364a7
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 40 deletions.
4 changes: 0 additions & 4 deletions ports/thor/CONTROL

This file was deleted.

31 changes: 31 additions & 0 deletions ports/thor/fix-dependency-sfml.patch
Original file line number Diff line number Diff line change
@@ -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()


33 changes: 17 additions & 16 deletions ports/thor/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"
Expand All @@ -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)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/include/Aurora)

file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/thor RENAME copyright)
if(NOT VCPKG_TARGET_IS_WINDOWS)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
endif()

vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
16 changes: 0 additions & 16 deletions ports/thor/sfml-no-depend-libjpeg.patch

This file was deleted.

11 changes: 11 additions & 0 deletions ports/thor/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
2 changes: 0 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/thor.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cada171d405874f848790c8e10a7f332bbed1e6c",
"version": "2.0",
"port-version": 4
},
{
"git-tree": "99d8374185d4ab57f61811b3d65a2c542a8ad42e",
"version-string": "2.0-3",
Expand Down

0 comments on commit ab364a7

Please sign in to comment.