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

Implement a region calculus #995

Open
wants to merge 75 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
47cb769
Import region calculus functions
eschnett May 25, 2021
84796f8
Add example classes `point` and `ndpoint`
eschnett May 28, 2021
7eb8dbe
Re-write Point class
eschnett Jun 4, 2021
5d0e233
Implement Regions::Box
eschnett Jun 5, 2021
40232dd
Clean up namespaces
eschnett Jun 5, 2021
3e39868
First cut at bounding box sets
eschnett Jun 6, 2021
83c48f4
More tests (and error corrections) for regions
eschnett Jun 7, 2021
11d512d
Add example. Use C++17 for regions.
eschnett Jun 7, 2021
b4d05e5
Add missing include files
eschnett Jun 7, 2021
860ffc4
Correct #include statements
eschnett Jun 7, 2021
6e83f3a
Avoid some compiler warnings
eschnett Jun 7, 2021
e94bf59
Mark function argument as used
eschnett Jun 7, 2021
940d57f
Avoid more compiler warnings
eschnett Jun 7, 2021
5b9a95c
Avoid compiler warnings
eschnett Jun 7, 2021
529b4ac
Avoid compiler warnings
eschnett Jun 7, 2021
75d5661
Avoid compiler warnings
eschnett Jun 8, 2021
01ff022
Avoid compiler warnings
eschnett Jun 8, 2021
b5c0138
Avoid compiler warnings
eschnett Jun 8, 2021
1f76327
Avoid compiler warnings
eschnett Jun 8, 2021
e0b85dc
CI: Use GCC 7 instead of GCC 5
eschnett Jun 8, 2021
483bd2a
Avoid compiler warnings
eschnett Jun 8, 2021
8b3b3ad
Correct integer division by zero
eschnett Jun 8, 2021
331b48b
Correct equality and comparison operators
eschnett Jun 8, 2021
f1f3c11
cmake: New option for C++17
eschnett Jun 8, 2021
cf46121
Switch back to GCC5
eschnett Jun 8, 2021
0751fca
Avoid compiler warnings
eschnett Jun 8, 2021
ac9af25
CI: Enable C++17 where supported
eschnett Jun 8, 2021
e144d3a
Make comparison manifestly type-safe
eschnett Jun 8, 2021
c7b8cf2
Disable C++ on systems where it doesn't work
eschnett Jun 8, 2021
4b373a6
Try to avoid comparison failures
eschnett Jun 8, 2021
bdd1971
Avoid compiler warnings
eschnett Jun 8, 2021
77358ae
Try to allow comparing infinities
eschnett Jun 8, 2021
99a6e62
CI: Disable C++17 for clang-tidy
eschnett Jun 8, 2021
055ffb7
Update catch2 calls
eschnett Jun 8, 2021
1463411
CI: Enable debug info
eschnett Jun 8, 2021
a689ecf
Add debug statements
eschnett Jun 8, 2021
fadb375
More debug tests
eschnett Jun 8, 2021
b145c02
Correct illegal memory access
eschnett Jun 8, 2021
686d14d
Beautify output in example 13
eschnett Jun 8, 2021
2ac1e7f
New constructor NDPoint(Point)
eschnett Jun 8, 2021
3fb5920
Try to appease icpc
eschnett Jun 8, 2021
fb084cc
Complete regions example
eschnett Jun 14, 2021
6fa5863
Rename set property functions
eschnett Jun 18, 2021
c09057f
Merge branch 'dev' into eschnett/regioncalculus
eschnett Jun 18, 2021
3bedaee
Merge branch 'dev' into eschnett/regioncalculus
eschnett Jun 22, 2021
3a45617
Update example
eschnett Jun 23, 2021
2f5018f
Make region algebra optional
eschnett Jun 23, 2021
84d9108
Require C++17 for the region algebra
eschnett Jun 24, 2021
e9a46cd
Remove unintended CMakeLists change
eschnett Jun 24, 2021
c59bc20
CI: Update regions options
eschnett Jun 24, 2021
5d76387
Merge branch 'dev' into eschnett/regioncalculus
eschnett Jun 24, 2021
b5afb43
Implement NDBox
eschnett Jun 25, 2021
5145971
CMake: Debug regions settings
eschnett Jun 26, 2021
7d65e4d
CMake: Remove debug output
eschnett Jun 26, 2021
6159f94
Implement NDRegion
eschnett Jun 26, 2021
93cc8d3
CMake: Correct C++17 tests
eschnett Jun 26, 2021
aa6b0be
CI: Disable regions on icc
eschnett Jun 26, 2021
c435db2
Tests: Compare ndims with signed integer
eschnett Jun 26, 2021
93ad888
CI: Debug
eschnett Jun 26, 2021
0c46a71
CI: Disable regions on Windows
eschnett Jun 26, 2021
68d409a
CI: Correct typo
eschnett Jun 26, 2021
2fd5c9b
Regions: Add comments
eschnett Jun 27, 2021
a2f07e7
Regions: Remove unused code
eschnett Jun 27, 2021
10fe81b
Regions: Document boxes
eschnett Jun 27, 2021
15399b1
Document Regionss
eschnett Jun 27, 2021
c436db6
Merge branch 'dev' into eschnett/regioncalculus
eschnett Jul 8, 2021
8d1de67
Merge branch 'dev' into eschnett/regioncalculus
eschnett Jul 12, 2021
8f843cc
Remove unwanted files
eschnett Jul 12, 2021
092569f
Use `#pragma once`
eschnett Jul 12, 2021
d617383
Abort when openPMD_USE_REGIONS is requested, but C++17 is not supported
eschnett Jul 12, 2021
36551f2
Use `using` instead of `typedef`
eschnett Jul 12, 2021
23f2133
cmake: Disable Regions by default
eschnett Jul 12, 2021
5939968
Don't use std::ptrdiff type
franzpoeschel Jul 13, 2021
368d2f3
Merge pull request #1 from franzpoeschel/regioncalculus-warnings
eschnett Jul 23, 2021
32424d8
Merge branch 'dev' into eschnett/regioncalculus
eschnett Jul 23, 2021
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
61 changes: 61 additions & 0 deletions .github/ci/spack-envs/gcc7_py36_ompi_h5_ad1_ad2/spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This is a Spack environment file.
#
# Activating and installing this environment will provide all dependencies
# that are needed for full-feature development.
# https//spack.readthedocs.io/en/latest/environments.html#anonymous-environments
#
spack:
specs:
- adios
- adios2
- hdf5
- openmpi

