Repository navigation
feat: Add C++ modules support #1729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mikomikotaishi
wants to merge
3
commits into
open-source-parsers:master
Choose a base branch
from
mikomikotaishi:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+146
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,41 @@ | ||
| cmake_minimum_required(VERSION 3.28) | ||
|
|
||
| add_library(jsoncpp_module) | ||
|
|
||
| target_sources(jsoncpp_module | ||
| PUBLIC | ||
| FILE_SET CXX_MODULES FILES | ||
| jsoncpp.cppm | ||
| ) | ||
|
|
||
| target_compile_features(jsoncpp_module PUBLIC cxx_std_20) | ||
|
|
||
| if(BUILD_SHARED_LIBS) | ||
| target_link_libraries(jsoncpp_module PUBLIC jsoncpp_lib) | ||
| elseif(BUILD_STATIC_LIBS) | ||
| target_link_libraries(jsoncpp_module PUBLIC jsoncpp_static) | ||
| endif() | ||
|
|
||
| target_include_directories(jsoncpp_module PUBLIC | ||
| $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
| $<INSTALL_INTERFACE:include> | ||
| ) | ||
|
|
||
| add_library(jsoncpp::module ALIAS jsoncpp_module) | ||
|
|
||
| # Installation | ||
| if(JSONCPP_WITH_CMAKE_PACKAGE) | ||
| set(MODULE_INSTALL_EXPORT EXPORT jsoncpp) | ||
| else() | ||
| set(MODULE_INSTALL_EXPORT) | ||
| endif() | ||
|
|
||
| if(JSONCPP_WITH_INSTALL) | ||
| install(TARGETS jsoncpp_module | ||
| ${MODULE_INSTALL_EXPORT} | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/jsoncpp/modules | ||
| ) | ||
| endif() | ||
This file contains hidden or 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,95 @@ | ||
| // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors | ||
| // Distributed under MIT license, or public domain if desired and | ||
| // recognized in your jurisdiction. | ||
| // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE | ||
|
|
||
| module; | ||
|
|
||
| #include <json/json.h> | ||
|
|
||
| export module jsoncpp; | ||
|
|
||
| export namespace Json { | ||
| // writer.h | ||
| using Json::StreamWriter; | ||
| using Json::StreamWriterBuilder; | ||
| using Json::Writer; | ||
| using Json::FastWriter; | ||
| using Json::StyledWriter; | ||
| using Json::StyledStreamWriter; | ||
| using Json::valueToString; | ||
| using Json::valueToQuotedString; | ||
| using Json::operator<<; | ||
|
|
||
| // reader.h | ||
| using Json::Reader; | ||
| using Json::CharReader; | ||
| using Json::CharReaderBuilder; | ||
| using Json::parseFromStream; | ||
| using Json::operator>>; | ||
|
|
||
| // json_features.h | ||
| using Json::Features; | ||
|
|
||
| // value.h | ||
| using Json::ArrayIndex; | ||
| using Json::StaticString; | ||
| using Json::Path; | ||
| using Json::PathArgument; | ||
| using Json::Value; | ||
| using Json::ValueIteratorBase; | ||
| using Json::ValueIterator; | ||
| using Json::ValueConstIterator; | ||
| using Json::ValueMembersView; | ||
| using Json::ValueConstMembersView; | ||
|
|
||
| // config.h | ||
| using Json::version; | ||
| using Json::Int; | ||
| using Json::UInt; | ||
| #ifdef JSON_HAS_INT64 | ||
| using Json::Int64; | ||
| using Json::UInt64; | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| #endif | ||
| using Json::LargestInt; | ||
| using Json::LargestUInt; | ||
| using Json::Allocator; | ||
| using Json::String; | ||
| using Json::IStringStream; | ||
| using Json::OStringStream; | ||
| using Json::IStream; | ||
| using Json::OStream; | ||
|
|
||
| // allocator.h | ||
| using Json::SecureAllocator; | ||
| using Json::operator==; | ||
| using Json::operator!=; | ||
|
|
||
| // value.h | ||
| #if JSON_USE_EXCEPTION | ||
| using Json::Exception; | ||
| using Json::RuntimeError; | ||
| using Json::LogicError; | ||
| #endif | ||
| using Json::ValueType; | ||
| using Json::CommentPlacement; | ||
| using Json::PrecisionType; | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| using Json::MemberProxy; | ||
| using Json::ConstMemberProxy; | ||
| using Json::nullValue; | ||
| using Json::intValue; | ||
| using Json::uintValue; | ||
| using Json::realValue; | ||
| using Json::stringValue; | ||
| using Json::booleanValue; | ||
| using Json::arrayValue; | ||
| using Json::objectValue; | ||
| using Json::commentBefore; | ||
| using Json::commentAfterOnSameLine; | ||
| using Json::commentAfter; | ||
| using Json::numberOfCommentPlacement; | ||
| using Json::significantDigits; | ||
| using Json::decimalPlaces; | ||
| using Json::swap; | ||
| using Json::writeString; | ||
| } // namespace Json | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.