Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp-idf: Avoid re-downloading and re-extracting the slint binary archive #6107

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions api/cpp/esp-idf/slint/cmake/FindSlint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,26 @@ if (SLINT_USE_NIGHTLY_VERSION)
set(SLINT_GITHUB_RELEASE "nightly" CACHE STRING "")
endif()

set(prebuilt_archive_filename "Slint-cpp-${slint_version}-${SLINT_TARGET_ARCHITECTURE}.tar.gz")
set(prebuilt_archive_name "Slint-cpp-${slint_version}-${SLINT_TARGET_ARCHITECTURE}")
set(prebuilt_archive_filename "${prebuilt_archive_name}.tar.gz")
set(download_target_path "${CMAKE_BINARY_DIR}/slint-prebuilt/")
set(download_url "https://github.com/slint-ui/slint/releases/download/${github_release}/${prebuilt_archive_filename}")

file(MAKE_DIRECTORY "${download_target_path}")
message(STATUS "Downloading pre-built Slint binary ${download_url}")
file(DOWNLOAD "${download_url}" "${download_target_path}/${prebuilt_archive_filename}" STATUS download_status)
list(GET download_status 0 download_code)
if (NOT download_code EQUAL 0)
list(GET download_status 1 download_message)
message(STATUS "Download of Slint binary package failed: ${download_message}")
return()
if (NOT EXISTS "${download_target_path}/${prebuilt_archive_filename}")
file(DOWNLOAD "${download_url}" "${download_target_path}/${prebuilt_archive_filename}" STATUS download_status)
list(GET download_status 0 download_code)
if (NOT download_code EQUAL 0)
list(GET download_status 1 download_message)
message(STATUS "Download of Slint binary package failed: ${download_message}")
return()
endif()
endif()

if (NOT EXISTS "${download_target_path}/${prebuilt_archive_name}")
file(ARCHIVE_EXTRACT INPUT "${download_target_path}/${prebuilt_archive_filename}" DESTINATION "${download_target_path}")
endif()

file(ARCHIVE_EXTRACT INPUT "${download_target_path}/${prebuilt_archive_filename}" DESTINATION "${download_target_path}")
list(PREPEND CMAKE_PREFIX_PATH "${download_target_path}")
list(PREPEND CMAKE_PREFIX_PATH "${download_target_path}/${prebuilt_archive_name}")
find_package(Slint CONFIG)
Loading