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 1496 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)
local lib = otok.glob(slice.linkage == "static" and "lib/libtomlplusplus.a" or "lib/libtomlplusplus.so", p)[1]
return { libraries = { tomlplusplus = lib }, headers = p .. "/include" }
end
recipe.toml 1615 bytes · raw
# The otok recipe of toml++ (https://github.com/apotocki/otok): toml++ for Linux, from the release tag; its headers, or with
# the option `compiled` the library of src/toml.cpp (static or shared), 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", "dynamic"]
cxx-standard = ">= 17"
[source]
git = "https://github.com/marzer/tomlplusplus"
commit = "30172438cee64926dc41fdd9c11fb3ba5b2ba9de"
tag = "v3.4.0"
[platforms]
supported = ["linux"]
build-on = ["linux/gcc", "linux/clang"]
[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++" }
[[product]]
name = "TomlPlusPlusLib"
libraries = ["tomlplusplus"]
headers = false
depends = ["TomlPlusPlus"]
when = { option = "compiled" }