packages:
adios:
variants: ~zfp ~sz ~lz4 ~blosc
adios2:
variants: ~zfp ~sz ~png ~dataman ~python ~fortran ~ssc ~shared ~bzip2
cmake:
externals:
- spec: "cmake"
prefix: /usr
buildable: False
openmpi:
externals:
- spec: "openmpi"
prefix: /usr
buildable: False
perl:
externals:
- spec: "perl"
prefix: /usr
buildable: False
python:
externals:
- spec: "python"
prefix: /usr
buildable: False
all:
target: ['x86_64']
variants: ~fortran
compiler: [[email protected]]

compilers:
- compiler:
environment: {}
extra_rpaths: []
flags: {}
modules: []
operating_system: ubuntu18.04
paths:
cc: /usr/bin/gcc-7
cxx: /usr/bin/g++-7
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
spec: [email protected]
target: x86_64

config:
build_jobs: 2

35 changes: 23 additions & 12 deletions .github/workflows/unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ jobs:
sudo .github/workflows/dependencies/install_spack
- name: Build
env: {CC: clang, CXX: clang++, CXXFLAGS: -Wno-deprecated-declarations}
# The main openPMD code base leads to many clang-tidy warnings
# when C++17 is enabled. We cannot enable it yet.
run: |
eval $(spack env activate --sh .github/ci/spack-envs/clangtidy_nopy_ompi_h5_ad1_ad2/)
spack install

mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-system-headers=0" -DopenPMD_USE_INVASIVE_TESTS=ON
cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-system-headers=0" -DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build . --parallel 2 2> clang-tidy.log
cat clang-tidy.log
if [[ $(wc -m <clang-tidy.log) -gt 1 ]]; then exit 1; fi
Expand Down Expand Up @@ -52,7 +54,7 @@ jobs:
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
export LDFLAGS="${LDFLAGS} -fsanitize=address,undefined -shared-libsan"
CXXFLAGS="${CXXFLAGS} -fsanitize=address,undefined -shared-libsan"
CXXFLAGS="${CXXFLAGS}" cmake -S .. -B . -DopenPMD_USE_MPI=ON -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_ADIOS1=ON -DopenPMD_USE_INVASIVE_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON
CXXFLAGS="${CXXFLAGS}" cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DopenPMD_USE_MPI=ON -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_ADIOS1=ON -DopenPMD_USE_INVASIVE_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DopenPMD_CXX_STANDARD=17
cmake --build . --parallel 2
export ASAN_OPTIONS=detect_stack_use_after_return=1:detect_leaks=1:check_initialization_order=true:strict_init_order=true:detect_stack_use_after_scope=1:fast_unwind_on_malloc=0
export LSAN_OPTIONS=suppressions="$SOURCEPATH/.github/ci/sanitizer/clang/Leak.supp"
Expand All @@ -73,13 +75,14 @@ jobs:
sudo .github/workflows/dependencies/install_spack
- name: Build
env: {CC: clang-5.0, CXX: clang++-5.0, CXXFLAGS: -Werror -Wno-deprecated-declarations}
# Clang 5 does not handle GCC 10's STL in C++17-mode
run: |
eval $(spack env activate --sh .github/ci/spack-envs/clang5_nopy_nompi_h5/)
spack install

mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . -DopenPMD_USE_PYTHON=OFF -DopenPMD_USE_MPI=OFF -DopenPMD_USE_HDF5=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DopenPMD_USE_PYTHON=OFF -DopenPMD_USE_MPI=OFF -DopenPMD_USE_HDF5=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build . --parallel 2
ctest --output-on-failure

Expand All @@ -97,13 +100,14 @@ jobs:
sudo .github/workflows/dependencies/install_spack
- name: Build
env: {CC: clang-5.0, CXX: clang++-5.0, CXXFLAGS: -Werror -Wno-deprecated-declarations}
# Clang 5 does not handle GCC 10's STL in C++17-mode
run: |
eval $(spack env activate --sh .github/ci/spack-envs/clang5_nopy_ompi_h5_ad1_ad2_bp3/)
spack install

mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . -DopenPMD_USE_PYTHON=OFF -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS1=ON -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DopenPMD_USE_PYTHON=OFF -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS1=ON -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build . --parallel 2
ctest --output-on-failure

Expand All @@ -126,13 +130,14 @@ jobs:
sudo .github/workflows/dependencies/install_spack
- name: Build
env: {CC: clang-5.0, CXX: clang++-5.0, CXXFLAGS: -Werror -Wno-deprecated-declarations}
# Clang 5 does not handle GCC 10's STL in C++17-mode
run: |
eval $(spack env activate --sh .github/ci/spack-envs/clang5_nopy_ompi_h5_ad1_ad2_bp3/)
spack install

mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . -DopenPMD_USE_PYTHON=OFF -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS1=OFF -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DopenPMD_USE_PYTHON=OFF -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS1=OFF -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build . --parallel 2
export OPENPMD2_ADIOS2_SCHEMA=20210209
ctest --output-on-failure
Expand All @@ -158,7 +163,7 @@ jobs:
run: |
mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_MPI=OFF -DopenPMD_USE_HDF5=ON -DopenPMD_USE_INVASIVE_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON
cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_MPI=OFF -DopenPMD_USE_HDF5=ON -DopenPMD_USE_INVASIVE_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DopenPMD_CXX_STANDARD=17
cmake --build . --parallel 2
ctest --output-on-failure

