From 1faad557cd7435901d7eac7b0b7f38e3e865701c 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 2025 09:08:21 +0800 Subject: [PATCH] [webui] Add new port (#43052) Co-authored-by: jyu49 --- ports/webui/CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++++++++ ports/webui/portfile.cmake | 28 ++++++++++++++++++++ ports/webui/vcpkg.json | 26 +++++++++++++++++++ versions/baseline.json | 4 +++ versions/w-/webui.json | 9 +++++++ 5 files changed, 120 insertions(+) create mode 100644 ports/webui/CMakeLists.txt create mode 100644 ports/webui/portfile.cmake create mode 100644 ports/webui/vcpkg.json create mode 100644 versions/w-/webui.json diff --git a/ports/webui/CMakeLists.txt b/ports/webui/CMakeLists.txt new file mode 100644 index 00000000000000..5d598e4ec308e0 --- /dev/null +++ b/ports/webui/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.10) + +# Project name +project(WebUILibrary) + +# Set C++ standard +set(CMAKE_CXX_STANDARD 11) + +# Variables for library names, source files, etc. +set(WEBUI_OUT_LIB_NAME "webui-2") + +# Conditional compilation for TLS +option(WEBUI_USE_TLS "Enable TLS support" OFF) +if(WEBUI_USE_TLS) + find_package(OpenSSL REQUIRED) + set(WEBUI_OUT_LIB_NAME "webui-2-secure") +endif() + +# Source files (already filled) +set(SOURCE_FILES + src/civetweb/civetweb.c + src/webui.c +) + +add_library(webui ${SOURCE_FILES}) +target_include_directories(webui PUBLIC $ $) +target_compile_definitions(webui PUBLIC NDEBUG NO_CACHING NO_CGI USE_WEBSOCKET) +if(BUILD_SHARED_LIBS AND WIN32) + target_compile_definitions(webui PRIVATE CIVETWEB_DLL_EXPORTS PUBLIC CIVETWEB_DLL_IMPORTS) +endif() +if(WEBUI_USE_TLS) + target_compile_definitions(webui PUBLIC WEBUI_TLS WEBUI_TLS NO_SSL_DL OPENSSL_API_1_1) + target_link_libraries(webui PRIVATE OpenSSL::SSL OpenSSL::Crypto) +else() + target_compile_definitions(webui PUBLIC NO_SSL) +endif() +set_target_properties(webui PROPERTIES + OUTPUT_NAME ${WEBUI_OUT_LIB_NAME} + PREFIX "") + +install(FILES include/webui.h include/webui.hpp DESTINATION include) + +# Install targets +install(TARGETS webui + EXPORT unofficial-webui + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +install(EXPORT unofficial-webui + FILE unofficial-webui-config.cmake + NAMESPACE unofficial::webui:: + DESTINATION share/unofficial-webui +) diff --git a/ports/webui/portfile.cmake b/ports/webui/portfile.cmake new file mode 100644 index 00000000000000..0b0896e0cf2ba4 --- /dev/null +++ b/ports/webui/portfile.cmake @@ -0,0 +1,28 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO webui-dev/webui + REF "${VERSION}" + SHA512 b82321195d0684c11380691ec07e359b348c7a73c649f3f55c45e2748051b7fdd17925bdc96dc32824eb8fde74bf54bb7d778ac5384c1bb47c7841586fe54033 + HEAD_REF master +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tls WEBUI_USE_TLS +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-webui) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/webui/vcpkg.json b/ports/webui/vcpkg.json new file mode 100644 index 00000000000000..1059c0ca27d9f2 --- /dev/null +++ b/ports/webui/vcpkg.json @@ -0,0 +1,26 @@ +{ + "name": "webui", + "version": "2.4.2", + "description": "Use any web browser or WebView as GUI, with your preferred language in the backend and modern web technologies in the frontend, all in a lightweight portable library.", + "homepage": "https://github.com/webui-dev/webui", + "license": "MIT", + "supports": "!uwp & !(arm32 & android)", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tls": { + "description": "Enable TLS support", + "dependencies": [ + "openssl" + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 7a7d194841617d..2c33c882899b36 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9644,6 +9644,10 @@ "baseline": "1.0.5", "port-version": 1 }, + "webui": { + "baseline": "2.4.2", + "port-version": 0 + }, "webview2": { "baseline": "1.0.2277.86", "port-version": 0 diff --git a/versions/w-/webui.json b/versions/w-/webui.json new file mode 100644 index 00000000000000..8ceda032d11716 --- /dev/null +++ b/versions/w-/webui.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "ecb4ddbc58fde612c9aeb6003f11c057460eb4c3", + "version": "2.4.2", + "port-version": 0 + } + ] +}