]> SALOME platform Git repositories - tools/sat_salome.git/commitdiff
Salome HOME
bos #42837: ensure compilation if Lapack is embedded
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Mon, 16 Sep 2024 15:32:45 +0000 (17:32 +0200)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Mon, 16 Sep 2024 15:32:45 +0000 (17:32 +0200)
products/MEDCOUPLING.pyconf
products/env_scripts/lapack.py
products/patches/BOS-42837-MEDCOUPLING-ShapeRecognition.p01.patch [new file with mode: 0644]
products/patches/BOS-42837-MEDCOUPLING-ShapeRecognition.p02.patch [new file with mode: 0644]

index 2a4c9daba9edafca3795e31302bbb3976b12ed8d..853da054a8d12a33263ce43709b456e0bf576df9 100644 (file)
@@ -93,6 +93,9 @@ default_MPI :
               "openmpi"
               ]
     opt_depend : ["ParMetis", "metis", "BasicIterativeStatistics"]
+    patches: ['BOS-42837-MEDCOUPLING-ShapeRecognition.p01.patch', # DB12
+              'BOS-42837-MEDCOUPLING-ShapeRecognition.p02.patch'  # CO7
+             ]
 }
 
 default_MPI_STD:
index 26ecc76d3985306563055901cd63d90e8cedf794..355306c96449e313d03496783e0dcc2604cfe95d 100644 (file)
@@ -17,6 +17,10 @@ def set_env(env, prereq_dir, version):
     env.set('BLAS', os.path.join(prereq_dir, 'lib'))
     env.set('LAPACK', os.path.join(prereq_dir, 'lib'))
     env.set('ATLAS', os.path.join(prereq_dir, 'lib'))
+    env.set('LAPACKE_DIR', os.path.join(prereq_dir,'lib', 'cmake', 'lapacke-3.8.0'))
+    env.set('LAPACKE_INCDIR', os.path.join(prereq_dir,'include'))
+    env.set('LAPACKE_LIBDIR', os.path.join(prereq_dir,'lib'))
+    env.set('CBLAS_ROOT_DIR', os.path.join(prereq_dir,'lib', 'cmake', 'cblas-3.8.0'))
   else:
     env.prepend('PATH', os.path.join(prereq_dir, 'bin'))
 
