Skip to content
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

#2175: Add YAML as input as alternative to command-line arguments #2230

Merged
merged 47 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3bd50c3
#2175: lib: add yaml-cpp as a TPL
lifflander Jul 20, 2023
3a94679
#2175: begin adding yaml parser option
cwschilly Dec 20, 2023
999737c
#2175: link vt with yaml-cpp
cwschilly Dec 20, 2023
84cf5c3
#2175: parse remaining parameters and add unit test for yaml inputs
cwschilly Dec 20, 2023
a5a0d1a
#2175: remove trailing white space in yaml-cpp
cwschilly Dec 20, 2023
5be3c4f
#2175: catch more yamlcpp trailing white space
cwschilly Dec 20, 2023
31e6ab1
#2175: fix cmake
cwschilly Dec 20, 2023
1c1b601
#2175: remove blank line at EOF
cwschilly Dec 20, 2023
fff4171
#2175: remove yaml-cpp test and contrib dirs
cwschilly Dec 21, 2023
dafc284
#2175: remove remaining contrib dir
cwschilly Dec 21, 2023
63500dc
#2175: add back some of contrib dir
cwschilly Dec 21, 2023
4a34ab5
#2175: fix clang warnings in yaml-cpp
cwschilly Jan 3, 2024
d6c386c
#2175: add more enum classes to resolve warnings
cwschilly Jan 4, 2024
8703f05
#2175: revert commit 54c277f9d78b35bf27fe8ddc7b897603a9cf6085.
cwschilly Jan 4, 2024
ebdd1b4
#2175: undo changes to EmitterNodeType
cwschilly Jan 4, 2024
798fa38
#2175: more fixes
cwschilly Jan 4, 2024
33145b1
#2175: change Null to BaseNull to avoid shadowing
cwschilly Jan 4, 2024
91f85cc
#2175: disable effc++ warnings
cwschilly Jan 8, 2024
3974b14
#2175: fix more intel warnings
cwschilly Jan 8, 2024
f58e8e6
#2175: args: change to camel case to follow style guidelines
lifflander Apr 18, 2024
50d0a6f
#2175: args: change names of YAML input parameters
lifflander Apr 18, 2024
a4960d4
#2175: args: fix trace MPI
lifflander Apr 18, 2024
74c1f73
#2175: try ignoring nan warning
cwschilly Apr 23, 2024
28dbb78
#2175: disable all warnings using SYSTEM
cwschilly Apr 23, 2024
bd86662
#2175: fix yaml input and improve hierarchy in input file
cwschilly May 14, 2024
5f7e0f1
#2175: fix yaml input; add ability to write config as yaml; add unit …
cwschilly May 21, 2024
1f3cb3e
#2175: add test for writing out yaml
cwschilly May 22, 2024
5f93821
#2175: try cmake fix
cwschilly May 22, 2024
6dd274c
#2175: add CI print statements to debug
cwschilly May 22, 2024
7bc9605
#2175: try fixing yamlcpp include
cwschilly May 22, 2024
222b935
#2175: add more debug statements
cwschilly May 23, 2024
27cf8fd
#2175: add yamlcpp to trace_only_functions.cmake; remove print statem…
cwschilly May 23, 2024
7e8931d
#2175: improve user options
cwschilly May 24, 2024
0a14a27
#2175: ensure compiler finds all yaml-cpp header files
cwschilly May 28, 2024
5fa1aeb
#2175: fix failing test with lb disabled
cwschilly May 29, 2024
a5edc1c
#2175: install yamlcpp in include dir
cwschilly May 29, 2024
0e13f5c
#2175: isolate yamlcpp include files
cwschilly May 30, 2024
76317cc
#2175: make requested changes
cwschilly Jul 8, 2024
a0c8144
#2175: add back allKeywords to fix build error
cwschilly Jul 8, 2024
c2bad05
#2175: fix codacy issue
cwschilly Jul 8, 2024
78bc7fe
#2175: store YAML labels in variables
cwschilly Jul 8, 2024
1e27d80
#2175: remove unneeded imports
cwschilly Jul 9, 2024
a4afe5a
#2175: simplify yaml output logic
cwschilly Jul 9, 2024
6a93709
#2175: reorder precedence so args overwrite yaml
cwschilly Jul 10, 2024
7e22e8c
#2175: move user args to args.cc and clean up
cwschilly Jul 11, 2024
ac2b86a
#2175: fix indentation errors
cwschilly Jul 11, 2024
531c3a8
#2175: more improvements and fixes
cwschilly Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmake/link_vt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function(link_target_with_vt)
LINK_FCONTEXT
LINK_CHECKPOINT
LINK_CLI11
LINK_YAMLCPP
LINK_DL
LINK_ZOLTAN
LINK_FORT
Expand All @@ -41,7 +42,7 @@ function(link_target_with_vt)
set(allKeywords ${noValOption} ${singleValArg} ${multiValueArg})
cwschilly marked this conversation as resolved.
Show resolved Hide resolved

