From 22f83ceac3a04c601647f776665d6aa58cfdd85d Mon Sep 17 00:00:00 2001 From: Martin Weinberg Date: Sun, 22 Oct 2023 10:19:00 -0400 Subject: [PATCH] Fixes for GCC-13.x and PNG configuration - Removed initialization list for Eigen::Tensor in favor of parameter-pack resize - Only add PNG::PNG to target links if PNG is found --- coefs/BasisFactory.cc | 2 +- coefs/CMakeLists.txt | 8 ++++++-- coefs/Coefficients.cc | 4 ++-- coefs/FieldGenerator.cc | 2 +- pyEXP/CMakeLists.txt | 6 +++++- src/CMakeLists.txt | 6 +++++- utils/Analysis/CMakeLists.txt | 8 ++++++-- utils/MSSA/CMakeLists.txt | 10 +++++++--- utils/PhaseSpace/CMakeLists.txt | 8 ++++++-- utils/Test/CMakeLists.txt | 6 +++++- 10 files changed, 44 insertions(+), 16 deletions(-) diff --git a/coefs/BasisFactory.cc b/coefs/BasisFactory.cc index 48bb5817f..9d8dd41ce 100644 --- a/coefs/BasisFactory.cc +++ b/coefs/BasisFactory.cc @@ -2367,7 +2367,7 @@ namespace BasisClasses Eigen::Tensor ret; try { - ret.resize({rows, 6, nout}); + ret.resize(rows, 6, nout); } catch (const std::bad_alloc& e) { std::cout << "BasicFactor::IntegrateOrbits: memory allocation failed: " diff --git a/coefs/CMakeLists.txt b/coefs/CMakeLists.txt index c4a18aa1d..13abe73c7 100644 --- a/coefs/CMakeLists.txt +++ b/coefs/CMakeLists.txt @@ -1,7 +1,11 @@ set(bin_PROGRAMS nativetoh5 h5compare viewcoefs h5power makecoefs testread) -set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX PNG::PNG yaml-cpp - exputil ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) +set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp exputil + ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) + +if(PNG_FOUND) + list(APPEND common_LINKLIB PNG::PNG) +endif() set(common_INCLUDE $ $ diff --git a/coefs/Coefficients.cc b/coefs/Coefficients.cc index be310b124..64e957f32 100644 --- a/coefs/Coefficients.cc +++ b/coefs/Coefficients.cc @@ -233,7 +233,7 @@ namespace CoefClasses int ntim = times.size(); // Resize the tensor - ret.resize({(Lmax+1)*(Lmax+2)/2, Nmax, ntim}); + ret.resize((Lmax+1)*(Lmax+2)/2, Nmax, ntim); for (int t=0; t> frame; for (auto label : labels) { - frame[label].resize({grid[0], grid[1], grid[2]}); + frame[label].resize(grid[0], grid[1], grid[2]); } std::vector del = diff --git a/pyEXP/CMakeLists.txt b/pyEXP/CMakeLists.txt index b1423f25e..a91b7303a 100644 --- a/pyEXP/CMakeLists.txt +++ b/pyEXP/CMakeLists.txt @@ -2,9 +2,13 @@ find_package (Python3 COMPONENTS Interpreter Development) # Default build environment # -set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX PNG::PNG yaml-cpp +set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp exputil ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) +if(PNG_FOUND) + list(APPEND common_LINKLIB PNG::PNG) +endif() + set(common_INCLUDE $ $ $ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66792207f..bc0cd6690 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,11 @@ if (ENABLE_DSMC) endif() set(common_LINKLIB ${DSMC_LIBS} exputil expcoef OpenMP::OpenMP_CXX - MPI::MPI_CXX PNG::PNG yaml-cpp ${VTK_LIBRARIES}) + MPI::MPI_CXX yaml-cpp ${VTK_LIBRARIES}) + +if(PNG_FOUND) + list(APPEND common_LINKLIB PNG::PNG) +endif() if(CUDA_FOUND) list(APPEND common_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) diff --git a/utils/Analysis/CMakeLists.txt b/utils/Analysis/CMakeLists.txt index 6e82b4f10..9b06a02ee 100644 --- a/utils/Analysis/CMakeLists.txt +++ b/utils/Analysis/CMakeLists.txt @@ -5,8 +5,12 @@ set(bin_PROGRAMS diskcoef halocoef diskcoef diskprof haloprof slabprof pcatest readcoefsD readcoefsH sphprof pspxvalH pspxvalH2 pspxvalD pspxvalD2 pspKLH pspKLD diskeof yaml_diff kdtest) -set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX PNG::PNG yaml-cpp - exputil ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) +set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp exputil + ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) + +if(PNG_FOUND) + list(APPEND common_LINKLIB PNG::PNG) +endif() if(CUDA_FOUND) list(APPEND common_LINKLIB ${CUDA_LIBRARIES} ${CUDA_nvToolsExt_LIBRARY}) diff --git a/utils/MSSA/CMakeLists.txt b/utils/MSSA/CMakeLists.txt index 3900aa9cc..e9061f18e 100644 --- a/utils/MSSA/CMakeLists.txt +++ b/utils/MSSA/CMakeLists.txt @@ -1,8 +1,12 @@ set(bin_PROGRAMS exp_haloN disk_noise halo_noise expmssa) -set(common_LINKLIB - yaml-cpp PNG::PNG exputil ${VTK_LIBRARIES} ${EIGEN3_LIBRARIES} - ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${FFTW_DOUBLE_LIB}) +set(common_LINKLIB yaml-cpp exputil ${VTK_LIBRARIES} + ${EIGEN3_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} + ${FFTW_DOUBLE_LIB}) + +if(PNG_FOUND) + list(APPEND common_LINKLIB PNG::PNG) +endif() set(common_INCLUDE $ $ diff --git a/utils/PhaseSpace/CMakeLists.txt b/utils/PhaseSpace/CMakeLists.txt index 0701a1072..963d731e4 100644 --- a/utils/PhaseSpace/CMakeLists.txt +++ b/utils/PhaseSpace/CMakeLists.txt @@ -13,8 +13,12 @@ if(HAVE_XDR) list(APPEND bin_PROGRAMS tipstd2psp) endif() -set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX PNG::PNG yaml-cpp - expcoef exputil PNG::PNG ${VTK_LIBRARIES} ${HDF5_LIBRARIES}) +set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp expcoef + exputil ${VTK_LIBRARIES} ${HDF5_LIBRARIES}) + +if(PNG_FOUND) + list(APPEND common_LINKLIB PNG::PNG) +endif() if(CUDA_FOUND) list(APPEND common_LINKLIB ${CUDA_LIBRARIES} ${CUDA_nvToolsExt_LIBRARY}) diff --git a/utils/Test/CMakeLists.txt b/utils/Test/CMakeLists.txt index c39d18255..f57001b14 100644 --- a/utils/Test/CMakeLists.txt +++ b/utils/Test/CMakeLists.txt @@ -1,9 +1,13 @@ set(bin_PROGRAMS readSL testBarrier testConfig testBessz) -set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX PNG::PNG expcoef exputil +set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX expcoef exputil yaml-cpp ${VTK_LIBRARIES}) +if(PNG_FOUND) + list(APPEND common_LINKLIB PNG::PNG) +endif() + set(common_INCLUDE $ $