cpi 2.0.4 (new formula)

* Add new formula, cpi
* add uses_from_macos

Closes #100610.

Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
master
AOYAMA Kazuharu 2022-05-02 19:02:52 +09:00 committed by BrewTestBot
parent 983fc2bb30
commit 1d3c32836c
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
1 changed files with 53 additions and 0 deletions

53
Formula/cpi.rb Normal file
View File

@ -0,0 +1,53 @@
class Cpi < Formula
desc "Tiny c++ interpreter"
homepage "https://treefrogframework.github.io/cpi/"
url "https://github.com/treefrogframework/cpi/archive/refs/tags/v2.0.4.tar.gz"
sha256 "55e98b851976d258c1211d3c04d99ce2ec104580cc78f5d30064accef6e3d952"
license "MIT"
head "https://github.com/treefrogframework/cpi.git", branch: "master"
depends_on "qt"
uses_from_macos "llvm"
on_linux do
depends_on "gcc"
end
fails_with gcc: "5"
def install
system "qmake", "CONFIG+=release", "target.path=#{bin}"
system "make"
system "make", "install"
end
test do
(testpath/"test1.cpp").write <<~EOS
#include <iostream>
int main()
{
std::cout << "Hello world" << std::endl;
return 0;
}
EOS
assert_match "Hello world", shell_output("#{bin}/cpi #{testpath}/test1.cpp")
(testpath/"test2.cpp").write <<~EOS
#include <iostream>
#include <cmath>
#include <cstdlib>
int main(int argc, char *argv[])
{
if (argc != 2) return 0;
std::cout << sqrt(atoi(argv[1])) << std::endl;
return 0;
}
// CompileOptions: -lm
EOS
assert_match "1.41421", shell_output("#{bin}/cpi #{testpath}/test2.cpp 2")
end
end