Skip to content

Commit fc28ca6

Browse files
guitargeekdpiparo
authored andcommitted
[TMVA] Disable relevant PyMVA tests if BLAS is not found
This commit makes sure that the tests of PyMVA that require BLAS (indirectly via SOFIE) are not run when BLAS is not available. Following up on this PR, which did the same change already for the SOFIE tests: #18065 (cherry picked from commit 20d3e3b)
1 parent 4697411 commit fc28ca6

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,13 @@ if(tmva)
16321632
message(STATUS "TMVA: Numpy or Python development package not found for python ${Python3_EXECUTABLE}. Switching off tmva-pymva option")
16331633
set(tmva-pymva OFF CACHE BOOL "Disabled because Numpy or Python development package were not found (${tmva-pymva_description})" FORCE)
16341634
endif()
1635+
if(testing)
1636+
message(STATUS "Looking for BLAS as an optional testing dependency of PyMVA")
1637+
find_package(BLAS)
1638+
if(NOT BLAS_FOUND)
1639+
message(WARNING "BLAS not found: PyMVA will not be fully tested")
1640+
endif()
1641+
endif()
16351642
endif()
16361643
if (R_FOUND)
16371644
#Rmva is enable when r is found and tmva is on

tmva/pymva/test/CMakeLists.txt

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,19 @@ if(PY_TORCH_FOUND)
8383

8484
# Test RModelParser_PyTorch
8585

86-
ROOT_ADD_GTEST(TestRModelParserPyTorch TestRModelParserPyTorch.C
87-
LIBRARIES
88-
ROOTTMVASofie
89-
TMVA
90-
Python3::NumPy
91-
Python3::Python
92-
INCLUDE_DIRS
93-
SYSTEM
94-
${CMAKE_CURRENT_BINARY_DIR}
95-
)
96-
target_link_libraries(TestRModelParserPyTorch ${BLAS_LINKER_FLAGS} ${BLAS_LIBRARIES})
86+
if(BLAS_FOUND)
87+
ROOT_ADD_GTEST(TestRModelParserPyTorch TestRModelParserPyTorch.C
88+
LIBRARIES
89+
ROOTTMVASofie
90+
TMVA
91+
Python3::NumPy
92+
Python3::Python
93+
BLAS::BLAS
94+
INCLUDE_DIRS
95+
SYSTEM
96+
${CMAKE_CURRENT_BINARY_DIR}
97+
)
98+
endif()
9799

98100
endif(PY_TORCH_FOUND)
99101

@@ -127,16 +129,18 @@ if((PY_KERAS_FOUND AND PY_THEANO_FOUND) OR (PY_KERAS_FOUND AND PY_TENSORFLOW_FOU
127129
LIBRARIES ${Libraries})
128130
ROOT_ADD_TEST(PyMVA-Keras-Multiclass COMMAND testPyKerasMulticlass DEPENDS ${PyMVA-Keras-Multiclass-depends})
129131

130-
ROOT_ADD_GTEST(TestRModelParserKeras TestRModelParserKeras.C
131-
LIBRARIES
132-
ROOTTMVASofie
133-
PyMVA
134-
Python3::NumPy
135-
Python3::Python
136-
INCLUDE_DIRS
137-
SYSTEM
138-
${CMAKE_CURRENT_BINARY_DIR}
139-
)
140-
target_link_libraries(TestRModelParserKeras ${BLAS_LINKER_FLAGS} ${BLAS_LIBRARIES})
132+
if(BLAS_FOUND)
133+
ROOT_ADD_GTEST(TestRModelParserKeras TestRModelParserKeras.C
134+
LIBRARIES
135+
ROOTTMVASofie
136+
PyMVA
137+
Python3::NumPy
138+
Python3::Python
139+
BLAS::BLAS
140+
INCLUDE_DIRS
141+
SYSTEM
142+
${CMAKE_CURRENT_BINARY_DIR}
143+
)
144+
endif()
141145

142146
endif((PY_KERAS_FOUND AND PY_THEANO_FOUND) OR (PY_KERAS_FOUND AND PY_TENSORFLOW_FOUND))

0 commit comments

Comments
 (0)