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" }