summaryrefslogtreecommitdiffstats
path: root/build/linux
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2016-11-18 09:06:40 -0800
committerGitHub <noreply@github.com>2016-11-18 09:06:40 -0800
commit7f284de17492cba08848821387c8c49e7348f02c (patch)
tree323747764903567f0de3b484bc202059637d5ac9 /build/linux
parent6c9756b1d26d1e920b12cdcf8580362690427ddc (diff)
parent64a48bea80b909311351dc3b1345a17c693ddb69 (diff)
downloadastra-7f284de17492cba08848821387c8c49e7348f02c.tar.gz
astra-7f284de17492cba08848821387c8c49e7348f02c.tar.bz2
astra-7f284de17492cba08848821387c8c49e7348f02c.tar.xz
astra-7f284de17492cba08848821387c8c49e7348f02c.zip
Merge pull request #73 from wjp/octave
Add experimental support for Octave
Diffstat (limited to 'build/linux')
-rw-r--r--build/linux/Makefile.in51
-rw-r--r--build/linux/configure.ac23
2 files changed, 73 insertions, 1 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index 14027e1..076cfd1 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -5,6 +5,7 @@ boostutf=@HAVEBOOSTUTF@
MATLAB_ROOT=@MATLAB_ROOT@
+octave=@HAVEOCTAVE@
TARGETS=libastra.la
@@ -16,6 +17,10 @@ ifeq ($(python),yes)
TARGETS+=py
endif
+ifeq ($(octave),yes)
+TARGETS+=oct
+endif
+
all: $(TARGETS)
prefix=@prefix@
@@ -46,6 +51,16 @@ LIBS += -lcudart -lcufft
NVCC = @NVCC@
endif
+ifeq ($(octave),yes)
+OCTLDFLAGS:=$(LDFLAGS)
+CPPFLAGS += @OCTAVE_CPPFLAGS@
+ifeq ($(cuda),yes)
+OCTFLAGS=-DASTRA_CUDA
+else
+OCTFLAGS=
+endif
+endif
+
ifeq ($(matlab),yes)
CPPFLAGS+=-I$(MATLAB_ROOT)/extern/include -DMATLAB_MEX_FILE
CXXFLAGS+=-fopenmp
@@ -259,6 +274,20 @@ ifeq ($(python),yes)
MATLAB_MEX+=matlab/mex/astra_mex_plugin_c.$(MEXSUFFIX)
endif
+OCTAVE_CXX_OBJECTS=\
+ matlab/mex/octave_support.o
+
+OCTAVE_MEX=\
+ matlab/mex/astra_mex_algorithm_c.mex \
+ matlab/mex/astra_mex_data2d_c.mex \
+ matlab/mex/astra_mex_c.mex \
+ matlab/mex/astra_mex_matrix_c.mex \
+ matlab/mex/astra_mex_projector_c.mex \
+ matlab/mex/astra_mex_projector3d_c.mex \
+ matlab/mex/astra_mex_log_c.mex \
+ matlab/mex/astra_mex_data3d_c.mex \
+ matlab/mex/astra_mex_direct_c.mex
+
OBJECT_DIRS = src/ tests/ cuda/2d/ cuda/3d/ matlab/mex/ ./
DEPDIRS = $(addsuffix $(DEPDIR),$(OBJECT_DIRS))
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
@@ -294,6 +323,13 @@ python-root-install: libastra.la
endif
+ifeq ($(octave),yes)
+oct: $(OCTAVE_MEX)
+
+%.mex: %.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS) libastra.la
+ mkoctfile --mex $(OCTFLAGS) $(OCTLDFLAGS) $(LIBS) -L.libs -lastra --output $* $*.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS)
+endif
+
libastra.la: $(ALL_OBJECTS)
./libtool --mode=link --tag=CXX $(LD) -rpath $(LIBDIR) -o $@ $(LDFLAGS) $(LIBS) $+
@@ -374,7 +410,7 @@ distclean: clean
rm -rf $(srcdir)/autom4te.cache
rm -f $(srcdir)/configure Makefile
-install: install-libraries install-matlab install-python
+install: install-libraries install-matlab install-python install-octave
install-libraries: libastra.la
$(INSTALL_SH) -m 755 -d @libdir@
@@ -413,6 +449,19 @@ else
install-python:
endif
+ifeq ($(octave),yes)
+# TODO: This install location doesn't work well for /usr or /usr/local
+install-octave: $(OCTAVE_MEX)
+ $(INSTALL_SH) -m 755 -d @prefix@/octave
+ $(INSTALL_SH) -m 755 -d @prefix@/octave/mex
+ $(INSTALL_SH) -m 755 -d @prefix@/octave/tools
+ $(INSTALL_SH) -m 644 $(OCTAVE_MEX) @prefix@/octave/mex
+ $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m @prefix@/octave/tools
+# TODO: docs
+else
+install-octave:
+endif
+
Makefile: $(srcdir)/Makefile.in config.status
CONFIG_HEADERS= CONFIG_LINKS= CONFIG_FILES=$@ $(SHELL) ./config.status
diff --git a/build/linux/configure.ac b/build/linux/configure.ac
index 630b08d..0d80cec 100644
--- a/build/linux/configure.ac
+++ b/build/linux/configure.ac
@@ -175,6 +175,28 @@ fi
AC_SUBST(HAVEMATLAB)
+# octave
+
+AC_ARG_ENABLE(octave, [[ --disable-octave disable Octave support]])
+if test x"$enable_octave" != xno; then
+ AC_PATH_PROG([HAVEOCTAVE], [octave-config], [no], [$PATH])
+ AC_MSG_CHECKING([for octave])
+ if test x"HAVEOCTAVE" != xno -a $HAVEMATLAB = yes; then
+ HAVEOCTAVE=no
+ AC_MSG_RESULT([no (since Matlab support is enabled)])
+ else
+ if test x"$HAVEOCTAVE" != xno; then
+ OCTAVE_CPPFLAGS="-I`octave-config -p OCTINCLUDEDIR`"
+ AC_SUBST(OCTAVE_CPPFLAGS)
+ HAVEOCTAVE=yes
+ fi
+ AC_MSG_RESULT($HAVEOCTAVE)
+ fi
+else
+ HAVEOCTAVE=no
+fi
+AC_SUBST(HAVEOCTAVE)
+
# python
AC_ARG_WITH(python, [[ --with-python=path path of Python binary (optional)]],,)
@@ -271,6 +293,7 @@ echo
echo "Summary of ASTRA Toolbox build options:"
echo " CUDA : $HAVECUDA"
echo " Matlab : $HAVEMATLAB"
+echo " Octave : $HAVEOCTAVE"
echo " Python : $HAVEPYTHON"
echo
echo " prefix : $prefix"