Expand Down Expand Up @@ -192,7 +197,7 @@ jobs:
run: |
mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build . --parallel 2
ctest --output-on-failure

Expand All @@ -213,7 +218,7 @@ jobs:
- uses: actions/checkout@v2
- name: Spack Cache
uses: actions/cache@v2
with: {path: /opt/spack, key: gcc5_py36_ompi_h5_ad1_ad2 }
with: {path: /opt/spack, key: gcc7_py36_ompi_h5_ad1_ad2 }
- name: Install
run: |
sudo apt-get update
Expand All @@ -226,14 +231,15 @@ jobs:
python3 -m pip install -U dask
python3 -m pip install -U pyarrow
- name: Build
env: {CC: gcc-5, CXX: g++-5, CXXFLAGS: -Werror -Wno-deprecated-declarations}
env: {CC: gcc-7, CXX: g++-7, CXXFLAGS: -Werror -Wno-deprecated-declarations}
run: |
eval $(spack env activate --sh .github/ci/spack-envs/gcc5_py36_ompi_h5_ad1_ad2/)
eval $(spack env activate --sh .github/ci/spack-envs/gcc7_py36_ompi_h5_ad1_ad2/)
spack install

mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DopenPMD_USE_PYTHON=ON \
-DopenPMD_USE_MPI=ON \
-DopenPMD_USE_HDF5=ON \
Expand All @@ -257,7 +263,7 @@ jobs:
run: |
mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_INVASIVE_TESTS=ON
cmake -S .. -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_MPI=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_INVASIVE_TESTS=ON -DopenPMD_CXX_STANDARD=17
cmake --build . --parallel 2
ctest --output-on-failure

Expand Down Expand Up @@ -304,11 +310,14 @@ jobs:
sudo .github/workflows/dependencies/install_icc
- name: Build
env: {CXXFLAGS: -Werror -Wno-deprecated-declarations}
# C++17 not properly supported (false positives for unused
# arguments and missing return statements with `if constexpr`)
run: |
set +e; source /opt/intel/oneapi/setvars.sh; set -e
mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=$(which icc) \
-DCMAKE_CXX_COMPILER=$(which icpc) \
-DopenPMD_USE_PYTHON=OFF \
Expand All @@ -330,6 +339,7 @@ jobs:
mkdir build && cd build
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
cmake -S .. -B . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=$(which icx) \
-DCMAKE_CXX_COMPILER=$(which icpx) \
-DopenPMD_USE_PYTHON=OFF \
Expand All @@ -339,6 +349,7 @@ jobs:
-DCMAKE_C_STANDARD_COMPUTED_DEFAULT="11" \
-DCMAKE_CXX_COMPILER_ID="Clang" \
-DCMAKE_CXX_COMPILER_VERSION=12.0 \
-DCMAKE_CXX_STANDARD_COMPUTED_DEFAULT="14"
-DCMAKE_CXX_STANDARD_COMPUTED_DEFAULT="17" \
-DopenPMD_CXX_STANDARD=17
cmake --build . --parallel 2
ctest --output-on-failure
57 changes: 52 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ openpmd_option(ADIOS1 "ADIOS1 backend (.bp files)" AUTO)
openpmd_option(ADIOS2 "ADIOS2 backend (.bp files)" AUTO)
openpmd_option(PYTHON "Enable Python bindings" AUTO)

option(openPMD_CXX_STANDARD "Which C++ standard to use (14 or 17)" OFF)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative suggestion:

Suggested change
option(openPMD_CXX_STANDARD "Which C++ standard to use (14 or 17)" OFF)
openpmd_option(REGION "Enable regions interfaces (C++17)" AUTO)

And below we check:

