homebrew-core/Formula/standardese.rb

92 lines
3.6 KiB
Ruby

class Standardese < Formula
desc "Next-gen documentation generator for C++"
homepage "https://standardese.github.io"
# TODO: use resource blocks for vendored deps
license "MIT"
revision 10
head "https://github.com/standardese/standardese.git", branch: "master"
# Remove stable block when patch is no longer needed.
stable do
url "https://github.com/standardese/standardese.git",
tag: "0.5.2",
revision: "0b23537e235690e01ba7f8362a22d45125e7b675"
# Fix build with new GCC.
# https://github.com/standardese/standardese/pull/233
patch do
url "https://github.com/standardese/standardese/commit/15e05be2301fe43d1e209b2f749c99a95c356e04.patch?full_index=1"
sha256 "e5f03ea321572dd52b9241c2a01838dfe7e6df7e363a8d19bfeac5861baf5d3f"
end
end
bottle do
sha256 arm64_monterey: "8a9420dfe7f92d5ff6b42663d9ca9cbe18f1cdc2fbfa7cc0da00df2b69f51b5b"
sha256 arm64_big_sur: "4ddb4194ad6401b17afd0a065f14690ac278133a4283af12777180b2248b0bd0"
sha256 monterey: "08ac5d869d07b7b9eaf070e9578dbedf2033afeae565a2b80885cd8258b5b92f"
sha256 big_sur: "a50d516519620ce56e2b4d6e296eeb334285a1a6ba3120cd749b2faf95b060b9"
sha256 catalina: "21ec40aac0d1f0cc6a93ee6c2e318e34375531d583337a58b2e5583109a7897f"
sha256 cellar: :any_skip_relocation, x86_64_linux: "269038dee98f12e710183e8bfac7bfc6c1c9e208365784ba07296ca97a211eb8"
end
depends_on "cmake" => :build
depends_on "boost"
depends_on "cmark-gfm"
depends_on "llvm" # must be Homebrew LLVM, not system, because of `llvm-config`
fails_with gcc: "5" # LLVM is built with Homebrew GCC
def install
# Don't build shared libraries to avoid having to manually install and relocate
# libstandardese, libtiny-process-library, and libcppast. These libraries belong
# to no install targets and are not used elsewhere.
# Disable building test objects because they use an outdated vendored version of catch2.
system "cmake", "-S", ".", "-B", "build",
"-DBUILD_SHARED_LIBS=OFF",
"-DCMARK_LIBRARY=#{Formula["cmark-gfm"].opt_lib/shared_library("libcmark-gfm")}",
"-DCMARK_INCLUDE_DIR=#{Formula["cmark-gfm"].opt_include}",
"-DSTANDARDESE_BUILD_TEST=OFF",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
include.install "include/standardese"
(lib/"cmake/standardese").install "standardese-config.cmake"
end
test do
(testpath/"test.hpp").write <<~EOS
#pragma once
#include <string>
using namespace std;
/// \\brief A namespace.
///
/// Namespaces are cool!
namespace test {
//! A class.
/// \\effects Lots!
class Test {
public:
int foo; //< Something to do with an index into [bar](<> "test::Test::bar").
wstring bar; //< A [wide string](<> "std::wstring").
/// \\requires The parameter must be properly constructed.
explicit Test(const Test &) noexcept;
~Test() noexcept;
};
/// \\notes Some stuff at the end.
using Baz = Test;
};
EOS
system "standardese",
"--compilation.standard", "c++17",
"--output.format", "xml",
testpath/"test.hpp"
assert_includes (testpath/"doc_test.xml").read, "<subdocument output-name=\"doc_test\" title=\"test.hpp\">"
end
end