Otok public index

apotocki/tomlplusplus

apotocki/tomlplusplus 3.4.0 (r1, apple)

Library
tomlplusplus
Variant
apple, target apple
Channel
stable
Published
2026-11-14
Recipe source
https://github.com/otok-dev/recipes.git
6c56f79ab6e33f4577ff7b5703c9c7fba9116836 in recipes/tomlplusplus/3.4/apple/
Recipe SHA-256
e7a3d8d2a46055c89c9a096544e559486389e7c6355c8b17b8c28a11aeee55f2

Recipe files changed

Inputs

source.commit30172438cee64926dc41fdd9c11fb3ba5b2ba9de
source.githttps://github.com/marzer/tomlplusplus
source.tagv3.4.0

Platforms

ios, iossim, macosx, catalyst, tvos, tvossim, watchos, watchossim, xros, xrossim

Options

OptionTypeDefaultDescription
compiledadditive bool false Compile the implementation into a library (TOML_HEADER_ONLY=0), linked through the product TomlPlusPlusLib, instead of compiling it in every translation unit of the consumer. The headers of the product TomlPlusPlus then need that library.

Toolchains

Recipe files

CMakeLists.txt 1077 bytes · raw
# libtomlplusplus of the otok recipe: src/toml.cpp compiled as the library, as toml++'s meson.build does with
# build_lib (its CMake project is header-only), static or shared as BUILD_SHARED_LIBS says.
cmake_minimum_required(VERSION 3.20...4.0)
project(tomlplusplus VERSION 3.4.0 LANGUAGES CXX)

add_library(tomlplusplus src/toml.cpp)
target_include_directories(tomlplusplus PRIVATE include)
target_compile_definitions(tomlplusplus PRIVATE TOML_HEADER_ONLY=0)
if(BUILD_SHARED_LIBS)
    # TOML_SHARED_LIB: dllexport on Windows, default visibility of the exported classes and functions elsewhere
    target_compile_definitions(tomlplusplus PRIVATE TOML_SHARED_LIB=1)
    set_target_properties(tomlplusplus PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)
endif()
# the soname of meson's build: libtomlplusplus.so.3
set_target_properties(tomlplusplus PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 3)

install(TARGETS tomlplusplus RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(DIRECTORY include/toml++ DESTINATION include)
build.lua 1407 bytes · raw
-- toml++: its headers (include/toml++), or with the option `compiled` the library of src/toml.cpp through the
-- recipe's CMakeLists.txt. The headers of a compiled toml++ state TOML_HEADER_ONLY 0 (and TOML_SHARED_LIB 1 for a
-- shared library) themselves, in toml++/impl/preprocessor.hpp, so that every consumer compiles with the configuration
-- the library was built with, also C++ on Apple, which the defines of a product do not reach without modules.
function build(slice, options, deps)
    local p = slice.prefix
    if not options.compiled then
        otok.copy(slice.source .. "/include/toml++", p .. "/include/toml++")
        return { libraries = {}, headers = p .. "/include" }
    end
    otok.copy(slice.recipe .. "/CMakeLists.txt", slice.source .. "/CMakeLists.txt")
    otok.cmake{}
    local config = "#ifndef TOML_HEADER_ONLY\n#define TOML_HEADER_ONLY 0\n#endif\n"
    if slice.linkage == "dynamic" then config = config .. "#ifndef TOML_SHARED_LIB\n#define TOML_SHARED_LIB 1\n#endif\n" end
    local header = p .. "/include/toml++/impl/preprocessor.hpp"
    local text, n = otok.read(header):gsub("#pragma once\r?\n", "#pragma once\n\n// otok: toml++ compiled as a library\n" .. config, 1)
    if n ~= 1 then error("no #pragma once in " .. header) end
    otok.write(header, text)
    return { libraries = { tomlplusplus = p .. "/lib/libtomlplusplus.a" }, headers = p .. "/include" }
end
recipe.toml 1727 bytes · raw
# The otok recipe of toml++ (https://github.com/apotocki/otok): toml++ for every Apple platform, from the release tag; its headers, or with
# the option `compiled` the library of src/toml.cpp (static), whose headers then state that they are not header-only.
[recipe]
api = 1
library = "tomlplusplus"
name = "tomlplusplus"
version = "3.4.0"
revision = 1
license = "MIT"
license-files = ["LICENSE"]
homepage = "https://marzer.github.io/tomlplusplus/"
description = "toml++, a TOML parser and serializer for C++17 and later: header-only, or compiled as a library."
keywords = ["toml", "parser", "serializer", "config", "cpp"]
linkage = ["static"]
cxx-standard = ">= 17"

[source]
git = "https://github.com/marzer/tomlplusplus"
commit = "30172438cee64926dc41fdd9c11fb3ba5b2ba9de"
tag = "v3.4.0"

[platforms]
supported = ["ios", "iossim", "macosx", "catalyst", "tvos", "tvossim", "watchos", "watchossim", "xros", "xrossim"]
build-on = ["macos/xcode"]

[options.compiled]
type = "bool"
default = false
additive = true
doc = "Compile the implementation into a library (TOML_HEADER_ONLY=0), linked through the product TomlPlusPlusLib, instead of compiling it in every translation unit of the consumer. The headers of the product TomlPlusPlus then need that library."

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

[[product]]
name = "TomlPlusPlus"
libraries = []
link = { runtime = "c++" }
apple = { privacy-manifest = "none" }

[[product]]
name = "TomlPlusPlusLib"
libraries = ["tomlplusplus"]
headers = false
depends = ["TomlPlusPlus"]
when = { option = "compiled" }