getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Yves Renard
Subject: [Getfem-commits] (no subject)
Date: Sat, 18 Apr 2020 08:52:27 -0400 (EDT)

branch: devel-yves-octave
commit 11f307fc065383cb2ad5fa935b1c55d58656e97d
Author: Yves Renard <address@hidden>
AuthorDate: Fri Apr 17 13:46:33 2020 +0200

    Octave detection
---
 configure.ac                                   | 57 +++++++++++++++++++++++++-
 doc/sphinx/source/.templates/indexcontent.html |  2 +-
 doc/sphinx/source/install/install_linux.rst    | 22 +++++++++-
 doc/sphinx/source/matlab/install.rst           |  4 +-
 doc/sphinx/source/matlab/intro.rst             |  2 +-
 doc/sphinx/source/replaces.txt                 |  1 +
 interface/src/octave/Makefile.am               | 36 +++++++---------
 7 files changed, 95 insertions(+), 29 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0880d90..6d1ad85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -815,7 +815,7 @@ if test "$usematlab" != NO; then
     AC_CHECK_PROGS(MEX, mex.bat)
     if test x"$MEX" = x""; then
       if test x$usematlab = xYES; then
-        AC_MSG_ERROR([Impossible to build the matlab interface without mex -- 
specify its full path with the MEX=/path/to/mex option, or use 
--enable-matlab-interface=no])
+        AC_MSG_ERROR([Impossible to build the matlab interface without mex -- 
specify its full path with the MEX=/path/to/mex option, or use 
--enable-matlab=no])
         exit 1
       fi
     else
@@ -952,6 +952,60 @@ AC_SUBST(STDCPP_STATICLIBS)
 
 
 
