diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/mongoose | |
Diffstat (limited to 'vcpkg/ports/mongoose')
| -rw-r--r-- | vcpkg/ports/mongoose/CMakeLists.txt | 36 | ||||
| -rw-r--r-- | vcpkg/ports/mongoose/portfile.cmake | 44 | ||||
| -rw-r--r-- | vcpkg/ports/mongoose/vcpkg.json | 29 |
3 files changed, 109 insertions, 0 deletions
diff --git a/vcpkg/ports/mongoose/CMakeLists.txt b/vcpkg/ports/mongoose/CMakeLists.txt new file mode 100644 index 0000000..4c36653 --- /dev/null +++ b/vcpkg/ports/mongoose/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.14) + +project(mongoose C) + +include(GNUInstallDirs) + +option(ENABLE_SSL "Build with openssl support" OFF) +option(ENABLE_PACK "Build pack for embedding read-only filesystems" OFF) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_library(mongoose mongoose.c) +target_include_directories(mongoose PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) +set_target_properties(mongoose PROPERTIES PUBLIC_HEADER mongoose.h) + +set(INSTALL_TARGETS mongoose) +if (ENABLE_PACK) + add_executable(pack test/pack.c) + list(APPEND INSTALL_TARGETS pack) + target_compile_definitions(mongoose PRIVATE MG_ENABLE_PACKED_FS=1) +endif() + +if (ENABLE_SSL) + find_package(OpenSSL REQUIRED) + target_compile_options(mongoose PRIVATE -DMG_ENABLE_SSL) + target_link_libraries(mongoose PRIVATE OpenSSL::SSL OpenSSL::Crypto) +endif() + +install(TARGETS ${INSTALL_TARGETS} EXPORT unofficial-mongoose-config) + +install( + EXPORT unofficial-mongoose-config + NAMESPACE unofficial::mongoose:: + DESTINATION share/unofficial-mongoose + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +) diff --git a/vcpkg/ports/mongoose/portfile.cmake b/vcpkg/ports/mongoose/portfile.cmake new file mode 100644 index 0000000..acb282c --- /dev/null +++ b/vcpkg/ports/mongoose/portfile.cmake @@ -0,0 +1,44 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cesanta/mongoose + REF "${VERSION}" + SHA512 791bc9fa4b9d87302c4e2dd59bbeaf9e5a3f48382d6d2b3d3026206e0ae4cd4d29adb150c4f75c5a230d2948c2f6df6f4a8defb49935d848a2229a4e5587563b + HEAD_REF master +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + ssl ENABLE_SSL + pack ENABLE_PACK +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT} CONFIG_PATH share/unofficial-${PORT}) +if ("pack" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES pack) +endif() + +if("ssl" IN_LIST FEATURES) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" + [[# Generated by CMake]] + [[# Generated by CMake +include(CMakeFindDependencyMacro) +find_dependency(OpenSSL)]]) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin") + +# Handle copyright +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/mongoose/vcpkg.json b/vcpkg/ports/mongoose/vcpkg.json new file mode 100644 index 0000000..f91f472 --- /dev/null +++ b/vcpkg/ports/mongoose/vcpkg.json @@ -0,0 +1,29 @@ +{ + "name": "mongoose", + "version": "7.19", + "description": "Embedded web server / embedded networking library", + "homepage": "https://cesanta.com/", + "license": null, + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "pack": { + "description": "Build pack for embedding read-only filesystems" + }, + "ssl": { + "description": "Build with openssl", + "dependencies": [ + "openssl" + ] + } + } +} |