From 0b1785e9d1b16f2e1e9467b37b67298cefa8f56c Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Mon, 29 Nov 2021 20:43:50 +0100 Subject: [PATCH] YDEFX: integration --- applications/SALOME-9.8.0-MPI.pyconf | 1 + applications/SALOME-9.8.0-int32.pyconf | 1 + applications/SALOME-9.8.0-native.pyconf | 1 + applications/SALOME-9.8.0.pyconf | 1 + products/PY2CPP.pyconf | 2 +- products/YDEFX.pyconf | 36 +++++++++++++++++++++ products/compil_scripts/YDEFX.sh | 42 +++++++++++++++++++++++++ products/env_scripts/PY2CPP.py | 12 +++++++ products/env_scripts/Python.py | 2 ++ products/patches/YDEFX-CMakeLists.patch | 42 +++++++++++++++++++++++++ 10 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 products/YDEFX.pyconf create mode 100755 products/compil_scripts/YDEFX.sh create mode 100644 products/env_scripts/PY2CPP.py create mode 100644 products/patches/YDEFX-CMakeLists.patch diff --git a/applications/SALOME-9.8.0-MPI.pyconf b/applications/SALOME-9.8.0-MPI.pyconf index 7d04f74..f334fdb 100644 --- a/applications/SALOME-9.8.0-MPI.pyconf +++ b/applications/SALOME-9.8.0-MPI.pyconf @@ -162,6 +162,7 @@ APPLICATION : 'ADAO' : {tag: 'V9_8_0b1'} 'ADAO_INTERFACE': {tag: 'V9_8_0b1'} 'PARAVISADDONS' : {tag: 'V9_8_0b1'} + 'YDEFX' : {tag : 'V9_8_0b1'} 'TESTBASE': {tag: 'master'} 'CEATESTBASE' : {tag: 'SSL'} } diff --git a/applications/SALOME-9.8.0-int32.pyconf b/applications/SALOME-9.8.0-int32.pyconf index c4aafd3..252d86a 100644 --- a/applications/SALOME-9.8.0-int32.pyconf +++ b/applications/SALOME-9.8.0-int32.pyconf @@ -158,6 +158,7 @@ APPLICATION : 'ADAO' : {tag: 'V9_8_0b1'} 'ADAO_INTERFACE': {tag: 'V9_8_0b1'} 'PARAVISADDONS' : {tag: 'V9_8_0b1'} + 'YDEFX' : {tag : 'V9_8_0b1'} 'TESTBASE': {tag: 'master'} 'CEATESTBASE' : {tag: 'SalomeV9'} } diff --git a/applications/SALOME-9.8.0-native.pyconf b/applications/SALOME-9.8.0-native.pyconf index 015acd7..3f1bbca 100644 --- a/applications/SALOME-9.8.0-native.pyconf +++ b/applications/SALOME-9.8.0-native.pyconf @@ -162,6 +162,7 @@ APPLICATION : 'ADAO' : {tag: 'V9_8_0b1'} 'ADAO_INTERFACE': {tag: 'V9_8_0b1'} 'PARAVISADDONS' : {tag: 'V9_8_0b1'} + 'YDEFX' : {tag : 'V9_8_0b1'} 'TESTBASE': {tag: 'master'} 'CEATESTBASE' : {tag: 'SSL'} } diff --git a/applications/SALOME-9.8.0.pyconf b/applications/SALOME-9.8.0.pyconf index 94dd8ba..4771ae0 100644 --- a/applications/SALOME-9.8.0.pyconf +++ b/applications/SALOME-9.8.0.pyconf @@ -160,6 +160,7 @@ APPLICATION : 'ADAO' : {tag: 'V9_8_0b1'} 'ADAO_INTERFACE': {tag: 'V9_8_0b1'} 'PARAVISADDONS' : {tag: 'V9_8_0b1'} + 'YDEFX' : {tag : 'V9_8_0b1'} 'TESTBASE': {tag: 'master'} 'CEATESTBASE' : {tag: 'SSL'} } diff --git a/products/PY2CPP.pyconf b/products/PY2CPP.pyconf index e586468..2cf4e2d 100644 --- a/products/PY2CPP.pyconf +++ b/products/PY2CPP.pyconf @@ -11,7 +11,7 @@ default : } environ : { - PY2CPP_ROOT_DIR : $install_dir + env_script : $name + ".py" } depend : [ "CONFIGURATION", diff --git a/products/YDEFX.pyconf b/products/YDEFX.pyconf new file mode 100644 index 0000000..75971b2 --- /dev/null +++ b/products/YDEFX.pyconf @@ -0,0 +1,36 @@ +default : +{ + name : "YDEFX" + build_source : "cmake" + #build_source : "script" + compil_script : $name + $VARS.scriptExtension + get_source : "git" + git_info: + { + repo : $PROJECTS.projects.salome.git_info.default_git_server + "tools/ydefx.git" + repo_dev : $PROJECTS.projects.salome.git_info.default_git_server_dev + "ydefx.git" + } + environ : + { + } + depend : [ + "CONFIGURATION", + "Python", + "KERNEL", + "PY2CPP", + "YACS" + ] + opt_depend: [] + build_depend : ["cmake", "cppunit"] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + properties: + { + incremental : "yes" + is_SALOME_module : "yes" + + } + # prescription de EDF ne fonctionne pas en dehors de YAMS + # solution temporaire pour utiliser l'approche standard de SALOME + patches : ['YDEFX-CMakeLists.patch'] +} diff --git a/products/compil_scripts/YDEFX.sh b/products/compil_scripts/YDEFX.sh new file mode 100755 index 0000000..c856ce2 --- /dev/null +++ b/products/compil_scripts/YDEFX.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +echo "##########################################################################" +echo "YDEFX" $VERSION +echo "##########################################################################" + +CMAKE_OPTIONS="" +CMAKE_OPTIONS+=" -DCONFIGURATION_ROOT_DIR=${CONFIGURATION_ROOT_DIR}" +CMAKE_OPTIONS+=" -DKERNEL_ROOT_DIR=${KERNEL_ROOT_DIR}" +CMAKE_OPTIONS+=" -DCMAKE_PREFIX_PATH=\"$KERNEL_ROOT_DIR/salome_adm/cmake_files;$PY2CPP_ROOT_DIR/lib/cmake/py2cpp/;\" " +CMAKE_OPTIONS+=" -DPYTHON_EXECUTABLE=${PYTHONBIN}" +CMAKE_OPTIONS+=" -DPYTHON_ROOT_DIR=${PYTHON_ROOT_DIR}" +CMAKE_OPTIONS+=" -DPYTHON_INCLUDE_DIR=${PYTHON_ROOT_DIR}/include/python${PYTHON_VERSION}" +CMAKE_OPTIONS+=" -DPYTHON_LIBRARY=${PYTHON_ROOT_DIR}/lib/libpython${PYTHON_VERSION}.so" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX:STRING=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE:STRING=Release" + +echo +echo "*** cmake" ${CMAKE_OPTIONS} +cmake ${CMAKE_OPTIONS} $SOURCE_DIR +if [ $? -ne 0 ] +then + echo "ERROR on cmake" + exit 1 +fi + +MAKE_OPTIONS="VERBOSE=1 "$MAKE_OPTIONS +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ] +then + echo "ERROR on make" + exit 2 +fi + +make install +if [ $? -ne 0 ] +then + echo "ERROR on make install" + exit 3 +fi diff --git a/products/env_scripts/PY2CPP.py b/products/env_scripts/PY2CPP.py new file mode 100644 index 0000000..5b0b76c --- /dev/null +++ b/products/env_scripts/PY2CPP.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- +import os +import platform + +def set_env(env, product_dir, version): + env.set('PY2CPP_ROOT_DIR', product_dir) + env.set('Py2cpp_DIR', os.path.join(product_dir, 'lib', 'cmake', 'py2cpp')) + env.prepend('LD_LIBRARY_PATH', os.path.join(product_dir, 'lib')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/Python.py b/products/env_scripts/Python.py index cec24e3..7839096 100644 --- a/products/env_scripts/Python.py +++ b/products/env_scripts/Python.py @@ -8,6 +8,8 @@ def set_env(env,prereq_dir,version,forBuild=None): # [CMake KERNEL] Nouveau nom pour PYTHONHOME = PYTHON_ROOT_DIR 22/03/2013 env.set('PYTHON_ROOT_DIR', prereq_dir) + # EDF uses this environment variable + env.set('PYTHON_INSTALL_DIR', prereq_dir) # keep only the first two version numbers version = '.'.join(version.replace('-', '.').split('.')[:2]) diff --git a/products/patches/YDEFX-CMakeLists.patch b/products/patches/YDEFX-CMakeLists.patch new file mode 100644 index 0000000..b40afe0 --- /dev/null +++ b/products/patches/YDEFX-CMakeLists.patch @@ -0,0 +1,42 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8959cac..e5d03fc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,14 +23,33 @@ SET (CMAKE_CXX_STANDARD 11) + ENABLE_TESTING() + SET(BUILD_SHARED_LIBS TRUE) + ++SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files") ++IF(EXISTS ${CONFIGURATION_ROOT_DIR}) ++ LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake") ++ INCLUDE(SalomeMacros NO_POLICY_SCOPE) ++ELSE() ++ MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !") ++ENDIF() ++ ++SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL") ++IF(EXISTS ${KERNEL_ROOT_DIR}) ++ FIND_PACKAGE(SalomeKERNEL REQUIRED) ++ ADD_DEFINITIONS(${KERNEL_DEFINITIONS}) ++ INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS}) ++ELSE(EXISTS ${KERNEL_ROOT_DIR}) ++ MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR") ++ENDIF(EXISTS ${KERNEL_ROOT_DIR}) ++ ++# Platform setup ++# ============== ++INCLUDE(SalomeSetupPlatform) # From CONFIGURATION ++# Always build libraries as shared objects: ++SET(BUILD_SHARED_LIBS TRUE) ++ + OPTION(YDEFX_BUILD_GUI "Generate widgets" ON) + + FIND_PACKAGE(Py2cpp REQUIRED) + +-# SalomeKERNEL can be useful in order to define SALOME_INSTALL directories and +-# for using salome test, but it is not a c++ dependency. +-FIND_PACKAGE(SalomeKERNEL NO_MODULE) +- + IF(NOT SalomeKERNEL_FOUND) + MESSAGE("SalomeKERNEL not found. Salome installation paths will not be used") + ELSE() -- 2.39.2