cmake_parse_arguments(
ARG "${noValOption}" "${singleValArg}" "${multiValueArgs}" ${ARGN}
ARG "${noValOption}" "${singleValArg}" "${multiValueArg}" ${ARGN}
cwschilly marked this conversation as resolved.
Show resolved Hide resolved
)

if (${ARG_DEBUG_LINK})
Expand Down Expand Up @@ -211,6 +212,15 @@ function(link_target_with_vt)
)
endif()

if (NOT DEFINED ARG_LINK_YAMLCPP AND ${ARG_DEFAULT_LINK_SET} OR ARG_LINK_YAMLCPP)
if (${ARG_DEBUG_LINK})
message(STATUS "link_target_with_vt: yamlcpp=${ARG_LINK_YAMLCPP}")
endif()
target_link_libraries(
${ARG_TARGET} PUBLIC ${ARG_BUILD_TYPE} ${YAMLCPP_LIBRARY}
)
endif()

if (${vt_mimalloc_enabled})
if (${ARG_DEBUG_LINK})
message(STATUS "link_target_with_vt: mimalloc=${vt_mimalloc_enabled}")
Expand Down
4 changes: 4 additions & 0 deletions cmake/load_bundled_libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ else()
set_darma_compiler_flags(${FMT_LIBRARY})
endif()

# yaml-cpp always included in the build
set(YAMLCPP_LIBRARY yaml-cpp)
add_subdirectory(${PROJECT_LIB_DIR}/yaml-cpp)
cwschilly marked this conversation as resolved.
Show resolved Hide resolved
set_darma_compiler_flags(${YAMLCPP_LIBRARY})

# EngFormat-Cpp always included in the build
set(ENG_FORMAT_LIBRARY EngFormat-Cpp)
Expand Down
1 change: 1 addition & 0 deletions cmake/test_vt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function(run_executable_with_mpi)
TARGET_ARGS
WRAPPER_ARGS
)
set(allKeywords ${noValOption} ${singleValArg} ${multiValueArg})

cmake_parse_arguments(
ARG "${noValOption}" "${singleValArg}" "${multiValueArgs}" ${ARGN}
Expand Down
13 changes: 13 additions & 0 deletions cmake/trace_only_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ function(create_trace_only_target)
DESTINATION "include/vt-trace/EngFormat-Cpp"
)

install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../lib/yaml-cpp/include/yaml-cpp/"
DESTINATION "include/vt-trace/yaml-cpp"
FILES_MATCHING PATTERN "*.h"
)

install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../lib/yaml-cpp/include/yaml-cpp/node"
DESTINATION "include/vt-trace/yaml-cpp/node"
FILES_MATCHING PATTERN "*.h"
)

set(VT_TRACE_LIB vt-trace CACHE INTERNAL "" FORCE)
add_library(
${VT_TRACE_LIB}
Expand All @@ -118,6 +130,7 @@ function(create_trace_only_target)
TARGET ${VT_TRACE_LIB}
LINK_VT_LIB
LINK_FMT 1
LINK_YAMLCPP 1
LINK_ENG_FORMAT 1
LINK_ZLIB 1
LINK_MPI 1
Expand Down
149 changes: 149 additions & 0 deletions lib/yaml-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# 3.5 is actually available almost everywhere, but this a good minimum
cmake_minimum_required(VERSION 3.4)

# enable MSVC_RUNTIME_LIBRARY target property
# see https://cmake.org/cmake/help/latest/policy/CMP0091.html
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()

project(YAML_CPP VERSION 0.7.0 LANGUAGES CXX)

include(CMakePackageConfigHelpers)
include(CMakeDependentOption)
include(CheckCXXCompilerFlag)
include(GNUInstallDirs)
include(CTest)

find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)

