From b56cba625c5187b8d38c5f4a3dde9dd73cbbb86e Mon Sep 17 00:00:00 2001 From: Songyuan Cui Date: Sat, 17 Jan 2026 17:43:29 -0600 Subject: [PATCH 01/88] build: move brigand and cxxopts to external/ and add cmake files --- cmake/FindBrigand.cmake | 25 + cmake/FindCxxOpts.cmake | 55 + cmake/SetupCxxOpts.cmake | 7 + cmake/SetupHighFive.cmake | 4 + external/brigand/LICENSE | 24 + external/brigand/brigand.hpp | 2814 ++++++++++++++++++++++++++++++++ external/cxxopts/LICENSE | 19 + external/cxxopts/cxxopts.hpp | 2925 ++++++++++++++++++++++++++++++++++ 8 files changed, 5873 insertions(+) create mode 100644 cmake/FindBrigand.cmake create mode 100644 cmake/FindCxxOpts.cmake create mode 100644 external/brigand/LICENSE create mode 100644 external/brigand/brigand.hpp create mode 100644 external/cxxopts/LICENSE create mode 100644 external/cxxopts/cxxopts.hpp diff --git a/cmake/FindBrigand.cmake b/cmake/FindBrigand.cmake new file mode 100644 index 00000000..3d934c22 --- /dev/null +++ b/cmake/FindBrigand.cmake @@ -0,0 +1,25 @@ +# Distributed under the MIT License. +# See LICENSE.txt for details. + +if(NOT BRIGAND_ROOT) + # Need to set to empty to avoid warnings with --warn-uninitialized + set(BRIGAND_ROOT "") + set(BRIGAND_ROOT $ENV{BRIGAND_ROOT}) +endif() + +find_path( + BRIGAND_INCLUDE_DIR + PATH_SUFFIXES include brigand + NAMES brigand.hpp + HINTS ${CMAKE_SOURCE_DIR}/external ${BRIGAND_ROOT} + DOC "Brigand include directory. Used BRIGAND_ROOT to set a search dir." +) + +set(BRIGAND_INCLUDE_DIRS ${BRIGAND_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Brigand + DEFAULT_MSG BRIGAND_INCLUDE_DIR BRIGAND_INCLUDE_DIRS +) +mark_as_advanced(BRIGAND_INCLUDE_DIR BRIGAND_INCLUDE_DIRS) diff --git a/cmake/FindCxxOpts.cmake b/cmake/FindCxxOpts.cmake new file mode 100644 index 00000000..80e43d21 --- /dev/null +++ b/cmake/FindCxxOpts.cmake @@ -0,0 +1,55 @@ +# Distributed under the MIT License. +# See LICENSE.txt for details. + +if(NOT CXXOPTS_ROOT) + set(CXXOPTS_ROOT "") + set(CXXOPTS_ROOT $ENV{cxxopts_ROOT}) +endif() + +find_path( + cxxopts_INCLUDE_DIR + PATH_SUFFIXES include cxxopts + NAMES cxxopts.hpp + HINTS ${CMAKE_SOURCE_DIR}/external ${CXXOPTS_ROOT} + DOC "cxxopts include directory. Used cxxopts_ROOT to set a search dir." +) + +function(extract_defined_value FILE DEFINE_NAME OUT_VAR) + file(READ "${FILE}" _contents) + string(REGEX MATCH "#define[ \t]+${DEFINE_NAME}[ \t]+([0-9]+)" + _match "${_contents}") + + if(NOT CMAKE_MATCH_1) + message(FATAL_ERROR "Could not find ${DEFINE_NAME} in ${FILE}") + endif() + + set(${OUT_VAR} "${CMAKE_MATCH_1}" PARENT_SCOPE) +endfunction() + +if(cxxopts_INCLUDE_DIR) + extract_defined_value( + "${cxxopts_INCLUDE_DIR}/cxxopts.hpp" + CXXOPTS__VERSION_MAJOR + cxxopts_VERSION_MAJOR + ) + extract_defined_value( + "${cxxopts_INCLUDE_DIR}/cxxopts.hpp" + CXXOPTS__VERSION_MINOR + cxxopts_VERSION_MINOR + ) + extract_defined_value( + "${cxxopts_INCLUDE_DIR}/cxxopts.hpp" + CXXOPTS__VERSION_PATCH + cxxopts_VERSION_PATCH + ) + set(cxxopts_VERSION "${cxxopts_VERSION_MAJOR}.${cxxopts_VERSION_MINOR}.${cxxopts_VERSION_PATCH}") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cxxopts + cxxopts_INCLUDE_DIR + cxxopts_VERSION +) + +mark_as_advanced(cxxopts_INCLUDE_DIR) +mark_as_advanced(cxxopts_VERSION) \ No newline at end of file diff --git a/cmake/SetupCxxOpts.cmake b/cmake/SetupCxxOpts.cmake index 9eedb235..f202d567 100644 --- a/cmake/SetupCxxOpts.cmake +++ b/cmake/SetupCxxOpts.cmake @@ -3,6 +3,13 @@ find_package(cxxopts CONFIG REQUIRED) log_debug("cxxopts_VERSION: ${cxxopts_VERSION}") +log_debug("cxxopts_INCLUDE_DIR: ${cxxopts_INCLUDE_DIR}") +log_debug("cxxopts_VERSION: ${cxxopts_VERSION}") + +add_library(cxxopts::cxxopts INTERFACE IMPORTED) +set_property(TARGET cxxopts::cxxopts PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${cxxopts_INCLUDE_DIR}) + file(APPEND "${CMAKE_BINARY_DIR}/BuildInformation.txt" "cxxopts Version: ${cxxopts_VERSION}\n") diff --git a/cmake/SetupHighFive.cmake b/cmake/SetupHighFive.cmake index 3a17fe4b..f5fca3f6 100644 --- a/cmake/SetupHighFive.cmake +++ b/cmake/SetupHighFive.cmake @@ -3,7 +3,11 @@ log_info("Finding HighFive") include(SetupHDF5) +<<<<<<< HEAD find_package(HighFive CONFIG) +======= +# find_package(HighFive) +>>>>>>> 697108ff (build: move brigand and cxxopts to external/ and add cmake files) if (HighFive_FOUND) log_debug("HighFive version: ${HIGHFIVE_VERSION}") diff --git a/external/brigand/LICENSE b/external/brigand/LICENSE new file mode 100644 index 00000000..7925d62e --- /dev/null +++ b/external/brigand/LICENSE @@ -0,0 +1,24 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + diff --git a/external/brigand/brigand.hpp b/external/brigand/brigand.hpp new file mode 100644 index 00000000..83f5281b --- /dev/null +++ b/external/brigand/brigand.hpp @@ -0,0 +1,2814 @@ +/*! +@file +@copyright Edouard Alligand and Joel Falcou 2015-2017 +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) +*/ +#ifndef BRIGAND_HPP_INCLUDED +#define BRIGAND_HPP_INCLUDED +namespace brigand +{ +template +struct integral_constant +{ + static const T value = Value; + using value_type = T; + using type = integral_constant; + operator value_type() const { return (value); } + value_type operator()() const { return (value); } +}; +template +const T integral_constant::value; +using true_type = ::brigand::integral_constant; +using false_type = ::brigand::integral_constant; +} +namespace brigand +{ +template +struct list +{ +}; +template +using integral_list = brigand::list...>; +using empty_sequence = brigand::list<>; +} +namespace brigand +{ +namespace detail +{ + template + struct dup_append_list; + template