[elements] Update to 2024-09-12 and fix dependencies (#41774)

Co-authored-by: Monica <v-liumonica@microsoft.com>
This commit is contained in:
MonicaLiu 2024-11-05 20:46:14 +00:00 committed by GitHub
parent 1938443854
commit 1fa19b06cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 59 additions and 83 deletions

View File

@ -1,14 +0,0 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index e8179fbe..29b420c7 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -288,7 +288,8 @@ endif()
###############################################################################
# Asio headers
-target_include_directories(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/asio/asio/include)
+find_path(ASIO_INCLUDE_DIR asio.hpp)
+target_include_directories(elements PUBLIC ${ASIO_INCLUDE_DIR})
###############################################################################
# Global options

View File

@ -0,0 +1,38 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index e84ca98..7a06ed2 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -226,14 +226,7 @@ endif()
###############################################################################
# Cycfi Infra
-FetchContent_Declare(
- cycfi_infra
- GIT_REPOSITORY https://github.com/cycfi/infra.git
- GIT_TAG master
- GIT_SUBMODULES_RECURSE ON
-)
-
-FetchContent_MakeAvailable(cycfi_infra)
+add_subdirectory(infra)
target_link_libraries(elements PUBLIC cycfi::infra)
###############################################################################
@@ -272,15 +265,8 @@ endif()
###############################################################################
# Asio headers
-FetchContent_Declare(
- asio
- GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git
- GIT_TAG asio-1-29-0
- GIT_SHALLOW TRUE
-)
-FetchContent_MakeAvailable(asio)
-
-target_include_directories(elements PUBLIC ${asio_SOURCE_DIR}/asio/include)
+find_package(asio CONFIG REQUIRED)
+target_include_directories(elements PUBLIC ${ASIO_INCLUDE_DIR})
###############################################################################
# Global options

View File

@ -1,23 +1,20 @@
if(VCPKG_TARGET_IS_WINDOWS) vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO cycfi/elements REPO cycfi/elements
REF e2c891bb37b506e3281b902fc0fcc75a5577e476 REF 663dcdb82dffa9e70cf6643b50ed56a39c8015ed
SHA512 3f54c3dcf3fab17eca6a6105f0e77a28a1b77d6354dac12c373c7da84d280abdc8d5bcbe9c42bbc3e38284acbfeb57392ef2538ef7118dd5c34cae29a4e88855 SHA512 4fc579df6dd471c69996a991e4b2c4c204e7f02d1d247de7a962fcd97d472cb63b58faa2ab7a0cfb47cc004a03483d4ef9123cbd8f562ba7007d779ba03221ca
HEAD_REF master HEAD_REF master
PATCHES PATCHES
asio-headers.patch fix-dependencies.patch
win-find-libraries.patch
) )
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH INFRA_SOURCE_PATH OUT_SOURCE_PATH INFRA_SOURCE_PATH
REPO cycfi/infra REPO cycfi/infra
REF 6bc1cc62e3d0a31f92506a577beca3b400b54544 REF 965ecdb953c8c1187b327cff12655f9a92352acc
SHA512 ceb5acb36210b4fcf4ef3931e718ae1cb09941cc61caab1d20d09003bae2b20fda092e4b1af1bb58444de75f73c04d0651eb5126a87dab7ce14a1b914bccec27 SHA512 37d990ec70aa37dded3d464cadc28cedd320986ea5816669698de43376bb77d0f32951f0f8a03af65a472a46886ddf628e7acfd0314dd5ebfa49a3e98984054f
HEAD_REF master HEAD_REF master
) )
if(NOT EXISTS "${SOURCE_PATH}/lib/infra/CMakeLists.txt") if(NOT EXISTS "${SOURCE_PATH}/lib/infra/CMakeLists.txt")
@ -34,11 +31,14 @@ else()
set(ELEMENTS_HOST_UI_LIBRARY "gtk") set(ELEMENTS_HOST_UI_LIBRARY "gtk")
endif() endif()
vcpkg_find_acquire_program(PKGCONFIG)
vcpkg_cmake_configure( vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
OPTIONS OPTIONS
-DELEMENTS_BUILD_EXAMPLES=OFF -DELEMENTS_BUILD_EXAMPLES=OFF
-DELEMENTS_HOST_UI_LIBRARY=${ELEMENTS_HOST_UI_LIBRARY} -DELEMENTS_HOST_UI_LIBRARY=${ELEMENTS_HOST_UI_LIBRARY}
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
) )
vcpkg_cmake_build() vcpkg_cmake_build()

