From e50ddfc02fc352f50fed76409d74e3e02d8faca6 Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Mon, 30 Aug 2021 14:09:02 +0200 Subject: [PATCH] spns #24377 : compilation cminpack apply patch for cblas --- products/cminpack.pyconf | 29 +++++++++++++++++++++ products/env_scripts/cminpack.py | 10 +++++++ products/env_scripts/openturns.py | 2 +- products/patches/cminpack-1.3.6-cblas.patch | 28 ++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 products/cminpack.pyconf create mode 100644 products/env_scripts/cminpack.py create mode 100644 products/patches/cminpack-1.3.6-cblas.patch diff --git a/products/cminpack.pyconf b/products/cminpack.pyconf new file mode 100644 index 0000000..2fbca76 --- /dev/null +++ b/products/cminpack.pyconf @@ -0,0 +1,29 @@ +default : +{ + name : "cminpack" + build_source : "cmake" + cmake_options : " -DUSE_BLAS=ON -DUSE_FPIC=ON -DBUILD_SHARED_LIBS=ON" + compil_script : $name + $VARS.scriptExtension + get_source : "archive" + environ : + { + env_script : $name + ".py" + } + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'matplotlib'] + build_depend : ["cmake", "swig"] + opt_depend : ['openmpi'] + patches : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + single_install_dir : "no" + incremental : "yes" + } +} + +version_1_3_6 : +{ + patches : ['cminpack-1.3.6-cblas.patch'] +} \ No newline at end of file diff --git a/products/env_scripts/cminpack.py b/products/env_scripts/cminpack.py new file mode 100644 index 0000000..a27bbce --- /dev/null +++ b/products/env_scripts/cminpack.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os.path + +def set_env(env, prereq_dir, version): + env.set('CMINPACK_ROOT_DIR', prereq_dir) + env.prepend('PATH', os.path.join(prereq_dir,'bin')) + env.prepend('LD_LIBRARY_PATH',os.path.join(prereq_dir, 'lib')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/openturns.py b/products/env_scripts/openturns.py index 4870814..3527208 100644 --- a/products/env_scripts/openturns.py +++ b/products/env_scripts/openturns.py @@ -2,7 +2,7 @@ import os.path def set_env(env, prereq_dir, version): - env.set('OPENTURN_ROOT_DIR', prereq_dir) + env.set('OPENTURNS_ROOT_DIR', prereq_dir) env.prepend('PATH', os.path.join(prereq_dir,'bin')) env.prepend('LD_LIBRARY_PATH',os.path.join(prereq_dir, 'lib')) pyver = 'python' + env.get('PYTHON_VERSION') diff --git a/products/patches/cminpack-1.3.6-cblas.patch b/products/patches/cminpack-1.3.6-cblas.patch new file mode 100644 index 0000000..fcf0913 --- /dev/null +++ b/products/patches/cminpack-1.3.6-cblas.patch @@ -0,0 +1,28 @@ +diff -Naur cminpack-1.3.6_ref/CMakeLists.txt cminpack-1.3.6_dev/CMakeLists.txt +--- cminpack-1.3.6_ref/CMakeLists.txt 2017-02-24 16:09:31.000000000 +0100 ++++ cminpack-1.3.6_dev/CMakeLists.txt 2021-08-30 14:02:27.425683737 +0200 +@@ -69,12 +69,23 @@ + + # Link with a BLAS library if requested + if (USE_BLAS) ++ SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACK.") ++ IF(LAPACK_ROOT_DIR) ++ LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}") ++ ENDIF(LAPACK_ROOT_DIR) + if (NOT BUILD_SHARED_LIBS) + set(BLA_STATIC True) + endif() + find_package(BLAS) + if (BLAS_FOUND) +- target_link_libraries(cminpack PUBLIC ${BLAS_LIBRARIES}) ++ MESSAGE(STATUS "Searching for C-BLAS library...") ++ FIND_LIBRARY(CBLAS_LIBRARIES NAMES cblas ++ HINTS ${LAPACK_ROOT_DIR} ++ PATH_SUFFIXES lib ++ PATHS ${LAPACK_ROOT_DIR} ++ ) ++ ++ target_link_libraries(cminpack PUBLIC ${BLAS_LIBRARIES} ${CBLAS_LIBRARIES}) + set_target_properties(cminpack PROPERTIES LINK_FLAGS "${BLAS_LINKER_FLAGS}") + target_compile_definitions(cminpack PUBLIC -DUSE_CBLAS) + endif() -- 2.39.2