Skip to content

Commit

Permalink
Merge pull request #2230 from DARMA-tasking/2175-add-yaml-as-input-as…
Browse files Browse the repository at this point in the history
…-alternative

#2175: Add YAML as input as alternative to command-line arguments
  • Loading branch information
nlslatt authored Jul 18, 2024
2 parents 0360247 + 531c3a8 commit 958e26c
Show file tree
Hide file tree
Showing 104 changed files with 12,539 additions and 55 deletions.
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})

cmake_parse_arguments(
ARG "${noValOption}" "${singleValArg}" "${multiValueArgs}" ${ARGN}
ARG "${noValOption}" "${singleValArg}" "${multiValueArg}" ${ARGN}
)

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)
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

0 comments on commit 958e26c

Please sign in to comment.