Skip to content

Commit

Permalink
add vendored yyjson as default json parser
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Jan 10, 2025
1 parent 5e62ddc commit 1a70f21
Show file tree
Hide file tree
Showing 8 changed files with 17,884 additions and 271 deletions.
13 changes: 0 additions & 13 deletions src/libs/conduit/conduit_json.hpp

This file was deleted.

25 changes: 25 additions & 0 deletions src/tests/thirdparty/t_yyjson_smoke.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Lawrence Livermore National Security, LLC and other Conduit
// Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
// other details. No copyright assignment is required to contribute to Conduit.

//-----------------------------------------------------------------------------
///
/// file: t_yyjson_smoke.cpp
///
//-----------------------------------------------------------------------------

#include "conduit_yyjson.h"
#include "gtest/gtest.h"

using namespace conduit_yyjson;

//-----------------------------------------------------------------------------
TEST(yyjson_smoke, basic_use)
{
const char json[] = "{ \"hello\" : \"world\" }";
yyjson_doc *doc = yyjson_read(json, strlen(json), 0);
yyjson_val *root = yyjson_doc_get_root(doc);
yyjson_val *name = yyjson_obj_get(root, "hello");
ASSERT_STREQ(yyjson_get_str(name),"world");
yyjson_doc_free(doc);
}
32 changes: 32 additions & 0 deletions src/thirdparty_builtin/yyjson/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to contribute to Conduit.

################################
# Simple CMake setup for yyjson
################################

#
# yyjson sources
#

set(yyjson_sources
conduit_yyjson.cpp
)

#
# yyjson headers
#

set(yyjson_headers
conduit_yyjson_interface.h
conduit_yyjson.h)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

add_compiled_library(NAME conduit_yyjson
OBJECT
SOURCES ${yyjson_sources}
HEADERS ${yyjson_headers}
FOLDER thirdparty_builtin)

21 changes: 21 additions & 0 deletions src/thirdparty_builtin/yyjson/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 YaoYuan <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions src/thirdparty_builtin/yyjson/conduit_readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This is a subset of yyson from the 0.10.0 release (July 2024)

https://github.com/ibireme/yyjson/

License: MIT

We use internally - the build system parts, tests, etc were removed since they are not used.

Added header (conduit_yyjson_interface.h) as an interface.

Added a namespace (conduit_yyson) to avoid potential symbol collisions with others embedding yyjson.

Loading

0 comments on commit 1a70f21

Please sign in to comment.