-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rui Chen <[email protected]> dragonbox: update license Co-authored-by: Ruoyu Zhong <[email protected]>
- Loading branch information
1 parent
a79bc2b
commit 3c36cd5
Showing
2 changed files
with
47 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 |
---|---|---|
|
@@ -721,6 +721,7 @@ dprint | |
dra | ||
draco | ||
drafter | ||
dragonbox | ||
driftctl | ||
drill | ||
drogon | ||
|
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,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 |