diff --git a/products/patches/BOS-42837-MEDCOUPLING-ShapeRecognition.p01.patch b/products/patches/BOS-42837-MEDCOUPLING-ShapeRecognition.p01.patch
new file mode 100644 (file)
index 0000000..1200ba2
--- /dev/null
@@ -0,0 +1,12 @@
+diff --git a/src/ShapeRecogn/Nodes.hxx b/src/ShapeRecogn/Nodes.hxx
+index fbd44573..eefe8b41 100644
+--- a/src/ShapeRecogn/Nodes.hxx
++++ b/src/ShapeRecogn/Nodes.hxx
+@@ -22,6 +22,7 @@
+ #include <vector>
+ #include "MEDCouplingUMesh.hxx"
+ #include "PrimitiveType.hxx"
++#include <array>
+ namespace MEDCoupling
+ {
diff --git a/products/patches/BOS-42837-MEDCOUPLING-ShapeRecognition.p02.patch b/products/patches/BOS-42837-MEDCOUPLING-ShapeRecognition.p02.patch
new file mode 100644 (file)
index 0000000..d8f2a7d
--- /dev/null
@@ -0,0 +1,173 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cf1a05b..4898c8e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -203,7 +203,17 @@ IF(MEDCOUPLING_ENABLE_RENUMBER)
+ ENDIF(MEDCOUPLING_ENABLE_RENUMBER)
+ IF(MEDCOUPLING_ENABLE_SHAPERECOGN)
+-  FIND_PACKAGE(BLAS REQUIRED)
++  SET(CBLAS_ROOT_DIR $ENV{CBLAS_ROOT_DIR} CACHE PATH "Path to the LAPACK/CBLAS.")
++  IF(CBLAS_ROOT_DIR)
++    LIST(APPEND CMAKE_PREFIX_PATH "${CBLAS_ROOT_DIR}")
++  ENDIF(CBLAS_ROOT_DIR)
++  FIND_PACKAGE(CBLAS REQUIRED)
++  SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACKE")
++  IF(LAPACK_ROOT_DIR)
++    SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACK.")
++    LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
++  ENDIF(LAPACK_ROOT_DIR)
++
+   FIND_PACKAGE(LAPACK REQUIRED)
+   FIND_LIBRARY(LAPACKE_LIB NAMES lapacke REQUIRED)
+   SET(LAPACK_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+diff --git a/src/ShapeRecogn/Test/CMakeLists.txt b/src/ShapeRecogn/Test/CMakeLists.txt
+index a7df417..f73ebd6 100644
+--- a/src/ShapeRecogn/Test/CMakeLists.txt
++++ b/src/ShapeRecogn/Test/CMakeLists.txt
+@@ -47,7 +47,7 @@ SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+ IF(NOT MEDCOUPLING_MICROMED)
+   SET(TESTSHAPE_RECOGN0 TestShapeRecogn)
+   ADD_EXECUTABLE(${TESTSHAPE_RECOGN0} ${TestShapeRecogn_SOURCES})
+-  TARGET_LINK_LIBRARIES(${TESTSHAPE_RECOGN0} shaperecogn InterpKernelTestUtils medloader ${MEDFILE_C_LIBRARIES} ${HDF5_LIBRARIES} ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
++  TARGET_LINK_LIBRARIES(${TESTSHAPE_RECOGN0} shaperecogn InterpKernelTestUtils medloader ${MEDFILE_C_LIBRARIES} ${HDF5_LIBRARIES} ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS} ${CBLAS_LIBRARIES})
+   INSTALL(TARGETS ${TESTSHAPE_RECOGN0} DESTINATION ${MEDCOUPLING_INSTALL_BINS})
+   
+diff --git a/src/ShapeRecogn/Test/ConeTest.cxx b/src/ShapeRecogn/Test/ConeTest.cxx
+index 2da2193..25ead55 100644
+--- a/src/ShapeRecogn/Test/ConeTest.cxx
++++ b/src/ShapeRecogn/Test/ConeTest.cxx
+@@ -192,7 +192,7 @@ void ConeTest::testComputeConeProperties()
+ void ConeTest::testFirstArea()
+ {
+     // primitive type
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(0));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(0));
+     // node ids
+     std::vector<mcIdType> nodeIdsRef{
+         549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559,
+@@ -213,7 +213,7 @@ void ConeTest::testFirstArea()
+ void ConeTest::testSecondArea()
+ {
+     // primitive type
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(0));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(0));
+     // node ids
+     std::vector<mcIdType> nodeIdsRef = {
+         572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583,
+@@ -264,7 +264,7 @@ void ConeTest::testSecondArea()
+ void ConeTest::testThirdArea()
+ {
+     // primitive type
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Cone, areas->getPrimitiveType(2));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Cone, (int)areas->getPrimitiveType(2));
+     // node ids
+     std::vector<mcIdType> nodeIdsRef{
+         0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+diff --git a/src/ShapeRecogn/Test/CylinderTest.cxx b/src/ShapeRecogn/Test/CylinderTest.cxx
+index 2e08bdf..6b7fc7f 100644
+--- a/src/ShapeRecogn/Test/CylinderTest.cxx
++++ b/src/ShapeRecogn/Test/CylinderTest.cxx
+@@ -50,7 +50,7 @@ void CylinderTest::testNumberOfAreas()
+ void CylinderTest::testFirstArea()
+ {
+     // primitive type
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Cylinder, areas->getPrimitiveType(0));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Cylinder, (int) areas->getPrimitiveType(0));
+     // node ids
+     std::vector<mcIdType> nodeIdsRef{
+         0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+@@ -108,7 +108,7 @@ void CylinderTest::testFirstArea()
+ void CylinderTest::testSecondArea()
+ {
+     // primitive type
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(1));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(1));
+     // node ids
+     std::vector<mcIdType> nodeIdsRef{
+         370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
+@@ -134,7 +134,7 @@ void CylinderTest::testSecondArea()
+ void CylinderTest::testThirdArea()
+ {
+     // primitive type
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(2));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(2));
+     // node ids
+     std::vector<mcIdType> nodeIdsRef{
+         443, 444, 445, 446, 447, 448, 449, 450, 451, 452,
+diff --git a/src/ShapeRecogn/Test/MathOpsTest.cxx b/src/ShapeRecogn/Test/MathOpsTest.cxx
+index 6841fe0..82a27b9 100644
+--- a/src/ShapeRecogn/Test/MathOpsTest.cxx
++++ b/src/ShapeRecogn/Test/MathOpsTest.cxx
+@@ -19,7 +19,7 @@
+ #include "MathOpsTest.hxx"
+ #include "MathOps.hxx"
+-
++#include <cblas.h>
+ using namespace MEDCoupling;
+ void MathOpsTest::testLstsq()
+diff --git a/src/ShapeRecogn/Test/MathOpsTest.hxx b/src/ShapeRecogn/Test/MathOpsTest.hxx
+index 8cbc635..8b5b3fd 100644
+--- a/src/ShapeRecogn/Test/MathOpsTest.hxx
++++ b/src/ShapeRecogn/Test/MathOpsTest.hxx
+@@ -37,12 +37,12 @@ namespace MEDCoupling
+         CPPUNIT_TEST_SUITE_END();
+     public:
+-        static void testLstsq();
+-        static void testLstsq2();
+-        static void testLstsqBig();
+-        static void testComputeCov();
+-        static void testComputePCAFirstAxis();
+-        static void testComputeAngles();
+-        static void testComputeBaseFromNormal();
++        void testLstsq();
++        void testLstsq2();
++        void testLstsqBig();
++        void testComputeCov();
++        void testComputePCAFirstAxis();
++        void testComputeAngles();
++        void testComputeBaseFromNormal();
+     };
+ }
+diff --git a/src/ShapeRecogn/Test/SphereTest.cxx b/src/ShapeRecogn/Test/SphereTest.cxx
+index b219e1a..630f55c 100644
+--- a/src/ShapeRecogn/Test/SphereTest.cxx
++++ b/src/ShapeRecogn/Test/SphereTest.cxx
+@@ -47,7 +47,7 @@ void SphereTest::testArea()
+     CPPUNIT_ASSERT_EQUAL(1, (int)areas->getNumberOfAreas());
+     // 8 double nodes so 147 - 6 nodes
+     CPPUNIT_ASSERT_EQUAL(141, (int)areas->getNumberOfNodes(0));
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Sphere, areas->getPrimitiveType(0));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Sphere, (int)areas->getPrimitiveType(0));
+     CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, areas->getRadius(0), 1E-2);
+     std::array<double, 3> centerRef = {5.3, -6.7, -9.02};
+     std::array<double, 3> center = areas->getCenter(0);
+diff --git a/src/ShapeRecogn/Test/TestShapeRecogn.cxx b/src/ShapeRecogn/Test/TestShapeRecogn.cxx
+index 8d07cce..fb2e25e 100644
+--- a/src/ShapeRecogn/Test/TestShapeRecogn.cxx
++++ b/src/ShapeRecogn/Test/TestShapeRecogn.cxx
+@@ -17,6 +17,7 @@
+ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+ //
++#include "CppUnitTest.hxx"
+ #include "MathOpsTest.hxx"
+ #include "PlaneTest.hxx"
+ #include "CylinderTest.hxx"
+diff --git a/src/ShapeRecogn/Test/TorusTest.cxx b/src/ShapeRecogn/Test/TorusTest.cxx
+index fecb7b3..32ab1c2 100644
+--- a/src/ShapeRecogn/Test/TorusTest.cxx
++++ b/src/ShapeRecogn/Test/TorusTest.cxx
+@@ -46,7 +46,7 @@ void TorusTest::testArea()
+ {
+     CPPUNIT_ASSERT_EQUAL(275, (int)srMesh->getNodes()->getNbNodes());
+     CPPUNIT_ASSERT_EQUAL(1, (int)areas->getNumberOfAreas());
+-    CPPUNIT_ASSERT_EQUAL(PrimitiveType::Torus, areas->getPrimitiveType(0));
++    CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Torus, (int)areas->getPrimitiveType(0));
+     // Some nodes are unknown
+     CPPUNIT_ASSERT_EQUAL(272, (int)areas->getNumberOfNodes(0));
+     CPPUNIT_ASSERT_DOUBLES_EQUAL(0.843297, areas->getMinorRadius(0), 1E-2);