option(YAML_CPP_BUILD_CONTRIB "Enable yaml-cpp contrib in library" ON)
option(YAML_CPP_BUILD_TOOLS "Enable parse tools" ON)
option(YAML_BUILD_SHARED_LIBS "Build yaml-cpp shared library" ${BUILD_SHARED_LIBS})

cmake_dependent_option(YAML_CPP_BUILD_TESTS
"Enable yaml-cpp tests" ON
"BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
cmake_dependent_option(YAML_MSVC_SHARED_RT
"MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
"MSVC" OFF)

set(yaml-cpp-type STATIC)
set(yaml-cpp-label-postfix "static")
if (YAML_BUILD_SHARED_LIBS)
set(yaml-cpp-type SHARED)
set(yaml-cpp-label-postfix "shared")
endif()

set(build-shared $<BOOL:${YAML_BUILD_SHARED_LIBS}>)
set(build-windows-dll $<AND:$<BOOL:${CMAKE_HOST_WIN32}>,${build-shared}>)
set(not-msvc $<NOT:$<CXX_COMPILER_ID:MSVC>>)
set(msvc-shared_rt $<BOOL:${YAML_MSVC_SHARED_RT}>)

if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY
MultiThreaded$<$<CONFIG:Debug>:Debug>$<${msvc-shared_rt}:DLL>)
endif()

set(contrib-pattern "src/contrib/*.cpp")
set(src-pattern "src/*.cpp")
if (CMAKE_VERSION VERSION_GREATER 3.12)
list(INSERT contrib-pattern 0 CONFIGURE_DEPENDS)
list(INSERT src-pattern 0 CONFIGURE_DEPENDS)
endif()

file(GLOB yaml-cpp-contrib-sources ${contrib-pattern})
file(GLOB yaml-cpp-sources ${src-pattern})

set(msvc-rt $<TARGET_PROPERTY:MSVC_RUNTIME_LIBRARY>)

set(msvc-rt-mtd-static $<STREQUAL:${msvc-rt},MultiThreadedDebug>)
set(msvc-rt-mt-static $<STREQUAL:${msvc-rt},MultiThreaded>)

set(msvc-rt-mtd-dll $<STREQUAL:${msvc-rt},MultiThreadedDebugDLL>)
set(msvc-rt-mt-dll $<STREQUAL:${msvc-rt},MultiThreadedDLL>)

set(backport-msvc-runtime $<VERSION_LESS:${CMAKE_VERSION},3.15>)

add_library(yaml-cpp ${yaml-cpp-type} "")
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)

set_property(TARGET yaml-cpp
PROPERTY
MSVC_RUNTIME_LIBRARY ${CMAKE_MSVC_RUNTIME_LIBRARY})
set_property(TARGET yaml-cpp
PROPERTY
CXX_STANDARD_REQUIRED ON)

target_include_directories(yaml-cpp
SYSTEM PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)

if (NOT DEFINED CMAKE_CXX_STANDARD)
set_target_properties(yaml-cpp
PROPERTIES
CXX_STANDARD 11)
endif()

target_compile_options(yaml-cpp
PRIVATE
$<${not-msvc}:-pedantic -pedantic-errors>

$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-static}>:-MTd>
$<$<AND:${backport-msvc-runtime},${msvc-rt-mt-static}>:-MT>
$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-dll}>:-MDd>
$<$<AND:${backport-msvc-runtime},${msvc-rt-mt-dll}>:-MD>)

target_compile_definitions(yaml-cpp
PRIVATE
$<${build-windows-dll}:${PROJECT_NAME}_DLL>
$<$<NOT:$<BOOL:${YAML_CPP_BUILD_CONTRIB}>>:YAML_CPP_NO_CONTRIB>)

target_sources(yaml-cpp
PRIVATE
$<$<BOOL:${YAML_CPP_BUILD_CONTRIB}>:${yaml-cpp-contrib-sources}>
${yaml-cpp-sources})

if (NOT DEFINED CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX "d")
endif()

set_target_properties(yaml-cpp PROPERTIES
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}"
DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
"${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")

write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
COMPATIBILITY AnyNewerVersion)

configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h")

