From ade8f2f702a2e07c1c7dfa306362cedbb697f2b9 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Wed, 9 Apr 2025 16:07:13 -0700 Subject: [PATCH 1/2] Remove unneeded check for python3 from sdf folder We already require Python3, so remove the check and build error from sdf/CMakeLists.txt Signed-off-by: Steve Peters --- sdf/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdf/CMakeLists.txt b/sdf/CMakeLists.txt index 3bc620b3e..e206fbcb4 100644 --- a/sdf/CMakeLists.txt +++ b/sdf/CMakeLists.txt @@ -14,10 +14,6 @@ add_subdirectory(1.12) add_custom_target(schema) add_dependencies(schema schema1_11) -if (NOT Python3_Interpreter_FOUND) - gz_build_error("Python is required to generate the C++ file with the SDF content") -endif() - # Generate the EmbeddedSdf.cc file, which contains all the supported SDF # descriptions in a map of strings. The parser.cc file uses EmbeddedSdf.hh. set(EMBEDDED_SDF_CC_PATH "${PROJECT_BINARY_DIR}/src/EmbeddedSdf.cc") From f4df9bfd4f14dd45f622a9d56690a2774912bbce Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Wed, 9 Apr 2025 16:08:20 -0700 Subject: [PATCH 2/2] Fix check for psutil python package Search for python psutil package even if BUILD_TESTING is not set and move error message to the place where the memory leak test is disabled if the package is missing. This is needed because the BUILD_TESTING variable is not defined until after gz_configure_build. Signed-off-by: Steve Peters --- CMakeLists.txt | 7 +------ test/integration/CMakeLists.txt | 4 +++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfe9b4b6d..2191a6558 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,12 +123,7 @@ if (BUILD_SDF) ################################################ # Find psutil python package for memory tests - if (BUILD_TESTING) - find_python_module(psutil) - if (NOT PY_PSUTIL) - gz_build_warning("Python psutil package not found. Memory leak tests will be skipped") - endif() - endif() + find_python_module(psutil) ######################################## # Find gz math diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index e7e4b2c93..8c3f4ae16 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -63,8 +63,10 @@ set(tests world_dom.cc ) -if (Python3_Interpreter_FOUND AND PY_PSUTIL) +if (PY_PSUTIL) set(tests ${tests} element_memory_leak.cc) +else() + message(WARNING "Python psutil package not found. Memory leak tests will be skipped") endif() find_program(XMLLINT_EXE xmllint)