From 35eef81c62efffc95ec0a979107558ab80f64082 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 22 May 2008 11:53:36 +0000 Subject: [PATCH] Implement --with[out]-gui configure and build_configure options. --- adm_local/unix/make_commence.in | 30 +++-- build_configure | 40 +++++-- configure.in.base | 106 ++++++++++-------- .../GHS3DPRLPlugin_Hypothesis.cxx | 72 ++++++++---- src/GHS3DPRLPlugin/Makefile.in | 5 +- src/Makefile.in | 6 +- 6 files changed, 174 insertions(+), 85 deletions(-) diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 6d07a77..ca2027b 100755 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -271,20 +271,32 @@ ac_cxx_partial_specialization.m4 python.m4 \ ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \ ac_cc_warnings.m4 check_swig.m4 check_boost.m4 -ACLOCAL_GUI = \ -check_vtk.m4 check_opengl.m4 check_qt.m4 \ -check_GUI.m4 check_corba_in_GUI.m4 - ACLOCAL_GEOM = check_GEOM.m4 ACLOCAL_SMESH = check_SMESH.m4 +ifeq ($(GHS3DPRLPLUGIN_WITH_GUI),yes) +ACLOCAL_GUI = \ +check_vtk.m4 check_opengl.m4 check_qt.m4 \ +check_GUI.m4 check_corba_in_GUI.m4 + $(top_srcdir)/aclocal.m4: $(ACLOCAL_KERNEL%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ $(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%) \ $(ACLOCAL_GEOM:%=@GEOM_ROOT_DIR@/adm_local/unix/config_files/%) \ $(ACLOCAL_SMESH:%=@SMESH_ROOT_DIR@/adm_local/unix/config_files/%) - cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ - -I @GUI_ROOT_DIR@/adm_local/unix/config_files \ - -I @GEOM_ROOT_DIR@/adm_local/unix/config_files \ - -I @SMESH_ROOT_DIR@/adm_local/unix/config_files - + cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files \ + -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ + -I @GUI_ROOT_DIR@/adm_local/unix/config_files \ + -I @GEOM_ROOT_DIR@/adm_local/unix/config_files \ + -I @SMESH_ROOT_DIR@/adm_local/unix/config_files +endif + +ifeq ($(GHS3DPRLPLUGIN_WITH_GUI),no) +$(top_srcdir)/aclocal.m4: $(ACLOCAL_KERNEL%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ + $(ACLOCAL_GEOM:%=@GEOM_ROOT_DIR@/adm_local/unix/config_files/%) \ + $(ACLOCAL_SMESH:%=@SMESH_ROOT_DIR@/adm_local/unix/config_files/%) + cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files \ + -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ + -I @GEOM_ROOT_DIR@/adm_local/unix/config_files \ + -I @SMESH_ROOT_DIR@/adm_local/unix/config_files +endif diff --git a/build_configure b/build_configure index d3790d2..4b85890 100755 --- a/build_configure +++ b/build_configure @@ -10,6 +10,7 @@ ORIG_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` +GHS3DPRLPLUGIN_WITH_GUI="yes" ######################################################################## # Test if the KERNEL_ROOT_DIR is set correctly @@ -25,12 +26,27 @@ fi # echo "failed : KERNEL_SRC variable is not correct !" # exit #fi + +for option +do + case $option in + -with-gui | --with-gui) + GHS3DPRLPLUGIN_WITH_GUI="yes" + break;; + -without-gui | --without-gui | -with-gui=no | --with-gui=no) + GHS3DPRLPLUGIN_WITH_GUI="no" + break;; + esac +done + ######################################################################## # Test if the GUI_ROOT_DIR is set correctly -if test ! -d "${GUI_ROOT_DIR}"; then +if test ${GHS3DPRLPLUGIN_WITH_GUI} = yes; then + if test ! -d "${GUI_ROOT_DIR}"; then echo "failed : GUI_ROOT_DIR variable is not correct !" exit + fi fi ######################################################################## @@ -243,12 +259,22 @@ else echo -n "Creating 'configure' script ... " fi -aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ - -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \ - -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ - -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ - -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ - -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files +if test ${GHS3DPRLPLUGIN_WITH_GUI} = yes; then + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ + -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files +else + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ + -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files +fi if autoconf then diff --git a/configure.in.base b/configure.in.base index 018a311..8f76d53 100755 --- a/configure.in.base +++ b/configure.in.base @@ -201,37 +201,68 @@ AC_SUBST_FILE(CORBA) corba=make_$ORB CORBA=adm_local/unix/$corba -echo -echo --------------------------------------------- -echo testing openGL -echo --------------------------------------------- -echo +dnl +dnl --------------------------------------------- +dnl testing WITHGUI +dnl --------------------------------------------- +dnl -CHECK_OPENGL +CHECK_WITHGUI -echo -echo --------------------------------------------- -echo testing QT -echo --------------------------------------------- -echo +if test "X$WITHGUI" = "Xyes"; then -CHECK_QT + echo + echo --------------------------------------------- + echo testing openGL + echo --------------------------------------------- + echo -echo -echo --------------------------------------------- -echo testing MSG2QM -echo --------------------------------------------- -echo + CHECK_OPENGL -CHECK_MSG2QM + echo + echo --------------------------------------------- + echo testing QT + echo --------------------------------------------- + echo -echo -echo --------------------------------------------- -echo testing VTK -echo --------------------------------------------- -echo + CHECK_QT + + echo + echo --------------------------------------------- + echo testing MSG2QM + echo --------------------------------------------- + echo + + CHECK_MSG2QM + + echo + echo --------------------------------------------- + echo testing VTK + echo --------------------------------------------- + echo -CHECK_VTK + CHECK_VTK + + echo + echo --------------------------------------------- + echo Testing GUI + echo --------------------------------------------- + echo + + CHECK_SALOME_GUI + + echo + echo --------------------------------------------- + echo Testing full GUI + echo --------------------------------------------- + echo + + CHECK_CORBA_IN_GUI + if test "x${CORBA_IN_GUI}" != "xyes"; then + echo "failed : For configure GHS3DPRLPLUGIN module necessary full GUI !" + exit + fi +fi echo echo --------------------------------------------- @@ -265,26 +296,6 @@ echo CHECK_HTML_GENERATORS -echo -echo --------------------------------------------- -echo Testing GUI -echo --------------------------------------------- -echo - -CHECK_SALOME_GUI - -echo -echo --------------------------------------------- -echo Testing full GUI -echo --------------------------------------------- -echo - -CHECK_CORBA_IN_GUI -if test "x${CORBA_IN_GUI}" != "xyes"; then - echo "failed : For configure GHS3DPRLPLUGIN module necessary full GUI !" - exit -fi - echo echo --------------------------------------------- echo Testing Kernel @@ -332,7 +343,14 @@ echo --------------------------------------------- echo echo Configure + +if test "X$WITHGUI" = "Xyes"; then variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok SMesh_ok GHS3DPRL_ok" +fi + +if test "X$WITHGUI" = "Xno"; then +variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok SMesh_ok GHS3DPRL_ok" +fi for var in $variables do diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx index e51f20e..037faa7 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx @@ -28,7 +28,6 @@ using namespace std; #include #include -#include //============================================================================= /*! @@ -52,16 +51,46 @@ GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId, * */ //============================================================================= +static string cutOrReplaceBlancs(string theIn) +{ + // cut all blancs at the beginning and at the end of the string, + // replace each blancs sequence of maximum length inside the string by one '_' symbol, + // as blancs consider: 9 (TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR) and 32 (Space) + int len = theIn.length(); + int lastgood = 0; + const char* str1 = theIn.c_str(); + char* str2 = new char [len + 1]; + bool del = true; + + for (int i = 0, j = 0; i < len; i++) + { + ushort ucs = (ushort)(str1[i]); + if ((9 <= ucs && ucs <= 13) || ucs == 32) + { + if (!del) + { + str2[j++] = '_'; + del = true; + } + } + else + { + str2[j++] = str1[i]; + lastgood = j; + del = false; + } + } + str2[lastgood] = '\0'; + string anOut = str2; + return anOut; +} void GHS3DPRLPlugin_Hypothesis::SetMEDName(string theVal) { //without whitespaces! ..from python? - QString tmp1,tmp2; - tmp1 = (QString) theVal; - tmp1.simplifyWhiteSpace(); //for qt3 - tmp1.replace(QChar(' '),QChar('_')); - tmp2 = (QString) _MEDName; + string tmp1 = cutOrReplaceBlancs(theVal); + string tmp2 = _MEDName; if (tmp1 != tmp2) { - _MEDName = (const char *) tmp1; + _MEDName = tmp1.c_str(); NotifySubMeshesHypothesisModification(); } } @@ -108,10 +137,8 @@ istream & GHS3DPRLPlugin_Hypothesis::LoadFrom(istream & load) { //explicit inputs for future code compatibility of saved .hdf bool isOK = true; - int imax; - string str1; - QString str2,str3,str4,str5; - + string str1,str2,str3,str4; + //save without any whitespaces! isOK = (load >> str1); if (!(isOK)) { @@ -119,16 +146,19 @@ istream & GHS3DPRLPlugin_Hypothesis::LoadFrom(istream & load) load.clear(ios::badbit | load.rdstate()); return load; } - str2 = (QString) str1; - imax = str2.contains(";"); - for (int i=0; i<=imax; i++) { - str3 = str2.section(";",i,i); - str4 = str3.section("=",0,0); - str5 = str3.section("=",1,1); - - if (str4=="MEDName") _MEDName = str5.ascii(); - if (str4=="NbPart") _NbPart = str5.toInt(); - if (str4=="KeepFiles") _KeepFiles = (bool) str5.toInt(); + int pos = 0; + int len = str1.length(); + while (pos < len) { + int found = str1.find(';',pos); + str2 = str1.substr(pos,found-pos); + int eqpos = str2.find('=',0); + str3 = str2.substr(0,eqpos); + str4 = str2.substr(eqpos+1); + pos = found + 1; + + if (str3=="MEDName") _MEDName = str4.c_str(); + if (str3=="NbPart") _NbPart = atoi(str4.c_str()); + if (str3=="KeepFiles") _KeepFiles = (bool) atoi(str4.c_str()); } return load; } diff --git a/src/GHS3DPRLPlugin/Makefile.in b/src/GHS3DPRLPlugin/Makefile.in index 45fd4a7..f97f9db 100755 --- a/src/GHS3DPRLPlugin/Makefile.in +++ b/src/GHS3DPRLPlugin/Makefile.in @@ -51,11 +51,10 @@ LIB_CLIENT_IDL = \ # Libraries targets LIB = libGHS3DPRLEngine.la -CPPFLAGS+=$(QT_INCLUDES) -LDFLAGSFORBIN+=-lm $(QT_LIBS) +LDFLAGSFORBIN+=-lm $(BIN):$(OBJ) - $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(QT_LIBS) $< + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< @CONCLUDE@ diff --git a/src/Makefile.in b/src/Makefile.in index f954477..f8883c6 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -30,6 +30,10 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = GHS3DPRLPlugin gui tepal2med +SUBDIRS = GHS3DPRLPlugin + +ifeq (@WITHGUI@,yes) + SUBDIRS += gui tepal2med +endif @MODULE@ -- 2.39.2