-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tmp is a collection of RAII-wrappers for unique temporary files and directories that are deleted automatically for C++17 and later
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class Tmp < Formula | ||
desc "RAII-wrappers for unique temporary files and directories for modern C++" | ||
homepage "https://github.com/bugdea1er/tmp" | ||
url "https://github.com/bugdea1er/tmp/archive/refs/tags/v0.6.1.tar.gz" | ||
sha256 "fc8f9f08ff3b26df0ea8646903a69ce7a2b4fc1ecfbf981d2d47d74eca0538ef" | ||
license "MIT" | ||
head "https://github.com/bugdea1er/tmp.git", branch: "main" | ||
|
||
depends_on "cmake" => :build | ||
|
||
def install | ||
system "cmake", "-S", ".", "-B", "build", "-DTMP_TEST=OFF", *std_cmake_args | ||
system "cmake", "--build", "build" | ||
system "cmake", "--install", "build" | ||
end | ||
|
||
test do | ||
(testpath/"test.cpp").write <<~EOS | ||
#include <iostream> | ||
#include <tmp/file> | ||
int main() { | ||
std::cout << tmp::file().release().native(); | ||
} | ||
EOS | ||
|
||
system ENV.cxx, "test.cpp", "-std=c++17", "-o", "test", | ||
"-I#{include}", | ||
"-L#{lib}", | ||
"-ltmp" | ||
assert_predicate Pathname.new(shell_output("./test")), :exist? | ||
end | ||
end |