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

Min build requirements update #2674

Merged
merged 45 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a61cc06
Update minimum build requirements for CMake and Boost
phlptp Sep 28, 2024
1dc4998
add google test to gitmodules
phlptp Sep 28, 2024
7a40cb5
add google benchmarks as a submodule
phlptp Sep 28, 2024
757439c
git working with cmake 3.30 and boost 1.86
phlptp Sep 29, 2024
10102e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2024
beff458
update submodule update code
phlptp Sep 29, 2024
5f62cfd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2024
cda0875
move the googletest and benchmark submod update
phlptp Sep 29, 2024
954e597
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2024
f4545ae
update pipelines
phlptp Sep 29, 2024
209b406
clang-tidy and boost fixes
phlptp Sep 29, 2024
4dc2459
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2024
8a806f8
try to get boost working again on CI builds
phlptp Sep 29, 2024
8a33c20
code cleanup
phlptp Sep 29, 2024
db5c6f9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2024
9a2d5e9
update some tests
phlptp Sep 30, 2024
83f5235
update cmake and concurrency
phlptp Sep 30, 2024
842b05d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 30, 2024
a2d43a9
rework addBoost
phlptp Sep 30, 2024
442ecc9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 30, 2024
f2c4786
update addBoost
phlptp Sep 30, 2024
a683ecf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 30, 2024
3f8cb2d
try again with addBoost
phlptp Sep 30, 2024
d902ad0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 30, 2024
cd2c01b
update boost find
phlptp Oct 1, 2024
be8fd97
another try at boost
phlptp Oct 1, 2024
4722940
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 1, 2024
408370e
update units library
phlptp Oct 2, 2024
d8f046d
update appveyor image
phlptp Oct 2, 2024
dd069bf
try downloading cygwin setup in appveyor.yml
phlptp Oct 2, 2024
a6d1fef
try again
phlptp Oct 2, 2024
87213f5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 2, 2024
a040bc4
try again, turn off git operations in cygwin
phlptp Oct 2, 2024
95001a2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 2, 2024
d70e5b1
update findBoost again
phlptp Oct 3, 2024
41763ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2024
f42fdcb
fix some warnings
phlptp Oct 3, 2024
f437578
Merge remote-tracking branch 'remotes/origin/develop' into min_build_…
phlptp Oct 3, 2024
cb2b4e0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2024
2a025a3
see if we can skip the WINNT definition in some cases
phlptp Oct 3, 2024
58370c4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2024
63c4bfa
more warnings and cmake fixes
phlptp Oct 3, 2024
0330787
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2024
bfeb311
Apply suggestions from code review
phlptp Oct 9, 2024
b5ecd0b
tweak the addBoost.cmake
phlptp Oct 10, 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
2 changes: 0 additions & 2 deletions .ci/.drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# include:
# - refs/heads/main
# - refs/heads/develop
# - refs/heads/helics2
# - 'refs/pull/**'
# - 'refs/tags/**'
#
Expand Down Expand Up @@ -80,6 +79,5 @@ trigger:
include:
- refs/heads/main
- refs/heads/develop
- refs/heads/helics2
- "refs/pull/**"
- "refs/tags/**"
14 changes: 7 additions & 7 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
nightlark marked this conversation as resolved.
Show resolved Hide resolved
cmake --build .
test_script: |
cd build
Expand Down
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
73 changes: 42 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -880,6 +889,8 @@ if(HELICS_ENABLE_PACKAGE_BUILD)
"Helics Recorder"
"helics_player"
"Helics Player"
"helics_connector"
"Helics Connector"
)

if(INSTALL_SYSTEM_LIBRARIES)
Expand Down
1 change: 1 addition & 0 deletions ThirdParty/benchmark
Submodule benchmark added at 12235e
1 change: 1 addition & 0 deletions ThirdParty/googletest
Submodule googletest added at b514bd
1 change: 1 addition & 0 deletions ThirdParty/libzmq
Submodule libzmq added at 622fc6
10 changes: 7 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
#
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
52 changes: 7 additions & 45 deletions config/cmake/AddGooglebenchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
Loading
Loading