+
+
+
+dnl -----------------------------------------------
+dnl Octave Interface
+dnl -----------------------------------------------
+
+# list of pseudo functions
+# PSEUDO_FUNCTIONS_LOC=`$srcdir/bin/extract_doc $srcdir/interface/src 
pseudo_loc`
+# echo $PSEUDO_FUNCTIONS_LOC
+# PSEUDO_FUNCTIONS=`$srcdir/bin/extract_doc $srcdir/interface/src pseudo_gen`
+# MATLAB_OBJ_DIRS=`$srcdir/bin/extract_doc $srcdir/interface/src mobj_dirs`
+# AC_SUBST(PSEUDO_FUNCTIONS)
+# AC_SUBST(PSEUDO_FUNCTIONS_LOC)
+# AC_SUBST(MATLAB_OBJ_DIRS)
+
+AC_ARG_ENABLE(octave,
+ [AS_HELP_STRING([--enable-octave],[turn on/off octave support])],
+ [case "${enableval}" in
+   yes) useoctave=YES ;;
+   no)  useoctave=NO ;;
+   *) AC_MSG_ERROR([bad value ${enableval} for --enable-octave]) ;;
+ esac],[useoctave=NO])
+
+AC_ARG_WITH(octave-toolbox-dir,
+            [AS_HELP_STRING([--with-octave-toolbox-dir],[directory in which 
the octave interface will be installed])],
+            
OCTAVETOOLBOXDIR="$withval",OCTAVETOOLBOXDIR="$GFPREFIX/getfem_octavetoolbox")
+AC_SUBST(OCTAVETOOLBOXDIR)
+
+if test "$useoctave" != NO; then
+  AC_CHECK_PROGS(MKOCTFILE, mkoctfile)
+  if test x"$MKOCTFILE" = x""; then
+    if test x$useoctave = xYES; then
+      AC_MSG_ERROR([Impossible to build the octave interface without mkoctfile 
-- specify its full path with the MKOCTFILE=/path/to/mkoctfile option, or use 
--enable-octave=no])
+        exit 1
+    fi
+  else
+     # MATLAB_ROOT=`$MEX -v 2>&1 | grep "MATLAB  " | awk '{print $4}'|sed -e 
'2,$d'`
+     MKOCTFILE_EXE=`which $MKOCTFILE`
+     MKOCTFILE_EXE=`readlink -e $MKOCTFILE_EXE`
+     OCTAVE_ROOT=`echo $MKOCTFILE_EXE | sed -e 's/bin.*$//'`
+     OCTAVE_COM_EXT=".oct"
+     OCTAVE_RELEASE=`octave --version | grep "GNU Octave" | sed -n '1p' | sed 
's/^.*version //g'`
+     echo "Octave release is $OCTAVE_RELEASE"
+  fi
+fi
+AM_CONDITIONAL(BUILDOCTAVE, test x$useoctave = xYES)
+
+AC_SUBST(OCTAVE_RELEASE)
+AC_SUBST(OCTAVE_COM_EXT)
+AC_SUBST(MKOCTFILE)
+
+AM_CONDITIONAL(USE_MINGW_OCTAVE, test x"$OCTAVE_COM_EXT" = x".dll")
+
 dnl ----------------------------------------------
 dnl python 
 dnl ----------------------------------------------
@@ -1179,6 +1233,7 @@ echo -e "\n\n"
 echo "-----------------------------------------------------------------------"
 echo "Ready to build getfem"
 echo "  building MATLAB interface: $usematlab"
+echo "  building OCTAVE interface: $useoctave"
 echo "  building PYTHON interface: $usepython (requires numpy, scipy and also 
mpi4py for the parallel version)"
 echo "  building SCILAB interface: $usescilab"
 echo "  If you want to build the shared library of GetFEM, use --enable-shared"
diff --git a/doc/sphinx/source/.templates/indexcontent.html 
b/doc/sphinx/source/.templates/indexcontent.html
index f68dc25..74d5939 100644
--- a/doc/sphinx/source/.templates/indexcontent.html
+++ b/doc/sphinx/source/.templates/indexcontent.html
@@ -42,7 +42,7 @@
          <a class="biglink" href="{{ pathto("python/index") }}">Python 
Interface</a><br/>
          <span class="linkdescr">documentation for Python 
programmers</span></p>
       <p class="biglink">
-       <a class="biglink" href="{{ pathto("matlab/index") }}">Matlab 
Interface</a><br/>
+       <a class="biglink" href="{{ pathto("matlab/index") }}">Octave/Matlab 
Interface</a><br/>
          <span class="linkdescr">documentation for Matlab 
programmers</span></p>
       <p class="biglink">
          <a class="biglink" href="{{ pathto("scilab/index") }}">SciLab 
Interface</a><br/>
diff --git a/doc/sphinx/source/install/install_linux.rst 
b/doc/sphinx/source/install/install_linux.rst
index 8f14168..a36e2cc 100644
--- a/doc/sphinx/source/install/install_linux.rst
+++ b/doc/sphinx/source/install/install_linux.rst
@@ -121,7 +121,7 @@ Scilab interface
 ^^^^^^^^^^^^^^^^
 
 The installation of the |sci| |gf| toolbox can be somewhat tricky, since it 
combines a C++ compiler, libraries and |sci| interaction. In case of troubles 
with a
-non-GNU compiler, gcc/g++ (>= 4.8) should be a safe solution.
+non-GNU compiler, gcc/g++ (>= 8.0) should be a safe solution.
 
 
 .. caution::
@@ -162,13 +162,31 @@ Once getfem is compiled:
     ``cd demos;``
     ``exec demo_static_contact.sce;``
 
+Octave interface
+^^^^^^^^^^^^^^^^
+
+You have first to install |octv| with the developpement package
+
+.. caution::
+
+   * You have first to install |octv|, minimal release 4.1.1 with the 
developpement package such
+     that the command ``mkoct-file`` is available (liboctave-dev package on 
Debian, for instance)
+
+   * you should have built the |gf| static library (i.e. do not use 
``./configure
+     --disable-static`` when building |gf|). On linux/x86_64 platforms, a
+     mandatory option when building |gf| and |gfi| toolbox (and any static 
library linked
+     to them) is the ``--with-pic`` option of their ``./configure`` script.
+
+   * you should have use the ``--enable-octave`` option to configure the |gf| 
sources (i.e. ``./configure --enable-octave`` ...)
+
+   
 
 Matlab interface
 ^^^^^^^^^^^^^^^^
 
 The installation of the |gfi| toolbox can be somewhat tricky, since it 
combines a
 C++ compiler, libraries and |Mlab| interaction... In case of troubles with a
-non-GNU compiler, gcc/g++ (>= 4.8) should be a safe solution.
+non-GNU compiler, gcc/g++ (>= 8.0) should be a safe solution.
 
 
 .. caution::
diff --git a/doc/sphinx/source/matlab/install.rst 
b/doc/sphinx/source/matlab/install.rst
index da2d90c..9c2b0f9 100644
--- a/doc/sphinx/source/matlab/install.rst
+++ b/doc/sphinx/source/matlab/install.rst
@@ -10,8 +10,8 @@ Installation
 ============
 
 The installation of the |gfi| toolbox can be somewhat tricky, since it 
combines a
-C++ compiler, libraries and |Mlab| interaction... In case of troubles with a
-non-GNU compiler, gcc/g++ (>= 4.8) should be a safe solution.
+C++ compiler, libraries and |octv| or |mlab| interaction... In case of 
troubles with a
+non-GNU compiler, gcc/g++ (>= 8.0) should be a safe solution.
 
 See the `download and install <../download.html>`_ page for the installation 
of |gf| on different plateforms.
 
diff --git a/doc/sphinx/source/matlab/intro.rst 
b/doc/sphinx/source/matlab/intro.rst
index c46cc80..4e647a2 100644
--- a/doc/sphinx/source/matlab/intro.rst
+++ b/doc/sphinx/source/matlab/intro.rst
@@ -9,7 +9,7 @@
 Introduction
 ============
 
-This guide provides a reference about the |Mlab| interface of |gf|.
+This guide provides a reference about the |octv|/|Mlab| interface of |gf|.
 For a complete  reference of |gf|, please report to the `specific guides`_,
 but you should be able to use the |gfi|'s without any particular knowledge
 of the |gf| internals, although a basic knowledge about Finite Elements
diff --git a/doc/sphinx/source/replaces.txt b/doc/sphinx/source/replaces.txt
index 1244814..8325d86 100644
--- a/doc/sphinx/source/replaces.txt
+++ b/doc/sphinx/source/replaces.txt
@@ -11,6 +11,7 @@
 .. |py| replace:: *Python*
 .. |sci| replace:: *SciLab*
 .. |mlab| replace:: *MatLab*
+.. |octv| replace:: *Octave*
 .. |gf| replace:: *GetFEM*
 .. |gfm| replace:: *GetFEM*
 .. |gmm| replace:: *Gmm++*
diff --git a/interface/src/octave/Makefile.am b/interface/src/octave/Makefile.am
index 99771cd..c44c0f8 100644
--- a/interface/src/octave/Makefile.am
+++ b/interface/src/octave/Makefile.am
@@ -32,7 +32,7 @@ gf_mesh.m : ../libgetfemint.la $(top_srcdir)/bin/extract_doc
 
 EXTRA_DIST = gfm_rpc_mexint.c gfm_mex.c gfm_common.c gfm_common.h $(M_FILES)
 
-all: gf_mesh.m gf_matlab@MATLAB_COM_EXT@
+all: gf_mesh.m gf_octave@OCTAVE_COM_EXT@
 
 MEX=@MEX@
 RPC_LIB = @RPC_LIB@
@@ -42,42 +42,34 @@ GNUMEXOPTS=@top_srcdir@/gnumex.opts
 GETFEM_LIB_LA = ../../../src/libgetfem.la
 GETFEM_STATIC_LIB = ../../../src/.libs/libgetfem.a @LIBS@
 
-if BUILDMEX
-if USE_MINGW_MEX
+if BUILDOCTAVE
+if USE_MINGW_OCTAVE
 
 #command extremely sensitive to any modification! fragile! keep the order of 
the files
 # (gfm_mex.c must be first, libstdc++.a must be last)
 
-gf_matlab@MATLAB_COM_EXT@: gfm_mex.c gfm_common.c ../libgetfemint.la 
../gfi_array.c $(GETFEM_LIB_LA)
-       matlab -nodesktop -nosplash -nojvm -r "mex -v -output gf_matlab -g 
./gfm_mex.c ./gfm_common.c -largeArrayDims -I. -I.. ./../gfi_array.c 
../.libs/libgetfemint.a ../../../src/.libs/libgetfem.a 
../../../superlu/.libs/libsuperlu.a /msys/local/lib/libsmumps.a 
/msys/local/lib/libcmumps.a /msys/local/lib/libdmumps.a 
/msys/local/lib/libzmumps.a /msys/local/lib/libmumps_common.a 
/msys/local/lib/libmpiseq.a /msys/local/lib/libpord.a 
/msys/local/lib/liblapack.a /msys/local/lib/libblas.a /msys/loca [...]
+gf_octave@OCTAVE_COM_EXT@: gfm_mex.c gfm_common.c ../libgetfemint.la 
../gfi_array.c $(GETFEM_LIB_LA)
+       octave -nodesktop -nosplash -nojvm -r "mex -v -output gf_octave -g 
./gfm_mex.c ./gfm_common.c -largeArrayDims -I. -I.. ./../gfi_array.c 
../.libs/libgetfemint.a ../../../src/.libs/libgetfem.a 
../../../superlu/.libs/libsuperlu.a /msys/local/lib/libsmumps.a 
/msys/local/lib/libcmumps.a /msys/local/lib/libdmumps.a 
/msys/local/lib/libzmumps.a /msys/local/lib/libmumps_common.a 
/msys/local/lib/libmpiseq.a /msys/local/lib/libpord.a 
/msys/local/lib/liblapack.a /msys/local/lib/libblas.a /msys/loca [...]
 
 
-#      $(GNUMEX) $(GNUMEXOPTS) -output gf_matlab -g @srcdir@/gfm_mex.c \
+#      $(GNUMEX) $(GNUMEXOPTS) -output gf_octave -g @srcdir@/gfm_mex.c \
 #      @srcdir@/gfm_common.c -I@srcdir@ \
 #      @srcdir@/../gfi_array.c ../.libs/libgetfemint.a $(GETFEM_STATIC_LIB) 
@STDCPP_STATICLIBS@
 
 
 #        /c/MinGW/lib/libstdc++.a
 #      cmd /c "$mexbat -v -f c:/gnumex/mexopts.bat gfm_mex.c -output 
gfm_rpc_mexint gfi*.o gf_*.o matlabint*.o 
c:\\msys\\1.0\\home\\j\\getfem++-1.5\\src\\.libs\\libgetfem.a getfem_matlab.o 
c:\\mingw\\lib\\libstdc++.a -Ic:\\msys\\1.0\\home\\j\\mingw_liboncrpc-4.0"
-else !USE_MINGW_MEX
-if BUILDMEXRPC
-gf_matlab@MATLAB_COM_EXT@: ../gfi_rpc_clnt.c gfm_rpc_mexint.c gfm_common.c 
../gfi_rpc_xdr.c ../gfi_array.c
-       $(MEX) -largeArrayDims -output gf_matlab -g CDEBUGFLAGS="$(CFLAGS)" 
$(RPC_LIB) \
-       -I@srcdir@ -I@srcdir@/.. -DMATLAB_RELEASE=@MATLAB_RELEASE@ -DUSE_RPC \
-       @srcdir@/gfm_rpc_mexint.c @srcdir@/gfm_common.c 
@srcdir@/../gfi_rpc_clnt.c \
-        @srcdir@/../gfi_rpc_xdr.c @srcdir@/../gfi_array.c || (rm $@; false)
-else !BUILDMEXRPC
+else !USE_MINGW_OCTAVE
 # 2006/02/06 I remove the @STDCPP_STATICLIBS@ at the end (added to
 # avoid crashes in exception throw code when parts of getfem where
 # compiled with ifc (i.e. mumps)) of the command line, as it 
 # break the linking with g++-3.3 and matlab R14/R13 on debian (at least) ..
-gf_matlab@MATLAB_COM_EXT@: gfm_mex.c gfm_common.c ../libgetfemint.la 
../gfi_array.c $(GETFEM_LIB_LA)
-       $(MEX) -largeArrayDims -output gf_matlab -g CDEBUGFLAGS="$(CFLAGS)" 
LD="$(CXX)" \
-       -I@srcdir@ -I@srcdir@/.. -DMATLAB_RELEASE=@MATLAB_RELEASE@ \
+gf_octave@OCTAVE_COM_EXT@: gfm_mex.c gfm_common.c ../libgetfemint.la 
../gfi_array.c $(GETFEM_LIB_LA)
+       mkoctfile -largeArrayDims -output gf_octave -g CDEBUGFLAGS="$(CFLAGS)" 
LD="$(CXX)" \
+       -I@srcdir@ -I@srcdir@/.. -DOCTAVE_RELEASE=@OCTAVE_RELEASE@ \
        @srcdir@/gfm_mex.c @srcdir@/gfm_common.c @srcdir@/../gfi_array.c \
        ../.libs/libgetfemint.a $(GETFEM_STATIC_LIB) @STDCPP_STATICLIBS@ || (rm 
$@; false)
-endif !BUILDMEXRPC
-endif !USE_MINGW_MEX
+endif !USE_MINGW_OCTAVE
 endif 
 
 # -largeArrayDims
@@ -102,9 +94,9 @@ clean-m-files:
        rm -fr \@gf* 
 
 clean-local: clean-m-files
-       rm -f gf_matlab@MATLAB_COM_EXT@
+       rm -f gf_octave@OCTAVE_COM_EXT@
 
-toolboxdir=@TOOLBOXDIR@
+toolboxdir=@OCTAVETOOLBOXDIR@
 
 install:
        $(mkinstalldirs) $(toolboxdir)/private
@@ -115,7 +107,7 @@ install:
          $(mkinstalldirs) $(toolboxdir)/$$p; \
          @INSTALL@ -m 644 -t $(toolboxdir)/$$p $$p/*.m; \
        done
-       @INSTALL@ -m 744 -t $(toolboxdir)/ gf_matlab@MATLAB_COM_EXT@
+       @INSTALL@ -m 744 -t $(toolboxdir)/ gf_octave@OCTAVE_COM_EXT@
 
 uninstall:
        rm -fr $(toolboxdir)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]