if(YAML_CPP_BUILD_TESTS)
add_subdirectory(test)
endif()

if(YAML_CPP_BUILD_TOOLS)
add_subdirectory(util)
endif()

if (YAML_CPP_CLANG_FORMAT_EXE)
add_custom_target(format
COMMAND clang-format --style=file -i $<TARGET_PROPERTY:yaml-cpp,SOURCES>
COMMAND_EXPAND_LISTS
COMMENT "Running clang-format"
VERBATIM)
endif()
19 changes: 19 additions & 0 deletions lib/yaml-cpp/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2008-2015 Jesse Beder.

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.
61 changes: 61 additions & 0 deletions lib/yaml-cpp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# yaml-cpp [![Build Status](https://travis-ci.org/jbeder/yaml-cpp.svg?branch=master)](https://travis-ci.org/jbeder/yaml-cpp) [![Documentation](https://codedocs.xyz/jbeder/yaml-cpp.svg)](https://codedocs.xyz/jbeder/yaml-cpp/)

yaml-cpp is a [YAML](http://www.yaml.org/) parser and emitter in C++ matching the [YAML 1.2 spec](http://www.yaml.org/spec/1.2/spec.html).

To get a feel for how it can be used, see the [Tutorial](https://github.com/jbeder/yaml-cpp/wiki/Tutorial) or [How to Emit YAML](https://github.com/jbeder/yaml-cpp/wiki/How-To-Emit-YAML). For the old API (version < 0.5.0), see [How To Parse A Document](https://github.com/jbeder/yaml-cpp/wiki/How-To-Parse-A-Document-(Old-API)).

# Problems? #

If you find a bug, post an [issue](https://github.com/jbeder/yaml-cpp/issues)! If you have questions about how to use yaml-cpp, please post it on http://stackoverflow.com and tag it [`yaml-cpp`](http://stackoverflow.com/questions/tagged/yaml-cpp).

# How to Build #

yaml-cpp uses [CMake](http://www.cmake.org) to support cross-platform building. The basic steps to build are:

1. Download and install [CMake](http://www.cmake.org) (Resources -> Download).

**Note:** If you don't use the provided installer for your platform, make sure that you add CMake's bin folder to your path.

2. Navigate into the source directory, and type:

```
mkdir build
cd build
```

3. Run CMake. The basic syntax is:

```
cmake [-G generator] [-DYAML_BUILD_SHARED_LIBS=ON|OFF] ..
```

* The `generator` is whatever type of build system you'd like to use. To see a full list of generators on your platform, just run `cmake` (with no arguments). For example:
* On Windows, you might use "Visual Studio 12 2013" to generate a Visual Studio 2013 solution or "Visual Studio 14 2015 Win64" to generate a 64-bit Visual Studio 2015 solution.
* On OS X, you might use "Xcode" to generate an Xcode project
* On a UNIX-y system, simply omit the option to generate a makefile

* yaml-cpp defaults to building a static library, but you may build a shared library by specifying `-DYAML_BUILD_SHARED_LIBS=ON`.

* For more options on customizing the build, see the [CMakeLists.txt](https://github.com/jbeder/yaml-cpp/blob/master/CMakeLists.txt) file.

4. Build it!

5. To clean up, just remove the `build` directory.

# Recent Release #

[yaml-cpp 0.6.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.6.0) has been released! This release requires C++11, and no longer depends on Boost.

[yaml-cpp 0.3.0](https://github.com/jbeder/yaml-cpp/releases/tag/release-0.3.0) is still available if you want the old API.

**The old API will continue to be supported, and will still receive bugfixes!** The 0.3.x and 0.4.x versions will be old API releases, and 0.5.x and above will all be new API releases.

# API Documentation

The autogenerated API reference is hosted on [CodeDocs](https://codedocs.xyz/jbeder/yaml-cpp/index.html)

# Third Party Integrations

The following projects are not officially supported:

- [Qt wrapper](https://gist.github.com/brcha/d392b2fe5f1e427cc8a6)
17 changes: 17 additions & 0 deletions lib/yaml-cpp/include/yaml-cpp/anchor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66

#if defined(_MSC_VER) || \
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif

#include <cstddef>

namespace YAML {
using anchor_t = std::size_t;
const anchor_t NullAnchor = 0;
}

#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
Loading