Skip to content

Commit

Permalink
dragonbox 1.1.3 (new formula)
Browse files Browse the repository at this point in the history
Signed-off-by: Rui Chen <[email protected]>

dragonbox: update license

Co-authored-by: Ruoyu Zhong <[email protected]>
  • Loading branch information
chenrui333 and ZhongRuoyu committed Nov 24, 2024
1 parent a79bc2b commit 3c36cd5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/autobump.txt
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ dprint
dra
draco
drafter
dragonbox
driftctl
drill
drogon
Expand Down
46 changes: 46 additions & 0 deletions Formula/d/dragonbox.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
class Dragonbox < Formula
desc "Reference implementation of Dragonbox in C++"
homepage "https://github.com/jk-jeon/dragonbox"
url "https://github.com/jk-jeon/dragonbox/archive/refs/tags/1.1.3.tar.gz"
sha256 "09d63b05e9c594ec423778ab59b7a5aa1d76fdd71d25c7048b0258c4ec9c3384"
license any_of: ["Apache-2.0" => { with: "LLVM-exception" }, "BSL-1.0"]
head "https://github.com/jk-jeon/dragonbox.git", branch: "master"

depends_on "cmake" => [:build, :test]

def install
system "cmake", "-S", ".", "-B", "build", *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
(testpath/"CMakeLists.txt").write <<~CMAKE
cmake_minimum_required(VERSION 3.0)
project(TestDragonbox)
find_package(dragonbox REQUIRED)
add_executable(test_dragonbox test.cpp)
target_link_libraries(test_dragonbox PRIVATE dragonbox::dragonbox_to_chars)
CMAKE

(testpath/"test.cpp").write <<~CPP
#include <dragonbox/dragonbox_to_chars.h>
#include <iostream>
int main() {
double number = 123.456;
char buffer[25];
jkj::dragonbox::to_chars(number, buffer);
std::cout << buffer << std::endl;
return 0;
}
CPP

system "cmake", "-S", ".", "-B", "build"
system "cmake", "--build", "build"

assert_match "1.23456E2", shell_output("./build/test_dragonbox")
end
end

0 comments on commit 3c36cd5

Please sign in to comment.