Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
f4c01601
Unverified
Commit
f4c01601
authored
Dec 04, 2017
by
Niels Lohmann
Committed by
GitHub
Dec 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #844 from TinyTinni/develop
Add .natvis for MSVC debug view
parents
cc937dea
24fe572d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
CMakeLists.txt
CMakeLists.txt
+19
-1
nlohmann_json.natvis
nlohmann_json.natvis
+32
-0
test/CMakeLists.txt
test/CMakeLists.txt
+1
-1
No files found.
CMakeLists.txt
View file @
f4c01601
...
...
@@ -35,7 +35,19 @@ target_include_directories(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE $<INSTALL_INTERFACE:include/>
)
## add debug view defintion file for msvc (natvis) [cmake <= 3.2.2 does not support export of source files]
if
(
MSVC AND CMAKE_VERSION VERSION_GREATER
"3.2.2"
)
set
(
NLOHMANN_ADD_NATVIS TRUE
)
set
(
NLOHMANN_NATVIS_FILE
"nlohmann_json.natvis"
)
target_sources
(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE
$<INSTALL_INTERFACE:
${
NLOHMANN_NATVIS_FILE
}
>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
NLOHMANN_NATVIS_FILE
}
>
)
endif
()
##
## TESTS
## create and configure the unit test target
...
...
@@ -67,6 +79,12 @@ install(
FILES
${
NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE
}
${
NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE
}
DESTINATION
${
NLOHMANN_JSON_CONFIG_INSTALL_DIR
}
)
if
(
NLOHMANN_ADD_NATVIS
)
install
(
FILES
${
NLOHMANN_NATVIS_FILE
}
DESTINATION .
)
endif
()
install
(
TARGETS
${
NLOHMANN_JSON_TARGET_NAME
}
EXPORT
${
NLOHMANN_JSON_TARGETS_EXPORT_NAME
}
...
...
nlohmann_json.natvis
0 → 100644
View file @
f4c01601
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer
xmlns=
"http://schemas.microsoft.com/vstudio/debugger/natvis/2010"
>
<Type
Name=
"nlohmann::basic_json<*>"
>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::null"
>
null
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::object"
>
{*(m_value.object)}
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::array"
>
{*(m_value.array)}
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::string"
>
{*(m_value.string)}
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::boolean"
>
{m_value.boolean}
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::number_integer"
>
{m_value.number_integer}
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::number_unsigned"
>
{m_value.number_unsigned}
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::number_float"
>
{m_value.number_float}
</DisplayString>
<DisplayString
Condition=
"m_type == nlohmann::detail::value_t::discarded"
>
discarded
</DisplayString>
<Expand>
<ExpandedItem
Condition=
"m_type == nlohmann::detail::value_t::object"
>
*(m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem
Condition=
"m_type == nlohmann::detail::value_t::array"
>
*(m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
<!-- skip the pair first/second members in the treeview while traversing a map.
Only works in VS 2015 Update 2 and beyond using the new visualization -->
<Type
Name=
"std::pair<*, nlohmann::basic_json<*>>"
IncludeView=
"MapHelper"
>
<DisplayString>
{second}
</DisplayString>
<Expand>
<ExpandedItem>
second
</ExpandedItem>
</Expand>
</Type>
</AutoVisualizer>
test/CMakeLists.txt
View file @
f4c01601
...
...
@@ -101,7 +101,7 @@ foreach(file ${files})
target_compile_definitions
(
${
testcase
}
PRIVATE CATCH_CONFIG_FAST_COMPILE
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/catch"
)
target_link_libraries
(
${
testcase
}
${
JSON_TARGET_NAME
}
)
target_link_libraries
(
${
testcase
}
${
NLOHMANN_
JSON_TARGET_NAME
}
)
if
(
NOT MSVC
)
set_target_properties
(
${
testcase
}
PROPERTIES COMPILE_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wno-float-equal"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment