From cbd03dcd1961a5e411c9540f3fb7fd6e52e0cbc6 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Sun, 9 Feb 2025 16:46:57 +0000 Subject: [PATCH] Add pedantic flag for wrapper build. (#899) * Add pedantic flag for wrapper build. Bump nanobind version to 2.5.0. * Disable warning --- pyproject.toml | 2 +- python/CMakeLists.txt | 7 +++---- python/pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 94e80527d..d6db9e616 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core[pyproject]>=0.10.0", "nanobind>=2.0.0"] +requires = ["scikit-build-core[pyproject]>=0.10.0", "nanobind>=2.5.0"] build-backend = "scikit_build_core.build" [project] diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index daa6118f4..c766ba2a8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -30,16 +30,15 @@ list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}") find_package(nanobind CONFIG REQUIRED) # Create the binding library -nanobind_add_module(_basixcpp wrapper.cpp) +nanobind_add_module(_basixcpp NB_SUPPRESS_WARNINGS wrapper.cpp) target_compile_definitions(_basixcpp PRIVATE cxx_std_20) target_link_libraries(_basixcpp PRIVATE Basix::basix) # Add strict compiler flags include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-Wall -Werror -Wextra -Wno-comment -pedantic" HAVE_PEDANTIC) - +check_cxx_compiler_flag("-Wall -Werror -Wextra -pedantic" HAVE_PEDANTIC) if(HAVE_PEDANTIC) - target_compile_options(_basixcpp PRIVATE -Wall;-Wextra;-Werror;-Wno-comment) + target_compile_options(_basixcpp PRIVATE -Wall;-Werror;-Wextra;-Wno-comment;-pedantic) endif() # TODO: remove after issue https://github.com/FEniCS/basix/issues/842 is resolved diff --git a/python/pyproject.toml b/python/pyproject.toml index 864c6e9ee..c93c522d3 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core[pyproject]>=0.10.0", "nanobind>=2.0.0"] +requires = ["scikit-build-core[pyproject]>=0.10.0", "nanobind>=2.5.0"] build-backend = "scikit_build_core.build" [project]