CMAKE_CXX_COMPILE_FEATURES
if(openPMD_USE_REGION STREQUAL AUTO)
    if ("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
        set(openPMD_HAVE_REGION ON)
    else()
        set(openPMD_HAVE_REGION OFF)
    endif()
elseif(openPMD_USE_REGION)
    set(openPMD_HAVE_REGION ON)
else()
    set(openPMD_HAVE_REGION OFF)
endif()

This way we:

  • get the feature by default for all new compilers
  • can enforce enable/disable of the feature so it does not accidentally disable itself, e.g. for package managers and CI
  • keep full control & standardization over C++14/17/20/... via CMAKE_CXX_STANDARD options

option(openPMD_INSTALL "Add installation targets" ON)
option(openPMD_HAVE_PKGCONFIG "Generate a .pc file for pkg-config" ON)
option(openPMD_USE_INTERNAL_VARIANT "Use internally shipped MPark.Variant" ON)
Expand All @@ -79,6 +80,17 @@ option(openPMD_USE_INTERNAL_JSON "Use internally shipped nlohmann-json" ON)
option(openPMD_USE_INVASIVE_TESTS "Enable unit tests that modify source code" OFF)
option(openPMD_USE_VERIFY "Enable internal VERIFY (assert) macro independent of build type" ON)

if(NOT openPMD_CXX_STANDARD)
set(openPMD_CXX_STANDARD 14)
endif()
if(openPMD_CXX_STANDARD STREQUAL 14)
set(openPMD_CXX_STD cxx_std_14)
elseif(openPMD_CXX_STANDARD STREQUAL 17)
set(openPMD_CXX_STD cxx_std_17)
else()
message(FATAL_ERROR "openPMD_CXX_STANDARD must be either 14 or 17; found ${openPMD_CXX_STANDARD}")
endif()
eschnett marked this conversation as resolved.
Show resolved Hide resolved

set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
Expand Down Expand Up @@ -396,9 +408,10 @@ add_library(openPMD::openPMD ALIAS openPMD)

# properties
target_compile_features(openPMD
PUBLIC cxx_std_14
PUBLIC ${openPMD_CXX_STD}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PUBLIC ${openPMD_CXX_STD}
PUBLIC cxx_std_14

)
set_target_properties(openPMD PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't set those properties since CXX_STANDARD means exactly C++-version X.
We express "at least C++-version X" via target_compile_features

Suggested change
CXX_STANDARD ${openPMD_CXX_STANDARD}

CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
Expand Down Expand Up @@ -475,10 +488,10 @@ if(openPMD_HAVE_ADIOS1)
add_library(openPMD.ADIOS1.Serial SHARED ${IO_ADIOS1_SEQUENTIAL_SOURCE})
add_library(openPMD.ADIOS1.Parallel SHARED ${IO_ADIOS1_SOURCE})
target_compile_features(openPMD.ADIOS1.Serial
PUBLIC cxx_std_14
PUBLIC ${openPMD_CXX_STD}
eschnett marked this conversation as resolved.
Show resolved Hide resolved
)
target_compile_features(openPMD.ADIOS1.Parallel
PUBLIC cxx_std_14
PUBLIC ${openPMD_CXX_STD}
eschnett marked this conversation as resolved.
Show resolved Hide resolved
)
target_compile_options(openPMD.ADIOS1.Serial PUBLIC ${_msvc_options})
target_compile_options(openPMD.ADIOS1.Parallel PUBLIC ${_msvc_options})
Expand All @@ -498,6 +511,7 @@ if(openPMD_HAVE_ADIOS1)
endif()

set_target_properties(openPMD.ADIOS1.Serial PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
eschnett marked this conversation as resolved.
Show resolved Hide resolved
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
Expand Down Expand Up @@ -525,6 +539,7 @@ if(openPMD_HAVE_ADIOS1)

if(openPMD_HAVE_MPI)
set_target_properties(openPMD.ADIOS1.Parallel PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
eschnett marked this conversation as resolved.
Show resolved Hide resolved
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
Expand Down Expand Up @@ -685,6 +700,13 @@ set(openPMD_TEST_NAMES
SerialIO
ParallelIO
)
if(openPMD_CXX_STANDARD STREQUAL 17)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(openPMD_CXX_STANDARD STREQUAL 17)
if(openPMD_HAVE_REGION)

list(APPEND openPMD_TEST_NAMES
RegionsBox
RegionsPoint
RegionsRegion
)
endif()
# command line tools
set(openPMD_CLI_TOOL_NAMES
ls
Expand All @@ -711,6 +733,11 @@ set(openPMD_EXAMPLE_NAMES
10_streaming_read
12_span_write
)
if(openPMD_CXX_STANDARD STREQUAL 17)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(openPMD_CXX_STANDARD STREQUAL 17)
if(openPMD_HAVE_REGION)

list(APPEND openPMD_EXAMPLE_NAMES
13_regions
)
endif()
set(openPMD_PYTHON_EXAMPLE_NAMES
2_read_serial
2a_read_thetaMode_serial
Expand All @@ -737,9 +764,10 @@ if(openPMD_BUILD_TESTING)
test/CatchRunner.cpp) # Always MPI_Init with Serial Fallback
add_library(CatchMain ${_openpmd_lib_type}
test/CatchMain.cpp) # Serial only
target_compile_features(CatchRunner PUBLIC cxx_std_14)
target_compile_features(CatchMain PUBLIC cxx_std_14)
target_compile_features(CatchRunner PUBLIC ${openPMD_CXX_STD})
target_compile_features(CatchMain PUBLIC ${openPMD_CXX_STD})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_compile_features(CatchRunner PUBLIC ${openPMD_CXX_STD})
target_compile_features(CatchMain PUBLIC ${openPMD_CXX_STD})
target_compile_features(CatchRunner PUBLIC cxx_std_14)
target_compile_features(CatchMain PUBLIC cxx_std_14)

set_target_properties(CatchRunner CatchMain PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CXX_STANDARD ${openPMD_CXX_STANDARD}

CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
Expand All @@ -766,6 +794,12 @@ if(openPMD_BUILD_TESTING)
else()
target_link_libraries(${testname}Tests PRIVATE CatchMain)
endif()
target_compile_features(${testname}Tests PUBLIC ${openPMD_CXX_STD})
set_target_properties(${testname}Tests PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set_target_properties(${testname}Tests PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
if(openPMD_HAVE_REGION)
target_compile_features(${testname}Tests PUBLIC cxx_std_17)
endif()

endforeach()
endif()

Expand All @@ -782,10 +816,22 @@ if(openPMD_BUILD_EXAMPLES)
if(openPMD_HAVE_MPI)
add_executable(${examplename} examples/${examplename}.cpp)
target_link_libraries(${examplename} PRIVATE openPMD)
target_compile_features(${examplename} PUBLIC ${openPMD_CXX_STD})
set_target_properties(${examplename} PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_compile_features(${examplename} PUBLIC ${openPMD_CXX_STD})
set_target_properties(${examplename} PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
if(openPMD_HAVE_REGION)
target_compile_features(${examplename} PUBLIC cxx_std_17)
endif()

endif()
else()
add_executable(${examplename} examples/${examplename}.cpp)
target_link_libraries(${examplename} PRIVATE openPMD)
target_compile_features(${examplename} PUBLIC ${openPMD_CXX_STD})
set_target_properties(${examplename} PROPERTIES
CXX_STANDARD ${openPMD_CXX_STANDARD}
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
eschnett marked this conversation as resolved.
Show resolved Hide resolved
endif()
endforeach()
endif()
Expand Down Expand Up @@ -1309,6 +1355,7 @@ else()
message(" Installation: OFF")
endif()
message("")
message(" C++ standard: ${openPMD_CXX_STD}")
eschnett marked this conversation as resolved.
Show resolved Hide resolved
message(" Build Type: ${CMAKE_BUILD_TYPE}")
if(openPMD_BUILD_SHARED_LIBS)
message(" Library: shared")
Expand Down
Loading