Otok public index

apotocki/protobuf

apotocki/protobuf 36.2 (r1, windows)

Library
protobuf
Variant
windows, target windows
Channel
stable
Published
2026-11-14
Recipe source
https://github.com/otok-dev/recipes.git
92d81fe0aabb0cd949726f5b8011beb83fc2ae02 in recipes/protobuf/36/windows/
Recipe SHA-256
cfc933edd2760da2ef98496d8f0ccaee599d90c71cf9ab9cce34b42ed3b1918a

Recipe files changed

Inputs

source.sha2563d9642a662d10e68ebae5e53f14dcce5105684212d5078f8e0d47d1ab3ae6b64
source.urlhttps://github.com/protocolbuffers/protobuf/releases/download/v36.2/protobuf-36.2.tar.gz

Platforms

windows

Options

OptionTypeDefaultDescription
runtime enum of ["full", "lite"] "full" The runtime: full (libprotobuf: reflection, descriptors, text and JSON) or lite (libprotobuf-lite: messages optimized for code size, no reflection). A program uses one of them.
zlibadditive bool false GzipOutputStream and ZeroCopyGzip streams, with zlib.

Dependencies

LibraryVersionRecipeDetails
abseil >= 20260000 apotocki/abseil
zlib >= 1.2 apotocki/zlib when = { option = "zlib" }

Toolchains

Recipe files

build.lua 1649 bytes · raw
-- protobuf's CMake project, the runtime libraries, static, with the Abseil of deps; in the tool slice (a tool dependency, or a
-- tool a project delivers to its own build) protoc too, with libprotoc and libupb, which its upb generator needs. Nothing is
-- fetched. What it installs: libprotobuf.lib or libprotobuf-lite.lib and libutf8_validity.lib.
function build(slice, options, deps)
    local defines = {
        protobuf_BUILD_TESTS = false, protobuf_BUILD_CONFORMANCE = false, protobuf_BUILD_EXAMPLES = false,
        protobuf_BUILD_PROTOC_BINARIES = slice.is_tool, protobuf_BUILD_LIBPROTOC = slice.is_tool,
        protobuf_BUILD_LIBUPB = slice.is_tool,
        protobuf_BUILD_SHARED_LIBS = false, protobuf_MSVC_STATIC_RUNTIME = false,
        protobuf_LOCAL_DEPENDENCIES_ONLY = true, protobuf_WITH_ZLIB = options.zlib,
        absl_DIR = deps.abseil.prefix .. "/lib/cmake/absl",
    }
    if options.zlib then
        local z = deps.zlib
        defines.ZLIB_USE_STATIC_LIBS = z.linkage == "static"
        defines.ZLIB_INCLUDE_DIR = z.include
        defines.ZLIB_LIBRARY = z.libraries.z
    end
    otok.cmake{ defines = defines }
    local p = slice.prefix
    local lite = options.runtime == "lite"
    local libraries = {
        [lite and "protobuf-lite" or "protobuf"] = otok.glob(lite and "lib/libprotobuf-lite.lib" or "lib/libprotobuf.lib", p)[1],
        utf8_validity = otok.glob("lib/libutf8_validity.lib", p)[1],
    }
    local out = { libraries = libraries, headers = p .. "/include" }
    if slice.is_tool then out.programs = { protoc = p .. "/bin/protoc" .. (slice.os == "windows" and ".exe" or "") } end
    return out
end
recipe.toml 2058 bytes · raw
# The otok recipe of Protocol Buffers (https://github.com/apotocki/otok): the C++ runtime (libprotobuf or libprotobuf-lite) for Windows, from the
# release archive, with protobuf's CMake and the Abseil of deps, static; protoc for the build machine where it is a tool.
[recipe]
api = 1
library = "protobuf"
name = "protobuf"
version = "36.2"
revision = 1
license = "BSD-3-Clause"
license-files = ["LICENSE"]
homepage = "https://protobuf.dev"
documentation = "https://protobuf.dev/reference/cpp/"
description = "Protocol Buffers, Google's data interchange format: the C++ runtime, and protoc for the build machine."
keywords = ["protobuf", "serialization", "rpc"]
cxx-standard = ">= 17"
linkage = ["static"]

# protoc in the tool slice (build.lua): for the recipes that generate code with it and for projects that deliver it
[tool]
programs = ["protoc"]

[source]
url = "https://github.com/protocolbuffers/protobuf/releases/download/v36.2/protobuf-36.2.tar.gz"
sha256 = "3d9642a662d10e68ebae5e53f14dcce5105684212d5078f8e0d47d1ab3ae6b64"

[options.runtime]
type = "enum"
values = ["full", "lite"]
default = "full"
doc = "The runtime: full (libprotobuf: reflection, descriptors, text and JSON) or lite (libprotobuf-lite: messages optimized for code size, no reflection). A program uses one of them."

[options.zlib]
type = "bool"
default = false
additive = true
doc = "GzipOutputStream and ZeroCopyGzip streams, with zlib."

[platforms]
supported = ["windows"]
build-on = ["windows/msvc", "linux/clang-cl"]

[deps.abseil]
version = ">= 20260000"
default-recipe = "apotocki/abseil"

[deps.zlib]
version = ">= 1.2"
default-recipe = "apotocki/zlib"
when = { option = "zlib" }

[toolchains]
cmake = { version = ">= 3.20", default-recipe = "apotocki/cmake" }
ninja = { version = ">= 1.10", default-recipe = "apotocki/ninja" }

[[product]]
name = "Protobuf"
when = { option = "runtime", is = "full" }
libraries = ["protobuf", "utf8_validity"]

[[product]]
name = "ProtobufLite"
when = { option = "runtime", is = "lite" }
libraries = ["protobuf-lite", "utf8_validity"]