View File

@ -1,17 +1,20 @@
{ {
"name": "elements", "name": "elements",
"version-date": "2022-12-07", "version-date": "2024-09-12",
"port-version": 1,
"description": "Elements is a lightweight, fine-grained, resolution independent, modular GUI library.", "description": "Elements is a lightweight, fine-grained, resolution independent, modular GUI library.",
"homepage": "https://cycfi.github.io/elements", "homepage": "https://cycfi.github.io/elements",
"license": "MIT", "license": "MIT",
"supports": "(windows & staticcrt) | osx | linux",
"dependencies": [ "dependencies": [
"asio", "asio",
"cairo", "cairo",
"fontconfig",
"freetype",
{ {
"name": "gtk3", "name": "gtk3",
"platform": "!osx & !windows" "platform": "!osx & !windows"
}, },
"libwebp",
{ {
"name": "vcpkg-cmake", "name": "vcpkg-cmake",
"host": true "host": true

View File

@ -1,56 +0,0 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index e8179fbe..f3ac5ddf 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -215,13 +215,13 @@ endif()
# Cairo
if (MSVC)
- target_include_directories(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/cairo/include)
+ find_path(Cairo_INCLUDE_DIR cairo/cairo.h)
+ list(APPEND Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR})
+ list(APPEND Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR}/cairo)
+ target_include_directories(elements PUBLIC ${Cairo_INCLUDE_DIRS})
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- target_link_libraries(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/cairo/lib/x64/cairo.lib)
- else()
- target_link_libraries(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/cairo/lib/x86/cairo.lib)
- endif()
+ find_library(Cairo_LIBRARY cairo)
+ target_link_libraries(elements PUBLIC ${Cairo_LIBRARY})
elseif (APPLE)
# TODO: add a min version specifiction
pkg_check_modules(cairo REQUIRED IMPORTED_TARGET cairo)
@@ -240,13 +240,8 @@ endif()
# Fontconfig
if (MSVC)
- target_include_directories(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/fontconfig/include)
-
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- target_link_libraries(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/fontconfig/x64/fontconfig.lib)
- else()
- target_link_libraries(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/fontconfig/x86/fontconfig.lib)
- endif()
+ find_package(Fontconfig REQUIRED)
+ target_link_libraries(elements PUBLIC Fontconfig::Fontconfig)
elseif (APPLE)
pkg_check_modules(fontconfig REQUIRED IMPORTED_TARGET fontconfig)
target_include_directories(elements PUBLIC ${fontconfig_INCLUDE_DIRS})
@@ -261,13 +256,8 @@ endif()
# Freetype
if (MSVC)
- target_include_directories(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/include)
-
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- target_link_libraries(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/win64/freetype.lib)
- else()
- target_link_libraries(elements PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/win32/freetype.lib)
- endif()
+ find_package(Freetype REQUIRED)
+ target_link_libraries(elements PUBLIC Freetype::Freetype)
elseif (APPLE)
pkg_check_modules(freetype2 REQUIRED IMPORTED_TARGET freetype2)
target_include_directories(elements PUBLIC ${freetype2_INCLUDE_DIRS})

View File

@ -2545,8 +2545,8 @@
"port-version": 4 "port-version": 4
}, },
"elements": { "elements": {
"baseline": "2022-12-07", "baseline": "2024-09-12",
"port-version": 1 "port-version": 0
}, },
"elfio": { "elfio": {
"baseline": "3.12", "baseline": "3.12",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "c0514f653f33627cfd7cec2f34186f9128a5c571",
"version-date": "2024-09-12",
"port-version": 0
},
{ {
"git-tree": "1ab41f4881c43e4119c9f80141820e016db62ebf", "git-tree": "1ab41f4881c43e4119c9f80141820e016db62ebf",
"version-date": "2022-12-07", "version-date": "2022-12-07",