diff --git a/.ci/.drone.yml b/.ci/.drone.yml index 4dab7ad31a..9c4fc444a9 100644 --- a/.ci/.drone.yml +++ b/.ci/.drone.yml @@ -37,7 +37,6 @@ # include: # - refs/heads/main # - refs/heads/develop -# - refs/heads/helics2 # - 'refs/pull/**' # - 'refs/tags/**' # @@ -80,6 +79,5 @@ trigger: include: - refs/heads/main - refs/heads/develop - - refs/heads/helics2 - "refs/pull/**" - "refs/tags/**" diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 53eda311aa..7673257c8b 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -12,22 +12,22 @@ jobs: strategy: matrix: ubuntuDefault: - containerImage: "helics/buildenv:ubuntu20.04-default-builder" + containerImage: "helics/buildenv:ubuntu22.04-default-builder" test_config: "ci" use_mpi: "true" encrypted: "true" - gcc8: - containerImage: "helics/buildenv:gcc8-builder" + gcc11: + containerImage: "helics/buildenv:gcc11-builder" test_config: "ci" use_mpi: "true" encrypted: "true" - clang13: - containerImage: "helics/buildenv:clang13-builder" + clang14: + containerImage: "helics/buildenv:clang14-builder" test_config: "ci" use_mpi: "" encrypted: "" - clang7: - containerImage: "helics/buildenv:clang7-builder" + clang18: + containerImage: "helics/buildenv:clang18-builder" test_config: "ci" use_mpi: "" encrypted: "" diff --git a/.circleci/config.yml b/.circleci/config.yml index a79d8eacdd..e0e2c13af8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -138,7 +138,7 @@ jobs: helicsInstall1: docker: - - image: helics/buildenv:builder + - image: helics/buildenv:ubuntu24.04-default-builder environment: CMAKE_FLAGS: "-DHELICS_BUILD_CXX_SHARED_LIB=ON -DHELICS_BUILD_TESTS=ON -DHELICS_BUILD_BENCHMARKS=ON -DHELICS_INSTALL_PACKAGE_TESTS=ON" steps: @@ -148,9 +148,9 @@ jobs: helicsNoZmq: docker: - - image: helics/buildenv:gcc10-builder + - image: helics/buildenv:gcc13-builder environment: - CMAKE_FLAGS: "-DHELICS_BUILD_CXX_SHARED_LIB=ON -DHELICS_ENABLE_ZMQ_CORE=OFF -DHELICS_ENABLE_IPC_CORE=OFF -DHELICS_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=17" + CMAKE_FLAGS: "-DHELICS_BUILD_CXX_SHARED_LIB=ON -DHELICS_ENABLE_ZMQ_CORE=OFF -DHELICS_ENABLE_IPC_CORE=OFF -DHELICS_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=20" steps: - checkout - run: *setup_helics @@ -167,7 +167,7 @@ jobs: helicsInstall2: docker: - - image: helics/buildenv:builder + - image: helics/buildenv:ubuntu24.04-default-builder environment: CMAKE_FLAGS: "-DHELICS_BUILD_TESTS=ON -DHELICS_INSTALL_PACKAGE_TESTS=ON" steps: @@ -206,7 +206,7 @@ jobs: benchmarkjob: docker: - - image: helics/buildenv:builder + - image: helics/buildenv:ubuntu24.04-default-builder environment: CMAKE_FLAGS: "-DHELICS_BUILD_BENCHMARKS=ON -DBM_RESULT_DIR=/tmp/bm_results/ -DHELICS_DISABLE_C_SHARED_LIB=ON" steps: diff --git a/.cirrus.yml b/.cirrus.yml index ba1d4682db..2a103eefe4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -7,7 +7,7 @@ task: pkg install -y cmake libzmq4 ninja git build_script: | mkdir build && cd build - cmake -GNinja -DHELICS_BUILD_TESTS=ON -DHELICS_BUILD_EXAMPLES=ON .. + cmake -GNinja -DHELICS_BUILD_TESTS=ON -DHELICS_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=17 .. cmake --build . test_script: | cd build diff --git a/.gitmodules b/.gitmodules index 7ec6e689e9..2ba3537b77 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,3 +31,12 @@ path = ThirdParty/networking url = ../../GMLC-TDC/networking.git branch = main +[submodule "ThirdParty/libzmq"] + path = ThirdParty/libzmq + url = https://github.com/zeromq/libzmq.git +[submodule "ThirdParty/googletest"] + path = ThirdParty/googletest + url = https://github.com/google/googletest.git +[submodule "ThirdParty/benchmark"] + path = ThirdParty/benchmark + url = https://github.com/google/benchmark.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a33bfa569..50af66ed89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ # SPDX-License-Identifier: BSD-3-Clause # ~~~ -cmake_minimum_required(VERSION 3.11...3.28) +cmake_minimum_required(VERSION 3.22...3.30) # Install dependencies using vcpkg if VCPKG_ROOT is set and no CMake Toolchain file is given vcpkg # installation on a system doesn't set VCPKG_ROOT, so setting it should be like an opt-in for users @@ -17,14 +17,15 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE AND NOT HELICS_D set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") endif() -project(HELICS VERSION 3.5.3) +message(STATUS "Generating with CMAKE version ${CMAKE_VERSION}") +project(HELICS VERSION 3.6.0) # ----------------------------------------------------------------------------- # HELICS Version number # ----------------------------------------------------------------------------- set(HELICS_VERSION_BUILD) # use ISO date YYYY-MM-DD -set(HELICS_DATE "2024-07-08") +set(HELICS_DATE "2024-10-08") set(HELICS_VERSION_UNDERSCORE "${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}" @@ -82,17 +83,15 @@ include(CMakeDependentOption) include(copy_key_files) include(CTest) -if(NOT CMAKE_VERSION VERSION_LESS 3.12) - option( - HELICS_ENABLE_PYTHON_BUILD_SCRIPTS - "HELICS build systems can use python to automatically generate some files. This is not required but may be useful if you are a developer and frequently modifying some files" - OFF - ) - mark_as_advanced(HELICS_ENABLE_PYTHON_BUILD_SCRIPTS) +option( + HELICS_ENABLE_PYTHON_BUILD_SCRIPTS + "HELICS build systems can use python to automatically generate some files. This is not required but may be useful if you are a developer and frequently modifying some files" + OFF +) +mark_as_advanced(HELICS_ENABLE_PYTHON_BUILD_SCRIPTS) - if(HELICS_ENABLE_PYTHON_BUILD_SCRIPTS) - find_package(Python COMPONENTS Interpreter) - endif() +if(HELICS_ENABLE_PYTHON_BUILD_SCRIPTS) + find_package(Python COMPONENTS Interpreter) endif() # allow BOOST library inclusion to be turned off completely; this option will disable the IPC core @@ -283,7 +282,25 @@ if(NOT HELICS_DISABLE_GIT_OPERATIONS) if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ThirdParty/spdlog/CMakeLists.txt") submod_update(ThirdParty/spdlog) endif() - check_submodule_status() + + set(IGNORE_MODULES libzmq) + if(HELICS_BUILD_TESTS) + if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ThirdParty/googletest/CMakeLists.txt") + submod_update(ThirdParty/googletest) + endif() + else() + list(APPEND IGNORE_MODULES googletest) + endif() + + if(HELICS_BUILD_BENCHMARKS) + if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ThirdParty/benchmark/CMakeLists.txt") + submod_update(ThirdParty/benchmark) + endif() + else() + list(APPEND IGNORE_MODULES benchmark) + endif() + + check_submodule_status(IGNORE_MODULES) endif() # NOT HELICS_DISABLE_GIT_OPERATIONS include(GNUInstallDirs) @@ -405,10 +422,12 @@ if(MSYS OR CYGWIN) set(ENABLE_IPC_CORE FALSE) endif() # setting to windows 10 for all compilation - if(WIN32_WINNT) - add_compile_definitions("_WIN32_WINNT=${WIN32_WINNT}") - else() - add_compile_definitions(_WIN32_WINNT=0x0A00) + if(NOT HELICS_SKIP_WINNT_DEFINITION) + if(WIN32_WINNT) + add_compile_definitions("_WIN32_WINNT=${WIN32_WINNT}") + else() + add_compile_definitions(_WIN32_WINNT=0x0A00) + endif() endif() endif() @@ -690,17 +709,17 @@ set(LICENSE_LIST ) if(HELICS_BUILD_TESTS) - list(APPEND LICENSE_LIST "Google Test" "${PROJECT_BINARY_DIR}/_deps/googletest-src/LICENSE") + list(APPEND LICENSE_LIST "Google Test" "${PROJECT_SOURCE_DIR}/ThirdParty/googletest/LICENSE") endif() if(HELICS_BUILD_BENCHMARKS) list(APPEND LICENSE_LIST "Google Benchmark" - "${PROJECT_BINARY_DIR}/_deps/gbenchmark-src/LICENSE" + "${PROJECT_SOURCE_DIR}/ThirdParty/benchmark/LICENSE" ) endif() if(EXISTS ${PROJECT_BINARY_DIR}/_deps/libzmq-src AND HELICS_ENABLE_ZMQ_CORE) - list(APPEND LICENSE_LIST "ZeroMQ" "${PROJECT_BINARY_DIR}/_deps/libzmq-src/LICENSE") + list(APPEND LICENSE_LIST "ZeroMQ" "${PROJECT_SOURCE_DIR}/ThirdParty/libzmq/LICENSE") endif() if(NOT HELICS_DISABLE_ASIO) @@ -786,16 +805,6 @@ cmake_dependent_option( if(HELICS_ENABLE_PACKAGE_BUILD) - if(CMAKE_VERSION VERSION_LESS 3.13) - if(HELICS_ZMQ_SUBPROJECT OR HELICS_ZMQ_FORCE_SUBPROJECT) - if(ENABLE_ZMQ_CORE) - message( - FATAL_ERROR - "CMAKE 3.13 or higher is required to package a subproject of ZeroMQ with HELICS" - ) - endif() - endif() - endif() # cmake-format: off set(CPACK_PACKAGE_NAME "Helics") set(CPACK_PACKAGE_VENDOR "GMLC") @@ -880,6 +889,8 @@ if(HELICS_ENABLE_PACKAGE_BUILD) "Helics Recorder" "helics_player" "Helics Player" + "helics_connector" + "Helics Connector" ) if(INSTALL_SYSTEM_LIBRARIES) diff --git a/ThirdParty/benchmark b/ThirdParty/benchmark new file mode 160000 index 0000000000..12235e2465 --- /dev/null +++ b/ThirdParty/benchmark @@ -0,0 +1 @@ +Subproject commit 12235e24652fc7f809373e7c11a5f73c5763fc4c diff --git a/ThirdParty/concurrency b/ThirdParty/concurrency index 3a06173deb..a051cd9327 160000 --- a/ThirdParty/concurrency +++ b/ThirdParty/concurrency @@ -1 +1 @@ -Subproject commit 3a06173debc18c6712245eb7b6e779d1837f179d +Subproject commit a051cd93273b6f051693f07d06f64f2292d517a6 diff --git a/ThirdParty/googletest b/ThirdParty/googletest new file mode 160000 index 0000000000..b514bdc898 --- /dev/null +++ b/ThirdParty/googletest @@ -0,0 +1 @@ +Subproject commit b514bdc898e2951020cbdca1304b75f5950d1f59 diff --git a/ThirdParty/libzmq b/ThirdParty/libzmq new file mode 160000 index 0000000000..622fc6dde9 --- /dev/null +++ b/ThirdParty/libzmq @@ -0,0 +1 @@ +Subproject commit 622fc6dde99ee172ebaa9c8628d85a7a1995a21d diff --git a/ThirdParty/units b/ThirdParty/units index 0e7f8ea90b..1cd73e9814 160000 --- a/ThirdParty/units +++ b/ThirdParty/units @@ -1 +1 @@ -Subproject commit 0e7f8ea90be9cefba73c8136d262a95a67cc5af2 +Subproject commit 1cd73e9814b3296dda7f55bf498124fa506594fb diff --git a/appveyor.yml b/appveyor.yml index 7e3596c1c6..b36c4685a6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,9 +5,9 @@ branches: - main - develop -version: 3.5.3.{build} +version: 3.6.0.{build} -image: Visual Studio 2019 +image: Visual Studio 2022 environment: global: @@ -19,6 +19,10 @@ environment: cache: - '%CYG_CACHE%' +init: + ps: | + (New-Object Net.WebClient).DownloadFile('https://cygwin.com/setup-x86_64.exe', 'C:\cygwin64\setup-x86_64.exe') + # # Install needed build dependencies # @@ -33,7 +37,7 @@ before_build: - mkdir build - cd build - git config --global --add safe.directory /cygdrive/c/projects/helics - - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DHELICS_ENABLE_SWIG=OFF -DHELICS_BUILD_TESTS=OFF -DHELICS_DISABLE_ASIO=ON -DHELICS_ENABLE_IPC_CORE=OFF"' + - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DHELICS_SKIP_WINNT_DEFINITION=ON -DCMAKE_CXX_STANDARD=17 -DHELICS_ENABLE_SWIG=OFF -DHELICS_DISABLE_GIT_OPERATIONS=ON -DHELICS_BUILD_TESTS=OFF -DHELICS_DISABLE_ASIO=ON -DHELICS_ENABLE_IPC_CORE=OFF"' - cd .. # Build and test, actually. diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 0cf4575ac3..615ce0cd80 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -12,7 +12,7 @@ if(hasParent) include(AddGooglebenchmark) add_subdirectory(helics) else() - cmake_minimum_required(VERSION 3.11...3.25) + cmake_minimum_required(VERSION 3.22...3.30) set(HELICS_BUILD_TESTS OFF CACHE INTERNAL "") set(HELICS_BUILD_JAVA_INTERFACE OFF CACHE INTERNAL "") set(HELICS_BUILD_CSHARP_INTERFACE OFF CACHE INTERNAL "") diff --git a/config/cmake/AddGooglebenchmark.cmake b/config/cmake/AddGooglebenchmark.cmake index 469f2476cc..80b547b9e4 100644 --- a/config/cmake/AddGooglebenchmark.cmake +++ b/config/cmake/AddGooglebenchmark.cmake @@ -7,60 +7,21 @@ # SPDX-License-Identifier: BSD-3-Clause # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -set(gbenchmark_version v1.8.3) - -string(TOLOWER "gbenchmark" gbName) - -if(NOT CMAKE_VERSION VERSION_LESS 3.11) - include(FetchContent) - - fetchcontent_declare( - gbenchmark GIT_REPOSITORY https://github.com/google/benchmark.git - GIT_TAG ${gbenchmark_version} - ) - - fetchcontent_getproperties(gbenchmark) - - if(NOT ${gbName}_POPULATED) - # Fetch the content using previously declared details - fetchcontent_populate(gbenchmark) - - endif() - - hide_variable(FETCHCONTENT_SOURCE_DIR_GBENCHMARK) - hide_variable(FETCHCONTENT_UPDATES_DISCONNECTED_GBENCHMARK) - -else() # cmake <3.11 - - # create the directory first - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/_deps) - - include(GitUtils) - git_clone( - PROJECT_NAME - gbenchmark - GIT_URL - https://github.com/google/benchmark.git - GIT_TAG - ${gbenchmark_version} - DIRECTORY - ${PROJECT_BINARY_DIR}/_deps - ) - - set(${gbName}_BINARY_DIR ${PROJECT_BINARY_DIR}/_deps/${gbName}-build) - -endif() - set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE INTERNAL "") set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "Suppressing benchmark's tests") set(BENCHMARK_ENABLE_INSTALL OFF CACHE INTERNAL "") set(BENCHMARK_DOWNLOAD_DEPENDENCIES ON CACHE INTERNAL "") set(BENCHMARK_ENABLE_ASSEMBLY_TESTS OFF CACHE INTERNAL "") +set(BENCHMARK_INSTALL_DOCS OFF CACHE INTERNAL "") # tell google benchmarks to use std regex since we only compile on compilers with std regex set(HAVE_STD_REGEX ON CACHE INTERNAL "") set(HAVE_POSIX_REGEX OFF CACHE INTERNAL "") set(HAVE_GNU_POSIX_REGEX OFF CACHE INTERNAL "") -add_subdirectory(${${gbName}_SOURCE_DIR} ${${gbName}_BINARY_DIR} EXCLUDE_FROM_ALL) + +add_subdirectory( + ${CMAKE_SOURCE_DIR}/ThirdParty/benchmark ${CMAKE_BINARY_DIR}/ThirdParty/benchmarks + EXCLUDE_FROM_ALL +) # Target must already exist macro(add_benchmark_with_main TESTNAME) @@ -92,6 +53,7 @@ hide_variable(BENCHMARK_ENABLE_LIBPFM) hide_variable(BENCHMARK_ENABLE_WERROR) hide_variable(BENCHMARK_FORCE_WERROR) hide_variable(BENCHMARK_USE_BUNDLED_GTEST) +hide_variable(CXXFEATURECHECK_DEBUG) hide_variable(LIBRT) set_target_properties(benchmark benchmark_main PROPERTIES FOLDER "Extern") diff --git a/config/cmake/AddGoogletest.cmake b/config/cmake/AddGoogletest.cmake index 0b4129f7e8..cc8bff09c9 100644 --- a/config/cmake/AddGoogletest.cmake +++ b/config/cmake/AddGoogletest.cmake @@ -8,35 +8,10 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Downloads GTest and provides a helper macro to add tests. Add make check, as well, which gives -# output on failed tests without having to set an environment variable. +# Add make check, as well, which gives output on failed tests without having to set an environment +# variable. # -set(gtest_version v1.14.0) - -string(TOLOWER "googletest" gtName) - -include(FetchContent) -mark_as_advanced(FETCHCONTENT_BASE_DIR) -mark_as_advanced(FETCHCONTENT_FULLY_DISCONNECTED) -mark_as_advanced(FETCHCONTENT_QUIET) -mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED) - -fetchcontent_declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG ${gtest_version} - GIT_SHALLOW 1 - UPDATE_COMMAND "" -) - -fetchcontent_getproperties(googletest) - -if(NOT ${gtName}_POPULATED) - # Fetch the content using previously declared details - fetchcontent_populate(googletest) - -endif() hide_variable(FETCHCONTENT_SOURCE_DIR_GOOGLETEST) hide_variable(FETCHCONTENT_UPDATES_DISCONNECTED_GOOGLETEST) @@ -46,9 +21,19 @@ set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "") set(HAVE_STD_REGEX ON CACHE INTERNAL "") set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "") -add_subdirectory(${${gtName}_SOURCE_DIR} ${${gtName}_BINARY_DIR} EXCLUDE_FROM_ALL) -message(STATUS "loading google-test directory ${${gtName}_SOURCE_DIR}") +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) + add_subdirectory( + ${CMAKE_SOURCE_DIR}/ThirdParty/googletest ${CMAKE_BINARY_DIR}/ThirdParty/googletest + EXCLUDE_FROM_ALL SYSTEM + ) +else() + add_subdirectory( + ${CMAKE_SOURCE_DIR}/ThirdParty/googletest ${CMAKE_BINARY_DIR}/ThirdParty/googletest + EXCLUDE_FROM_ALL + ) +endif() + if(NOT MSVC) # target_Compile_options(gtest PRIVATE "-Wno-undef") target_Compile_options(gmock PRIVATE # "-Wno-undef") target_Compile_options(gtest_main PRIVATE "-Wno-undef") diff --git a/config/cmake/CheckLatestCXXStandardOption.cmake b/config/cmake/CheckLatestCXXStandardOption.cmake index 8484aca690..085c1d1c5d 100644 --- a/config/cmake/CheckLatestCXXStandardOption.cmake +++ b/config/cmake/CheckLatestCXXStandardOption.cmake @@ -13,7 +13,7 @@ if(NOT CMAKE_CXX_STANDARD) if(${PROJECT_NAME}_CXX_STANDARD) set(CMAKE_CXX_STANDARD ${PROJECT_NAME}_CXX_STANDARD) else() - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 20) endif() endif() diff --git a/config/cmake/addBoost.cmake b/config/cmake/addBoost.cmake index aeacd0a426..6a9abc3f6e 100644 --- a/config/cmake/addBoost.cmake +++ b/config/cmake/addBoost.cmake @@ -13,7 +13,22 @@ mark_as_advanced(BOOST_INSTALL_PATH) if(WIN32 AND NOT UNIX_LIKE) + if(MSVC_VERSION GREATER_EQUAL 1930) + if(CMAKE_SIZE_OF_VOID_P EQUAL 4) + set(BOOST_MSVC_LIB_PATH lib32-msvc-14.3) + else() + set(BOOST_MSVC_LIB_PATH lib64-msvc-14.3) + endif() + else() + if(CMAKE_SIZE_OF_VOID_P EQUAL 4) + set(BOOST_MSVC_LIB_PATH lib32-msvc-14.2) + else() + set(BOOST_MSVC_LIB_PATH lib64-msvc-14.2) + endif() + endif() set(boost_versions + boost_1_86_0 + boost_1_85_0 boost_1_84_0 boost_1_83_0 boost_1_82_0 @@ -26,12 +41,6 @@ if(WIN32 AND NOT UNIX_LIKE) boost_1_75_0 boost_1_74_0 boost_1_73_0 - boost_1_72_0 - boost_1_71_0 - boost_1_70_0 - boost_1_69_0 - boost_1_68_0 - boost_1_67_0 ) set(poss_prefixes @@ -61,170 +70,112 @@ if(WIN32 AND NOT UNIX_LIKE) endif() endforeach() endforeach() - + message(STATUS "${boost_paths}") find_path( BOOST_TEST_PATH NAMES boost/version.hpp HINTS ENV BOOST_INSTALL_PATH PATHS ${BOOST_INSTALL_PATH} ${boost_paths} ) - if(BOOST_TEST_PATH) - set(Boost_ROOT ${BOOST_TEST_PATH}) - endif(BOOST_TEST_PATH) -else() - if(NOT Boost_ROOT) - if(BOOST_INSTALL_PATH) - set(Boost_ROOT "${BOOST_INSTALL_PATH}") - elseif($ENV{BOOST_INSTALL_PATH}) - set(Boost_ROOT "$ENV{BOOST_INSTALL_PATH}") + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30) + find_path( + BOOST_CMAKE_PATH + NAMES BoostConfig.cmake + PATHS ${BOOST_TEST_PATH}/${BOOST_MSVC_LIB_PATH}/cmake + PATH_SUFFIXES + Boost-1.86.0 + Boost-1.85.0 + Boost-1.84.0 + Boost-1.83.0 + Boost-1.82.0 + Boost-1.81.0 + Boost-1.80.0 + Boost-1.79.0 + Boost-1.78.0 + Boost-1.77.0 + Boost-1.76.0 + Boost-1.75.0 + Boost-1.74.0 + Boost-1.73.0 + ) + set(Boost_ROOT ${BOOST_CMAKE_PATH}) else() - set(Boost_ROOT "$ENV{BOOST_ROOT}") + set(Boost_ROOT ${BOOST_TEST_PATH}) endif() + endif(BOOST_TEST_PATH) +endif() +# Minimum version of Boost required for building a project + +if(NOT Boost_ROOT) + message(STATUS "Boost root not found ${Boost_ROOT}") + if(BOOST_INSTALL_PATH) + set(Boost_ROOT "${BOOST_INSTALL_PATH}") + elseif($ENV{BOOST_INSTALL_PATH}) + set(Boost_ROOT "$ENV{BOOST_INSTALL_PATH}") + else() + set(Boost_ROOT "$ENV{BOOST_ROOT}") endif() endif() +if(NOT BOOST_ROOT) + set(BOOST_ROOT ${Boost_ROOT}) + message(STATUS "setting BOOST_ROOT ${BOOST_ROOT}") +endif() + hide_variable(BOOST_TEST_PATH) if(NOT BOOST_REQUIRED_LIBRARIES) set(BOOST_REQUIRED_LIBRARIES) endif() -# Minimum version of Boost required for building a project -set(BOOST_MINIMUM_VERSION 1.67) +set(BOOST_MINIMUM_VERSION 1.73) if(BOOST_REQUIRED_LIBRARIES) - find_package(Boost ${BOOST_MINIMUM_VERSION} COMPONENTS ${BOOST_REQUIRED_LIBRARIES} REQUIRED) + find_package(Boost ${BOOST_MINIMUM_VERSION} QUIET COMPONENTS ${BOOST_REQUIRED_LIBRARIES}) else() - find_package(Boost ${BOOST_MINIMUM_VERSION}) + find_package(Boost ${BOOST_MINIMUM_VERSION} QUIET) endif() -# Minimum version of Boost required for building test suite -set(BOOST_VERSION_LEVEL ${Boost_MINOR_VERSION}) - -# message(STATUS "Using Boost include files : ${Boost_INCLUDE_DIR} |") -# message(STATUS "Using Boost libraries in : ${Boost_LIBRARY_DIRS} |") - -# message(STATUS "Using Boost libraries : ${Boost_LIBRARIES} |") -set(modifier,"") -foreach(loop_var ${Boost_LIBRARIES}) - if(loop_var STREQUAL "debug") - list(INSERT modifier 0 ${loop_var}) - elseif(loop_var STREQUAL "optimized") - list(INSERT modifier 0 ${loop_var}) - else() - # message("Boost_LIBRARIES ${loop_var}") - if(loop_var MATCHES "unit_test") - list(APPEND Boost_LIBRARIES_test ${modifier} ${loop_var}) - else() - list(APPEND Boost_LIBRARIES_core ${modifier} ${loop_var}) - endif() - if("${modifier}" STREQUAL "debug") - if(loop_var MATCHES "unit_test") - list(APPEND Boost_LIBRARIES_test_debug ${loop_var}) - else() - list(APPEND Boost_LIBRARIES_core_debug ${loop_var}) +if(NOT Boost_FOUND) + message(STATUS "in boost not found looking in ${Boost_ROOT} and ${BOOST_ROOT}") + find_path(Boost_INCLUDE_DIR NAMES boost/version.hpp boost/config.hpp PATHS ${BOOST_ROOT} + ${Boost_ROOT} + ) + message(STATUS "boost Include dir = ${Boost_INCLUDE_DIR}") + if(Boost_INCLUDE_DIR) + + set(version_file ${Boost_INCLUDE_DIR}/boost/version.hpp) + if(EXISTS "${version_file}") + file(STRINGS "${version_file}" contents REGEX "#define BOOST_(LIB_)?VERSION ") + if(contents MATCHES "#define BOOST_VERSION ([0-9]+)") + set(Boost_VERSION_MACRO "${CMAKE_MATCH_1}") endif() - else() - if(loop_var MATCHES "unit_test") - list(APPEND Boost_LIBRARIES_test_release ${loop_var}) - else() - list(APPEND Boost_LIBRARIES_core_release ${loop_var}) + if(contents MATCHES "#define BOOST_LIB_VERSION \"([0-9_]+)\"") + set(Boost_LIB_VERSION "${CMAKE_MATCH_1}") endif() - endif() - list(LENGTH modifier modifier_size) - if(modifier_size GREATER 0) - list(REMOVE_AT modifier -1) - endif() - endif() -endforeach(loop_var) + math(EXPR Boost_VERSION_MAJOR "${Boost_VERSION_MACRO} / 100000") + math(EXPR Boost_VERSION_MINOR "${Boost_VERSION_MACRO} / 100 % 1000") + math(EXPR Boost_VERSION_PATCH "${Boost_VERSION_MACRO} % 100") -# -# Add boost targets to use -# - -if(${Boost_USE_STATIC_LIBS}) - if(NOT TARGET Boostlibs::core) - add_library(Boostlibs::core STATIC IMPORTED) - endif() - if(NOT TARGET Boostlibs::test) - add_library(Boostlibs::test STATIC IMPORTED) - endif() -else() - if(NOT TARGET Boostlibs::core) - add_library(Boostlibs::core UNKNOWN IMPORTED) - endif() - if(NOT TARGET Boostlibs::test) - add_library(Boostlibs::test UNKNOWN IMPORTED) - endif() - # if(MINGW) set_property(TARGET Boostlibs::core PROPERTY INTERFACE_COMPILE_DEFINTIONS - # BOOST_USE_WINDOWS_H) endif() -endif() - -list(LENGTH Boost_LIBRARIES_core_debug core_debug_size) -list(LENGTH Boost_LIBRARIES_core_release core_release_size) - -math(EXPR rng "${core_release_size} - 1") - -if(core_debug_size EQUAL 0) - list(GET Boost_LIBRARIES_core_release 0 first_lib) - set_target_properties(Boostlibs::core PROPERTIES IMPORTED_LOCATION ${first_lib}) - - foreach(item RANGE 1 ${rng}) - list(GET Boost_LIBRARIES_core_release ${item} next_lib) - string(RANDOM LENGTH 7 rand_name) - if(Boost_USE_STATIC_LIBS) - add_library(Boostlibs::${rand_name} STATIC IMPORTED) - else() - add_library(Boostlibs::${rand_name} UNKNOWN IMPORTED) + message(STATUS "Boost VERSION ${Boost_VERSION_MACRO}") endif() - set_target_properties(Boostlibs::${rand_name} PROPERTIES IMPORTED_LOCATION ${next_lib}) - list(APPEND boost_core_deps Boostlibs::${rand_name}) - endforeach() -else() - list(GET Boost_LIBRARIES_core_release 0 first_lib_r) - list(GET Boost_LIBRARIES_core_debug 0 first_lib_d) - set_target_properties( - Boostlibs::core PROPERTIES IMPORTED_LOCATION_DEBUG ${first_lib_d} IMPORTED_LOCATION_RELEASE - ${first_lib_r} - ) - - foreach(item RANGE 1 ${rng}) - list(GET Boost_LIBRARIES_core_release ${item} next_lib_r) - list(GET Boost_LIBRARIES_core_debug ${item} next_lib_d) - string(RANDOM LENGTH 7 rand_name) - if(Boost_USE_STATIC_LIBS) - add_library(Boostlibs::${rand_name} STATIC IMPORTED) - else() - add_library(Boostlibs::${rand_name} UNKNOWN IMPORTED) + if(Boost_VERSION_MINOR GREATER_EQUAL ${BOOST_MINIMUM_VERSION}) + add_library(Boost::headers INTERFACE IMPORTED) + set_target_properties( + Boost::headers PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIR}" + ) + add_library(Boost::boost INTERFACE IMPORTED) + set_target_properties(Boost::boost PROPERTIES INTERFACE_LINK_LIBRARIES Boost::headers) + + set(Boost_FOUND ON) + message(STATUS "Setting boost found to true") endif() - set_target_properties( - Boostlibs::${rand_name} PROPERTIES IMPORTED_LOCATION_DEBUG ${next_lib_d} - IMPORTED_LOCATION_RELEASE ${next_lib_r} - ) - list(APPEND boost_core_deps Boostlibs::${rand_name}) - endforeach() -endif() - -if(Boost_INCLUDE_DIR) - set_target_properties( - Boostlibs::core Boostlibs::test PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIR} - ) -endif() -if(BOOST_REQUIRED_LIBRARIES) - set_target_properties(Boostlibs::core PROPERTIES INTERFACE_LINK_LIBRARIES "${boost_core_deps}") - if(Boost_LIBRARIES_test_debug) - set_target_properties( - Boostlibs::test PROPERTIES IMPORTED_LOCATION_DEBUG "${Boost_LIBRARIES_test_debug}" - IMPORTED_LOCATION_RELEASE "${Boost_LIBRARIES_test_release}" - ) - else() - set_target_properties( - Boostlibs::test PROPERTIES IMPORTED_LOCATION "${Boost_LIBRARIES_test_release}" - ) endif() endif() -# message(STATUS "Using Boost core debug libraries : ${Boost_LIBRARIES_core_debug}") message(STATUS -# "Using Boost core release libraries : ${Boost_LIBRARIES_core_release}") +if(NOT Boost_FOUND) + message(FATAL_ERROR " Unable to find BOOST library") +endif() +# Minimum version of Boost required for building test suite +set(BOOST_VERSION_LEVEL ${Boost_MINOR_VERSION}) diff --git a/config/cmake/addfmt.cmake b/config/cmake/addfmt.cmake index fa0e945904..2ce54f6672 100644 --- a/config/cmake/addfmt.cmake +++ b/config/cmake/addfmt.cmake @@ -35,7 +35,12 @@ if(NOT TARGET fmt::fmt) set(FMT_OS ON CACHE INTERNAL "") endif() # add the vendored FMT header only library - add_subdirectory(ThirdParty/fmtlib) + + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) + add_subdirectory(ThirdParty/fmtlib EXCLUDE_FROM_ALL SYSTEM) + else() + add_subdirectory(ThirdParty/fmtlib EXCLUDE_FROM_ALL) + endif() set_target_properties(fmt PROPERTIES FOLDER Extern) @@ -53,5 +58,6 @@ if(NOT TARGET fmt::fmt) hide_variable(FMT_PKGCONFIG_DIR) hide_variable(FMT_CMAKE_DIR) hide_variable(FMT_LIB_DIR) + hide_variable(FMT_UNICODE) endif() endif() diff --git a/config/cmake/addlibzmq.cmake b/config/cmake/addlibzmq.cmake index d6187b5bbd..2f662c1107 100644 --- a/config/cmake/addlibzmq.cmake +++ b/config/cmake/addlibzmq.cmake @@ -19,33 +19,6 @@ else() set(zmq_shared_build ON) endif() -set(${PROJECT_NAME}_LIBZMQ_VERSION v4.3.5) - -string(TOLOWER "libzmq" lcName) - -include(FetchContent) - -mark_as_advanced(FETCHCONTENT_BASE_DIR) -mark_as_advanced(FETCHCONTENT_FULLY_DISCONNECTED) -mark_as_advanced(FETCHCONTENT_QUIET) -mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED) - -fetchcontent_declare( - libzmq GIT_REPOSITORY https://github.com/zeromq/libzmq.git - GIT_TAG ${${PROJECT_NAME}_LIBZMQ_VERSION} -) - -fetchcontent_getproperties(libzmq) - -if(NOT ${lcName}_POPULATED) - # Fetch the content using previously declared details - fetchcontent_populate(libzmq) - -endif() - -hide_variable(FETCHCONTENT_SOURCE_DIR_LIBZMQ) -hide_variable(FETCHCONTENT_UPDATES_DISCONNECTED_LIBZMQ) - # Set custom variables, policies, etc. ... set(ZMQ_BUILD_TESTS OFF CACHE INTERNAL "") @@ -89,7 +62,15 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ) endif() -add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) +if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ThirdParty/libzmq/CMakeLists.txt") + submod_update(ThirdParty/libzmq) +endif() + +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) + add_subdirectory(${PROJECT_SOURCE_DIR}/ThirdParty/libzmq EXCLUDE_FROM_ALL SYSTEM) +else() + add_subdirectory(${PROJECT_SOURCE_DIR}/ThirdParty/libzmq EXCLUDE_FROM_ALL) +endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS ${OLDCMAKE_CXX_FLAGS}) @@ -138,24 +119,14 @@ if(${PROJECT_NAME}_BUILD_CXX_SHARED_LIB OR NOT ${PROJECT_NAME}_DISABLE_C_SHARED_ if(NOT ${PROJECT_NAME}_USE_ZMQ_STATIC_LIBRARY AND NOT ${PROJECT_NAME}_SKIP_ZMQ_INSTALL) set_target_properties(${zmq_target_output} PROPERTIES PUBLIC_HEADER "") - if(NOT CMAKE_VERSION VERSION_LESS "3.13") - install( - TARGETS ${zmq_target_output} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - FRAMEWORK DESTINATION "Library/Frameworks" - ) - elseif(WIN32) - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT libs - ) - else() - message( - WARNING - "Update to CMake 3.13+ or enable the ${PROJECT_NAME}_USE_ZMQ_STATIC_LIBRARY CMake option to install when using ZMQ as a subproject" - ) - endif() + install( + TARGETS ${zmq_target_output} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK DESTINATION "Library/Frameworks" + ) + if(MSVC AND NOT EMBEDDED_DEBUG_INFO AND NOT ${PROJECT_NAME}_BINARY_ONLY_INSTALL) install( FILES $ diff --git a/config/cmake/updateGitSubmodules.cmake b/config/cmake/updateGitSubmodules.cmake index 19e2602491..6f9bc9db3f 100644 --- a/config/cmake/updateGitSubmodules.cmake +++ b/config/cmake/updateGitSubmodules.cmake @@ -62,7 +62,7 @@ macro(submod_update target) endif() endmacro() -function(check_submodule_status) +function(check_submodule_status ignore_list) if(${PROJECT_NAME}_ENABLE_SUBMODULE_UPDATE) execute_process( COMMAND ${GIT_EXECUTABLE} submodule status @@ -91,11 +91,28 @@ function(check_submodule_status) ) endif() if(NOT "${SUBMODULE_STATUS}" STREQUAL "") - message( - WARNING - "Submodules are not up to date. Update submodules by running `git submodule update --init` before building HELICS." - "\nOut of date submodules:\n ${SUBMODULE_STATUS}" - ) + set(MISSING_SUBMODULES "") + set(TEST_STRING,SUBMODULE_STATUS) + string(REGEX REPLACE "\n" ";" TEST_STRING "${TEST_STRING}") + foreach(item IN LISTS TEST_STRING) + set(IGNORE_MATCHED OFF) + foreach(ignore_item IN LISTS ignore_list) + if(item MATCHES ignore_item) + set(IGNORE_MATCHED ON) + break() + endif() + endforeach() + if(NOT IGNORE_MATCH) + list(APPEND MISSING_SUBMODULES item) + endif() + endforeach() + if(MISSING_SUBMODULES) + message( + WARNING + "Submodules are not up to date. Update submodules by running `git submodule update --init` before building HELICS." + "\nOut of date submodules:\n ${SUBMODULE_STATUS}" + ) + endif() endif() endif() endfunction() diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index a7eb8a5393..4ffa7d8bcb 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -4,8 +4,6 @@ This document contains tentative plans for changes and improvements of note in u ## \[3.6\] ~ Summer 2024 -- Single thread cores -- Update IPC core - Some of the other features listed below - This release will likely update HELICS to use C++20 and update minimum Compilers, CMake, boost, and other dependencies. - GCC 11 @@ -20,6 +18,8 @@ This document contains tentative plans for changes and improvements of note in u - Separate Java Interface - Observer App - Tag based subscriptions +- Single thread cores +- Update IPC core ## Further in the future diff --git a/interfaces/java/CMakeLists.txt b/interfaces/java/CMakeLists.txt index 2573d34a53..56184bb2cf 100644 --- a/interfaces/java/CMakeLists.txt +++ b/interfaces/java/CMakeLists.txt @@ -7,7 +7,7 @@ # SPDX-License-Identifier: BSD-3-Clause # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -cmake_minimum_required(VERSION 3.11...3.24) +cmake_minimum_required(VERSION 3.22...3.30) project(helicsJAVA) get_directory_property(hasParent PARENT_DIRECTORY) @@ -84,12 +84,8 @@ include_directories(${HELICS_SWIG_INCLUDE_DIRS}) # ################################################################################################## # UseSWIG feature support # ################################################################################################## -# This can be removed in HELICS 3 if the minimum CMake version is >= 3.12 -if(NOT CMAKE_VERSION VERSION_LESS 3.12) - set(USE_MODERNIZED_SWIG ON) -else() - set(USE_MODERNIZED_SWIG OFF) -endif() + +set(USE_MODERNIZED_SWIG ON) # ################################################################################################## # Run SWIG only (no build) diff --git a/interfaces/java/MakeJarCMakeLists.txt.in b/interfaces/java/MakeJarCMakeLists.txt.in index 7f0e05bfe9..4b710af70a 100644 --- a/interfaces/java/MakeJarCMakeLists.txt.in +++ b/interfaces/java/MakeJarCMakeLists.txt.in @@ -1,5 +1,5 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Copyright (c) 2017-2020, Battelle Memorial Institute; Lawrence Livermore +# Copyright (c) 2017-2024, Battelle Memorial Institute; Lawrence Livermore # National Security, LLC; Alliance for Sustainable Energy, LLC. # See the top-level NOTICE for additional details. # All rights reserved. @@ -7,7 +7,7 @@ # SPDX-License-Identifier: BSD-3-Clause # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -cmake_minimum_required (VERSION 3.4) +cmake_minimum_required (VERSION 3.5) project (HELICSJAR LANGUAGES NONE) set(JAVA_AWT_INCLUDE_PATH "@JAVA_AWT_INCLUDE_PATH@" CACHE PATH "") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a764772357..76874915d5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,7 +11,7 @@ get_directory_property(hasParent PARENT_DIRECTORY) if(hasParent) add_subdirectory(helics) else() - cmake_minimum_required(VERSION 3.10...3.25) + cmake_minimum_required(VERSION 3.22...3.30) set(HELICS_BUILD_TESTS OFF CACHE INTERNAL "") set(HELICS_BUILD_JAVA_INTERFACE OFF CACHE INTERNAL "") diff --git a/src/helics/common/addTargets.cpp b/src/helics/common/addTargets.cpp index 70c0b1f8df..d12cf67325 100644 --- a/src/helics/common/addTargets.cpp +++ b/src/helics/common/addTargets.cpp @@ -51,12 +51,11 @@ void processOptions(const nlohmann::json& section, const std::function& valueConversion, const std::function& optionAction) { - auto stop = section.end(); for (const auto& [key, value] : section.items()) { if (value.is_array() || value.is_object()) { continue; } - int32_t index = optionConversion(key); + const int32_t index = optionConversion(key); if (index >= 0) { int32_t val = -1; if (value.is_boolean()) { @@ -110,7 +109,7 @@ void loadTags(const nlohmann::json& section, if (!tagPair.first.empty()) { tagAction(tagPair.first, tagPair.second); } else if (tagValue.is_object()) { - for (auto& item : tagValue.items()) { + for (const auto& item : tagValue.items()) { tagAction(item.key(), JsonAsString(item.value())); } } diff --git a/src/helics/core/TimeDependencies.cpp b/src/helics/core/TimeDependencies.cpp index 2ea504793c..756464f17f 100644 --- a/src/helics/core/TimeDependencies.cpp +++ b/src/helics/core/TimeDependencies.cpp @@ -840,7 +840,9 @@ const DependencyInfo& getExecEntryMinFederate(const TimeDependencies& dependenci ConnectionType ignoreType, GlobalFederateId ignore) { - static const DependencyInfo maxDep{Time::maxVal(), TimeState::initialized, 50U}; + static const DependencyInfo maxDep{Time::maxVal(), + TimeState::initialized, + static_cast(50U)}; const DependencyInfo* minDep = &maxDep; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 27eb2293d5..779aa0360f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,7 +29,7 @@ if(hasParent) endif(NOT HELICS_SWIG_GENERATE_INTERFACE_FILES_ONLY) else() - cmake_minimum_required(VERSION 3.11...3.25) + cmake_minimum_required(VERSION 3.22...3.30) set(HELICS_BUILD_TESTS ON CACHE INTERNAL "") set(HELICS_BUILD_JAVA_INTERFACE OFF CACHE INTERNAL "") diff --git a/tests/helics/CMakeLists.txt b/tests/helics/CMakeLists.txt index 07a2c511cf..ba39cfed93 100644 --- a/tests/helics/CMakeLists.txt +++ b/tests/helics/CMakeLists.txt @@ -66,7 +66,7 @@ endif() file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/find_package_tests") -if(MSVC AND ${CMAKE_VERSION} VERSION_GREATER 3.12.9) +if(MSVC) # Tests for other CMake projects including and using HELICS using find_package add_test( NAME find-package-testsA diff --git a/tests/helics/application_api/MultiInputTests.cpp b/tests/helics/application_api/MultiInputTests.cpp index f7922e6990..c84796ba22 100644 --- a/tests/helics/application_api/MultiInputTests.cpp +++ b/tests/helics/application_api/MultiInputTests.cpp @@ -141,7 +141,7 @@ TEST_F(multiInput, priority) vFed1->finalize(); } -TEST_F(multiInput, max) +TEST_F(multiInput, max_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -179,7 +179,7 @@ TEST_F(multiInput, max) vFed1->finalize(); } -TEST_F(multiInput, min) +TEST_F(multiInput, min_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -217,7 +217,7 @@ TEST_F(multiInput, min) vFed1->finalize(); } -TEST_F(multiInput, and) +TEST_F(multiInput, and_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -255,7 +255,7 @@ TEST_F(multiInput, and) vFed1->finalize(); } -TEST_F(multiInput, or) +TEST_F(multiInput, or_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -301,7 +301,7 @@ TEST_F(multiInput, or) vFed1->finalize(); } -TEST_F(multiInput, sum) +TEST_F(multiInput, sum_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -339,7 +339,7 @@ TEST_F(multiInput, sum) vFed1->finalize(); } -TEST_F(multiInput, average) +TEST_F(multiInput, average_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -377,7 +377,7 @@ TEST_F(multiInput, average) vFed1->finalize(); } -TEST_F(multiInput, diff) +TEST_F(multiInput, diff_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -411,7 +411,7 @@ TEST_F(multiInput, diff) vFed1->finalize(); } -TEST_F(multiInput, vectorize) +TEST_F(multiInput, vectorize_operation) { using namespace helics; SetupTest("test", 1, 1.0); @@ -476,12 +476,12 @@ TEST_F(multiInput, vectorize_string) vFed1->requestNextStep(); val = in1.getValue(); - auto jv = fileops::loadJsonStr(val); + auto json = fileops::loadJsonStr(val); - EXPECT_EQ(jv.size(), 3U); - EXPECT_EQ(jv[0].get(), "test1"); - EXPECT_EQ(jv[1].get(), "test2"); - EXPECT_EQ(jv[2].get(), "test3"); + EXPECT_EQ(json.size(), 3U); + EXPECT_EQ(json[0].get(), "test1"); + EXPECT_EQ(json[1].get(), "test2"); + EXPECT_EQ(json[2].get(), "test3"); vFed1->finalize(); } @@ -566,22 +566,22 @@ TEST_F(multiInput, file_config_json) { helics::ValueFederate vFed(std::string(TEST_DIR) + "multi_input_config.json"); - auto& p1 = vFed.getPublication(0); - auto& p2 = vFed.getPublication(1); - auto& i1 = vFed.getInput(0); + auto& pub1 = vFed.getPublication(0); + auto& pub2 = vFed.getPublication(1); + auto& inp1 = vFed.getInput(0); vFed.enterExecutingMode(); - auto res = i1.getOption(helics::defs::Options::CONNECTIONS); + auto res = inp1.getOption(helics::defs::Options::CONNECTIONS); EXPECT_EQ(res, 2); - res = i1.getOption(helics::defs::Options::MULTI_INPUT_HANDLING_METHOD); + res = inp1.getOption(helics::defs::Options::MULTI_INPUT_HANDLING_METHOD); EXPECT_EQ(res, HELICS_MULTI_INPUT_AVERAGE_OPERATION); - p1.publish(11.3); - p2.publish(14.7); + pub1.publish(11.3); + pub2.publish(14.7); vFed.requestNextStep(); - double val = i1.getValue(); + double val = inp1.getValue(); EXPECT_DOUBLE_EQ(val, 13.0); vFed.finalize(); @@ -591,22 +591,22 @@ TEST_F(multiInput, file_config_toml) { helics::ValueFederate vFed(std::string(TEST_DIR) + "multi_input_config.toml"); - auto& p1 = vFed.getPublication(0); - auto& p2 = vFed.getPublication(1); - auto& i1 = vFed.getInput(0); + auto& pub1 = vFed.getPublication(0); + auto& pub2 = vFed.getPublication(1); + auto& inp1 = vFed.getInput(0); vFed.enterExecutingMode(); - auto res = i1.getOption(helics::defs::Options::CONNECTIONS); + auto res = inp1.getOption(helics::defs::Options::CONNECTIONS); EXPECT_EQ(res, 2); - res = i1.getOption(helics::defs::Options::MULTI_INPUT_HANDLING_METHOD); + res = inp1.getOption(helics::defs::Options::MULTI_INPUT_HANDLING_METHOD); EXPECT_EQ(res, HELICS_MULTI_INPUT_AVERAGE_OPERATION); - p1.publish(11.3); - p2.publish(14.7); + pub1.publish(11.3); + pub2.publish(14.7); vFed.requestNextStep(); - double val = i1.getValue(); + double val = inp1.getValue(); EXPECT_DOUBLE_EQ(val, 13.0); vFed.finalize(); diff --git a/tests/helics/application_api/ValueFederateKeyTests.cpp b/tests/helics/application_api/ValueFederateKeyTests.cpp index 96a7e8e3ff..41079f56dd 100644 --- a/tests/helics/application_api/ValueFederateKeyTests.cpp +++ b/tests/helics/application_api/ValueFederateKeyTests.cpp @@ -857,9 +857,9 @@ TEST_F(valuefed, all_callback) helics::SmallBuffer buffer(547, ';'); helics::InterfaceHandle lastId; helics::Time lastTime; - vFed1->setInputNotificationCallback([&](const helics::Input& sub1, helics::Time callTime) { + vFed1->setInputNotificationCallback([&](const helics::Input& input, helics::Time callTime) { lastTime = callTime; - lastId = sub1.getHandle(); + lastId = input.getHandle(); }); vFed1->enterExecutingMode(); vFed1->publishBytes(pub3, buffer); @@ -921,9 +921,9 @@ TEST_F(valuefed, time_update_callback) helics::InterfaceHandle lastId; helics::Time lastTime{helics::Time::minVal()}; int validCount{0}; - vFed1->setInputNotificationCallback([&](const helics::Input& sub1, helics::Time callTime) { + vFed1->setInputNotificationCallback([&](const helics::Input& input, helics::Time callTime) { lastTime = callTime; - lastId = sub1.getHandle(); + lastId = input.getHandle(); }); vFed1->setTimeUpdateCallback([&](helics::Time newTime, bool iterating) { if (newTime > lastTime && !iterating) { @@ -980,9 +980,9 @@ TEST_F(valuefed, time_update_callback_single_thread) helics::InterfaceHandle lastId; helics::Time lastTime{helics::Time::minVal()}; int validCount{0}; - vFed1->setInputNotificationCallback([&](const helics::Input& sub1, helics::Time callTime) { + vFed1->setInputNotificationCallback([&](const helics::Input& input, helics::Time callTime) { lastTime = callTime; - lastId = sub1.getHandle(); + lastId = input.getHandle(); }); vFed1->setTimeUpdateCallback([&](helics::Time newTime, bool iterating) { if (newTime > lastTime && !iterating) { diff --git a/tests/helics/apps/Connector2StageTests.cpp b/tests/helics/apps/Connector2StageTests.cpp index e56fa3b4b8..1adb6c242c 100644 --- a/tests/helics/apps/Connector2StageTests.cpp +++ b/tests/helics/apps/Connector2StageTests.cpp @@ -297,7 +297,7 @@ TEST(connector_2stage, simple_connector) cfed1.finalize(); EXPECT_TRUE(cfed1.hasReceivedCommand()); fut.get(); - ASSERT_EQ(cfed1.getValueNames().size(), 1); + ASSERT_EQ(cfed1.getValueNames().size(), 1U); EXPECT_TRUE(cfed1.isInput("inp1")); EXPECT_FALSE(cfed1.getValues("inp1").empty()); EXPECT_EQ(cfed1.getValueNames(), std::vector{"inp1"}); @@ -674,8 +674,8 @@ TEST(connector_2stage, three_fed_input) vFed2.disconnect(); fut.get(); fut2.get(); - EXPECT_GE(data.size(), 1); - EXPECT_EQ(conn1.madeConnections(), 1); + EXPECT_GE(data.size(), 1U); + EXPECT_EQ(conn1.madeConnections(), 1U); EXPECT_TRUE(cfed1.hasReceivedCommand()); } diff --git a/tests/helics/apps/ConnectorTagTests.cpp b/tests/helics/apps/ConnectorTagTests.cpp index abad899c64..321614ce8b 100644 --- a/tests/helics/apps/ConnectorTagTests.cpp +++ b/tests/helics/apps/ConnectorTagTests.cpp @@ -17,8 +17,6 @@ SPDX-License-Identifier: BSD-3-Clause #include #include -static constexpr std::string_view testdir = TEST_DIR "/connector/"; - TEST(connector_tags, no_match_tag) { helics::FederateInfo fedInfo(helics::CoreType::TEST); diff --git a/tests/helics/apps/ConnectorTestsPotentialInterfaces.cpp b/tests/helics/apps/ConnectorTestsPotentialInterfaces.cpp index 94bb0b9486..204649c9f3 100644 --- a/tests/helics/apps/ConnectorTestsPotentialInterfaces.cpp +++ b/tests/helics/apps/ConnectorTestsPotentialInterfaces.cpp @@ -379,7 +379,7 @@ TEST(connector_potential_interfaces, pub_input_template) auto& pub1 = vfed.getPublication(0); auto& inp1 = vfed.getInput(0); const double testValue = 3452.562; - EXPECT_EQ(pub1.getDestinationTargetCount(), 1); + EXPECT_EQ(pub1.getDestinationTargetCount(), 1U); pub1.publish(testValue); auto retTime = vfed.requestTime(5); EXPECT_EQ(retTime, 1.0); diff --git a/tests/helics/apps/PlayerTests.cpp b/tests/helics/apps/PlayerTests.cpp index 8586572456..83d563314c 100644 --- a/tests/helics/apps/PlayerTests.cpp +++ b/tests/helics/apps/PlayerTests.cpp @@ -334,12 +334,12 @@ TEST(player_tests, testfile) vfed.finalize(); fut.get(); - EXPECT_GE(results[0].size(), 120); - EXPECT_EQ(results[1].size(), 2); - EXPECT_EQ(results[2].size(), 2); - EXPECT_EQ(results[3].size(), 2); - EXPECT_EQ(results[4].size(), 2); - EXPECT_EQ(results[5].size(), 2); + EXPECT_GE(results[0].size(), 120U); + EXPECT_EQ(results[1].size(), 2U); + EXPECT_EQ(results[2].size(), 2U); + EXPECT_EQ(results[3].size(), 2U); + EXPECT_EQ(results[4].size(), 2U); + EXPECT_EQ(results[5].size(), 2U); EXPECT_EQ(results[2][1], 63.0); } diff --git a/tests/helics/shared_library/MultiInputTests.cpp b/tests/helics/shared_library/MultiInputTests.cpp index 8a6833fdcb..c5ad5182a0 100644 --- a/tests/helics/shared_library/MultiInputTests.cpp +++ b/tests/helics/shared_library/MultiInputTests.cpp @@ -129,7 +129,7 @@ TEST_F(multiInput, priority) vFed1->finalize(); } -TEST_F(multiInput, max) +TEST_F(multiInput, max_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -166,7 +166,7 @@ TEST_F(multiInput, max) vFed1->finalize(); } -TEST_F(multiInput, min) +TEST_F(multiInput, min_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -203,7 +203,7 @@ TEST_F(multiInput, min) vFed1->finalize(); } -TEST_F(multiInput, and) +TEST_F(multiInput, and_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -240,7 +240,7 @@ TEST_F(multiInput, and) vFed1->finalize(); } -TEST_F(multiInput, or) +TEST_F(multiInput, or_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -285,7 +285,7 @@ TEST_F(multiInput, or) vFed1->finalize(); } -TEST_F(multiInput, sum) +TEST_F(multiInput, sum_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -322,7 +322,7 @@ TEST_F(multiInput, sum) vFed1->finalize(); } -TEST_F(multiInput, average) +TEST_F(multiInput, average_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -359,7 +359,7 @@ TEST_F(multiInput, average) vFed1->finalize(); } -TEST_F(multiInput, diff) +TEST_F(multiInput, diff_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -392,7 +392,7 @@ TEST_F(multiInput, diff) vFed1->finalize(); } -TEST_F(multiInput, vectorize) +TEST_F(multiInput, vectorize_operation) { SetupTest("test", 1, 1.0); auto vFed1 = GetFederateAs(0); @@ -439,23 +439,23 @@ TEST_F(multiInput, vectorize_string) auto pub2 = vFed1->registerGlobalPublication("pub2", "string"); auto pub3 = vFed1->registerGlobalPublication("pub3", "string"); - auto in1 = vFed1->registerInput("", "string"); - in1.addTarget("pub1"); - in1.addTarget("pub2"); - in1.addTarget("pub3"); - in1.setOption(HELICS_HANDLE_OPTION_MULTI_INPUT_HANDLING_METHOD, - HELICS_MULTI_INPUT_VECTORIZE_OPERATION); + auto inp1 = vFed1->registerInput("", "string"); + inp1.addTarget("pub1"); + inp1.addTarget("pub2"); + inp1.addTarget("pub3"); + inp1.setOption(HELICS_HANDLE_OPTION_MULTI_INPUT_HANDLING_METHOD, + HELICS_MULTI_INPUT_VECTORIZE_OPERATION); vFed1->enterExecutingMode(); pub1.publish("test1"); vFed1->requestNextStep(); - auto val = in1.getString(); + auto val = inp1.getString(); EXPECT_NE(val.find("\"test1\""), std::string::npos); pub3.publish("test3"); pub2.publish("test2"); vFed1->requestNextStep(); - val = in1.getString(); + val = inp1.getString(); auto aloc1 = val.find("test1"); auto aloc2 = val.find("test2"); auto aloc3 = val.find("test3"); diff --git a/tests/helics/shared_library/test-message-federate_cpp.cpp b/tests/helics/shared_library/test-message-federate_cpp.cpp index 79e5bc693d..89509434fd 100644 --- a/tests/helics/shared_library/test-message-federate_cpp.cpp +++ b/tests/helics/shared_library/test-message-federate_cpp.cpp @@ -369,7 +369,7 @@ TEST(dataBuffer, buffer) const char* str2 = "this is another string, that is fairly long that I want to put in a buffer"; buf1.fill(str1); // +1 is to account for newline stringSize is the size required to hold the string - EXPECT_EQ(buf1.stringSize(), str1.size() + 1); + EXPECT_EQ(buf1.stringSize(), static_cast(str1.size() + 1)); EXPECT_EQ(buf1.toString(), str1); buf1.fill(str2); EXPECT_EQ(buf1.toString(), str2); diff --git a/tests/helics/system_tests/QueryTests.cpp b/tests/helics/system_tests/QueryTests.cpp index 928cea8f6c..a14701a3df 100644 --- a/tests/helics/system_tests/QueryTests.cpp +++ b/tests/helics/system_tests/QueryTests.cpp @@ -1057,8 +1057,8 @@ TEST_F(query, query_subscriptions) } /// @brief helper to test if a json loads properly -/// @param jsonString -/// @return +/// @param jsonString the string containing json data +/// @return true if the string loaded as json properly bool testLoadJson(const std::string& jsonString) { auto val = nlohmann::json::parse(jsonString.begin(), jsonString.end(), nullptr, false, true); diff --git a/vcpkg.json b/vcpkg.json index b00f6a4cad..40fe82dedf 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "helics", - "version-string": "3.5.3", + "version-string": "3.6.0", "description": "Hierarchical Engine for Large-scale Infrastructure Co-Simulation (HELICS)", "homepage": "https://helics.org/", "default-features": ["zeromq", "ipc", "webserver", "encryption"],