cp2k: patch for compilation with RelWithDebInfo (#42563)

This commit is contained in:
Rocco Meli 2024-02-08 15:42:43 +01:00 committed by GitHub
parent 09fdea959f
commit 7090983c67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,23 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4526160ad..8218a7a3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,18 @@ string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
string(REPLACE "-DNDEBUG" "" CMAKE_Fortran_FLAGS_RELEASE
${CMAKE_Fortran_FLAGS_RELEASE})
+string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO
+ ${CMAKE_C_FLAGS_RELWITHDEBINFO})
+string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+string(REPLACE "-DNDEBUG" "" CMAKE_Fortran_FLAGS_RELWITHDEBINFO
+ ${CMAKE_Fortran_FLAGS_RELWITHDEBINFO})
+string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_MINSIZEREL
+ ${CMAKE_C_FLAGS_MINSIZEREL})
+string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_MINSIZEREL
+ ${CMAKE_CXX_FLAGS_MINSIZEREL})
+string(REPLACE "-DNDEBUG" "" CMAKE_Fortran_FLAGS_MINSIZEREL
+ ${CMAKE_Fortran_FLAGS_MINSIZEREL})
find_package(PkgConfig)

View File

@ -271,7 +271,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
depends_on("cmake@3.22:", type="build")
# DBCSR as external dependency
depends_on("dbcsr@2.6:")
depends_on("dbcsr@2.6: ~examples")
depends_on("dbcsr+openmp", when="+openmp")
depends_on("dbcsr+mpi", when="+mpi")
depends_on("dbcsr+cuda", when="+cuda")
@ -340,6 +340,11 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
patch("backport_avoid_null_9.1.patch", when="@9.1 %aocc@:4.0")
patch("cmake-fixes-2023.2.patch", when="@2023.2 build_system=cmake")
# Allow compilation with build_type=RelWithDebInfo and build_type=MinSizeRel
# after NDEBUG support was dropped in https://github.com/cp2k/cp2k/pull/3172
# The patch applies https://github.com/cp2k/cp2k/pull/3251 to version 2024.1
patch("cmake-relwithdebinfo-2024.1.patch", when="@2024.1 build_system=cmake")
# Patch for an undefined constant due to incompatible changes in ELPA
@when("@9.1:2022.2 +elpa")
def patch(self):