summaryrefslogtreecommitdiffstats
path: root/build/linux
diff options
context:
space:
mode:
Diffstat (limited to 'build/linux')
-rw-r--r--build/linux/Makefile.in67
-rw-r--r--build/linux/acinclude.m427
-rwxr-xr-xbuild/linux/autogen.sh7
-rw-r--r--build/linux/configure.ac155
4 files changed, 207 insertions, 49 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index a7ac1f2..0dfa15a 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -1,5 +1,8 @@
cuda=@HAVECUDA@
matlab=@HAVEMATLAB@
+python=@HAVEPYTHON@
+boostutf=@HAVEBOOSTUTF@
+
MATLAB_ROOT=@MATLAB_ROOT@
@@ -9,6 +12,10 @@ ifeq ($(matlab),yes)
TARGETS+=mex
endif
+ifeq ($(python),yes)
+TARGETS+=py
+endif
+
all: $(TARGETS)
prefix=@prefix@
@@ -19,12 +26,15 @@ VPATH=../..
CPPFLAGS=@SAVED_CPPFLAGS@
CXXFLAGS=@SAVED_CXXFLAGS@
LDFLAGS=@SAVED_LDFLAGS@
+LIBS=@SAVED_LIBS@
CPPFLAGS+=-I../.. -I../../include -I../../lib/include/rapidxml
CXXFLAGS+=-g -O3 -Wall -Wshadow
-LIBS=-lpthread -lrt
+LIBS+=-lpthread
LDFLAGS+=-g
+CPPFLAGS+=@CPPFLAGS_OS@
+
ifeq ($(cuda),yes)
CPPFLAGS += @CPPFLAGS_CUDA@ -DASTRA_CUDA
NVCCFLAGS = @NVCCFLAGS@ @CPPFLAGS_CUDA@ -I../.. -I../../include -DASTRA_CUDA
@@ -39,9 +49,19 @@ CXXFLAGS+=-fopenmp
LDFLAGS+=-fopenmp
endif
+ifeq ($(python),yes)
+PYCPPFLAGS = ${CPPFLAGS}
+PYCPPFLAGS += -I../include
+PYLDFLAGS = ${LDFLAGS}
+PYLDFLAGS += -L../build/linux/.libs
+PYTHON = @PYTHON@
+endif
+
BOOST_CPPFLAGS=
BOOST_LDFLAGS=
+BOOSTUTF_LIBS=@LIBS_BOOSTUTF@
+
CPPFLAGS+=$(BOOST_CPPFLAGS)
LDFLAGS+=$(BOOST_LDFLAGS)
@@ -53,7 +73,7 @@ LD=@CXX@
SHELL=@SHELL@
ifeq ($(matlab),yes)
-MEXFLAGS = -cxx
+MEXFLAGS = -cxx
MEXLDFLAGS='$$LDFLAGS $(LDFLAGS)'
MEXLIBS = -L.libs -lut
MEXSUFFIX = @MEXSUFFIX@
@@ -101,8 +121,9 @@ BASE_OBJECTS=\
src/Float32VolumeData3DMemory.lo \
src/ForwardProjectionAlgorithm.lo \
src/Fourier.lo \
+ src/GeometryUtil3D.lo \
src/Globals.lo \
- src/Logger.lo \
+ src/Logging.lo \
src/ParallelBeamBlobKernelProjector2D.lo \
src/ParallelBeamLinearKernelProjector2D.lo \
src/ParallelBeamLineKernelProjector2D.lo \
@@ -200,6 +221,7 @@ TEST_OBJECTS=\
MATLAB_CXX_OBJECTS=\
matlab/mex/mexHelpFunctions.o \
matlab/mex/mexCopyDataHelpFunctions.o \
+ matlab/mex/mexInitFunctions.o \
matlab/mex/mexDataManagerHelpFunctions.o
MATLAB_MEX=\
@@ -209,6 +231,7 @@ MATLAB_MEX=\
matlab/mex/astra_mex_matrix_c.$(MEXSUFFIX) \
matlab/mex/astra_mex_projector_c.$(MEXSUFFIX) \
matlab/mex/astra_mex_projector3d_c.$(MEXSUFFIX) \
+ matlab/mex/astra_mex_log_c.$(MEXSUFFIX) \
matlab/mex/astra_mex_data3d_c.$(MEXSUFFIX)
@@ -225,6 +248,14 @@ mex: $(MATLAB_MEX)
$(MEX) LDFLAGS=$(MEXLDFLAGS) $(MEXFLAGS) $(LIBS) $(MEXLIBS) -lastra -output $* $*.o $(MATLAB_CXX_OBJECTS)
endif
+ifeq ($(python),yes)
+py: libastra.la
+ cd ../../python; CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py install \
+ --install-base=./finalbuild --install-headers=./finalbuild --install-purelib=./finalbuild \
+ --install-platlib=./finalbuild --install-scripts=./finalbuild --install-data=./finalbuild
+endif
+
+
libastra.la: $(ALL_OBJECTS)
./libtool --mode=link --tag=CXX $(LD) -rpath $(LIBDIR) -o $@ $(LDFLAGS) $(LIBS) $+
@@ -264,11 +295,16 @@ ifeq ($(cuda),yes)
@rm -f $(*F).linkinfo
endif
+ifeq ($(boostutf),yes)
test.bin: $(ALL_OBJECTS) $(TEST_OBJECTS)
- ./libtool --mode=link $(LD) -o $@ $(LDFLAGS) $(LIBS) $+ -lboost_unit_test_framework
+ ./libtool --mode=link $(LD) -o $@ $(LDFLAGS) $+ $(LIBS) $(BOOSTUTF_LIBS)
test: test.bin
./test.bin
+else
+test:
+ @echo "Tests have been disabled by configure"
+endif
clean:
rm -f $(MATLAB_MEX) libastra.la
@@ -277,6 +313,10 @@ clean:
rm -f $(addsuffix /*.d,$(DEPDIRS))
rm -f $(addsuffix /*,$(LIBDIRS))
rm -f $(TEST_OBJECTS) test.bin
+ rm -fr ../../python/finalbuild/
+ rm -fr ../../python/build/
+ rm -f ../../python/astra/*.cpp
+ rm -f ../../python/astra/*.c
distclean: clean
rm -f config.guess config.sub ltmain.sh libtool install-sh
@@ -285,7 +325,7 @@ distclean: clean
rm -rf autom4te.cache
rm -f configure Makefile
-install: install-libraries install-matlab
+install: install-libraries install-matlab install-python
install-libraries: libastra.la
./install-sh -m 755 -d @libdir@
@@ -305,6 +345,23 @@ else
install-matlab:
endif
+ifeq ($(python),yes)
+# TODO: This install location doesn't work well for /usr or /usr/local
+install-python: py
+ ./install-sh -m 755 -d @prefix@/python
+ ./install-sh -m 755 -d @prefix@/python/astra
+ ./install-sh -m 644 ../../python/finalbuild/astra/*.so @prefix@/python/astra
+ ./install-sh -m 644 ../../python/finalbuild/astra/*.py @prefix@/python/astra
+ ./install-sh -m 644 ../../python/finalbuild/*.egg-info @prefix@/python/
+ @echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+ @echo "To use ASTRA in Python, add @prefix@/python/ to your PYTHONPATH"
+ @echo "and @libdir@ to your LD_LIBRARY_PATH."
+ @echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+# TODO: docs
+else
+install-python:
+endif
+
Makefile: Makefile.in config.status
CONFIG_HEADERS= CONFIG_LINKS= CONFIG_FILES=$@ $(SHELL) ./config.status
diff --git a/build/linux/acinclude.m4 b/build/linux/acinclude.m4
index 4ff9e4b..e4b6de7 100644
--- a/build/linux/acinclude.m4
+++ b/build/linux/acinclude.m4
@@ -60,10 +60,28 @@ AC_DEFUN([ASTRA_RUN_STOREOUTPUT],[{
test $ac_status = 0;
}])
-dnl ASTRA_RUN(command)
-AC_DEFUN([ASTRA_RUN],[ASTRA_RUN_STOREOUTPUT($1,/dev/null)])
+dnl ASTRA_RUN_LOGOUTPUT(command)
+AC_DEFUN([ASTRA_RUN_LOGOUTPUT],[{
+ AS_ECHO(["$as_me:${as_lineno-$LINENO}: $1"]) >&AS_MESSAGE_LOG_FD
+ ( $1 ) >&AS_MESSAGE_LOG_FD 2>&1
+ ac_status=$?
+ AS_ECHO(["$as_me:${as_lineno-$LINENO}: \$? = $ac_status"]) >&AS_MESSAGE_LOG_FD
+ test $ac_status = 0;
+ }])
+dnl ASTRA_TRY_PYTHON(code, action-if-ok, action-if-not-ok)
+AC_DEFUN([ASTRA_TRY_PYTHON],[
+cat >conftest.py <<_ACEOF
+$1
+_ACEOF
+ASTRA_RUN_LOGOUTPUT($PYTHON conftest.py)
+AS_IF([test $? = 0],[$2],[
+ AS_ECHO(["$as_me: failed program was:"]) >&AS_MESSAGE_LOG_FD
+ sed 's/^/| /' conftest.py >&AS_MESSAGE_LOG_FD
+ $3])
+])
+
dnl ASTRA_CHECK_NVCC(variable-to-set,cppflags-to-set)
AC_DEFUN([ASTRA_CHECK_NVCC],[
@@ -79,9 +97,9 @@ ASTRA_RUN_STOREOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2],conftest.nvcc.out
$1="no"
# Check if hack for gcc 4.4 helps
if grep -q __builtin_stdarg_start conftest.nvcc.out; then
+ AS_ECHO(["$as_me:${as_lineno-$LINENO}: Trying CUDA hack for gcc 4.4"]) >&AS_MESSAGE_LOG_FD
NVCC_OPT="-Xcompiler -D__builtin_stdarg_start=__builtin_va_start"
-
- ASTRA_RUN([$NVCC -c -o conftest.o conftest.cu $$2 $NVCC_OPT]) && {
+ ASTRA_RUN_LOGOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2 $NVCC_OPT]) && {
$1="yes"
$2="$$2 $NVCC_OPT"
}
@@ -94,6 +112,7 @@ fi
rm -f conftest.cu conftest.o conftest.nvcc.out
])
+
dnl ASTRA_FIND_NVCC_ARCHS(archs-to-try,cppflags-to-extend,output-list)
dnl Architectures should be of the form 10,20,30,35,
dnl and should be in order. The last accepted one will be used for PTX output.
diff --git a/build/linux/autogen.sh b/build/linux/autogen.sh
index c856793..544fdeb 100755
--- a/build/linux/autogen.sh
+++ b/build/linux/autogen.sh
@@ -12,9 +12,12 @@ if test $? -ne 0; then
exit 1
fi
-libtoolize --install --force > /dev/null 2>&1
+case `uname` in Darwin*) LIBTOOLIZEBIN=glibtoolize ;;
+ *) LIBTOOLIZEBIN=libtoolize ;; esac
+
+$LIBTOOLIZEBIN --install --force > /dev/null 2>&1
if test $? -ne 0; then
- libtoolize --force
+ $LIBTOOLIZEBIN --force
if test $? -ne 0; then
echo "Error running libtoolize"
exit 1
diff --git a/build/linux/configure.ac b/build/linux/configure.ac
index f99c4d3..d9e1f1a 100644
--- a/build/linux/configure.ac
+++ b/build/linux/configure.ac
@@ -1,26 +1,26 @@
dnl -----------------------------------------------------------------------
dnl Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
dnl 2014-2015, CWI, Amsterdam
-dnl
+dnl
dnl Contact: astra@uantwerpen.be
dnl Website: http://sf.net/projects/astra-toolbox
-dnl
+dnl
dnl This file is part of the ASTRA Toolbox.
-dnl
-dnl
+dnl
+dnl
dnl The ASTRA Toolbox is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
-dnl
+dnl
dnl The ASTRA Toolbox is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
-dnl
+dnl
dnl You should have received a copy of the GNU General Public License
dnl along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
-dnl
+dnl
dnl -----------------------------------------------------------------------
dnl $Id$
@@ -31,6 +31,7 @@ LT_INIT([disable-static])
SAVED_CPPFLAGS="$CPPFLAGS"
SAVED_CXXFLAGS="$CXXFLAGS"
SAVED_LDFLAGS="$LDFLAGS"
+SAVED_LIBS="$LIBS"
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
@@ -52,61 +53,70 @@ AC_CHECK_HEADER(iostream, , AC_MSG_ERROR([No working c++ compiler found]))
AC_MSG_CHECKING([for boost-unit-test-framework])
ASTRA_CHECK_BOOST_UNIT_TEST_FRAMEWORK(-lboost_unit_test_framework-mt, BOOSTUTF=yes_mt, BOOSTUTF=no)
+HAVEBOOSTUTF=no
if test x$BOOSTUTF = xno; then
ASTRA_CHECK_BOOST_UNIT_TEST_FRAMEWORK(-lboost_unit_test_framework, BOOSTUTF=yes, BOOSTUTF=no)
- if test x$BOOSTTHREAD = xno; then
+ if test x$BOOSTUTF = xno; then
AC_MSG_RESULT(no)
- AC_MSG_ERROR([No boost-unit-test-framework library found])
else
AC_MSG_RESULT([yes, libboost_unit_test_framework])
LIBS_BOOSTUTF="-lboost_unit_test_framework"
+ HAVEBOOSTUTF=yes
fi
else
AC_MSG_RESULT([yes, libboost_unit_test_framework-mt])
LIBS_BOOSTUTF="-lboost_unit_test_framework-mt"
+ HAVEBOOSTUTF=yes
fi
-# TODO: do something with the result
+AC_SUBST(HAVEBOOSTUTF)
+AC_SUBST(LIBS_BOOSTUTF)
+
+BOOSTok=yes
+AC_CHECK_HEADER([boost/lexical_cast.hpp],[],[BOOSTok=no],[])
+AC_CHECK_HEADER([boost/any.hpp],[],[BOOSTok=no],[])
+dnl AC_CHECK_HEADER([boost/thread.hpp],[],[BOOSTok=no],[])
+dnl AC_CHECK_HEADER([boost/bind.hpp],[],[BOOSTok=no],[])
+AC_CHECK_HEADER([boost/static_assert.hpp],[],[BOOSTok=no],[])
+AC_CHECK_HEADER([boost/throw_exception.hpp],[],[BOOSTok=no],[])
+
+if test x$BOOSTok = xno; then
+ AC_MSG_ERROR([boost not found])
+fi
# nvcc, cuda
AC_ARG_WITH(cuda, [[ --with-cuda=path path of CUDA SDK (optional)]],,)
-NVCC_PATH=$PATH
-if test x"$with_cuda" != x; then
- NVCC_PATH="$with_cuda/bin:$NVCC_PATH"
+if test x"$with_cuda" != xno; then
+ NVCC_PATH=$PATH
+ if test x"$with_cuda" != x -a x"$with_cuda" != xyes; then
+ NVCC_PATH="$with_cuda/bin:$NVCC_PATH"
+ fi
+ AC_PATH_PROG([NVCC], [nvcc], [no], [$NVCC_PATH])
+else
+ NVCC=no
fi
-AC_PATH_PROG([NVCC], [nvcc], [no], [$NVCC_PATH])
-# TODO: do something with the result
HAVECUDA=no
if test x"$NVCC" != xno; then
HAVECUDA=yes
BACKUP_CUDA_LDFLAGS="$LDFLAGS"
- if test x"$with_cuda" != x; then
- LDFLAGS_CUDA="-L$with_cuda/lib"
+ if test x"$with_cuda" != x -a x"$with_cuda" != xyes; then
+ case $host_cpu in
+ x86_64)
+ LDFLAGS_CUDA="-L$with_cuda/lib64"
+ ;;
+ *)
+ LDFLAGS_CUDA="-L$with_cuda/lib"
+ ;;
+ esac
CPPFLAGS_CUDA="-I$with_cuda/include"
LDFLAGS="$LDFLAGS $LDFLAGS_CUDA"
fi
AC_CHECK_LIB(cudart,cudaMalloc, ,HAVECUDA=no)
AC_CHECK_LIB(cufft,cufftPlan1d, ,HAVECUDA=no)
- if test x"$HAVECUDA" = xno; then
- # try lib64 instead of lib
-
- HAVECUDA=yes
- LDFLAGS="$BACKUP_CUDA_LDFLAGS"
-
- # prevent cached values from being used
- unset ac_cv_lib_cudart_cudaMalloc
- unset ac_cv_lib_cufft_cufftPlan1d
-
- LDFLAGS_CUDA="-L$with_cuda/lib64"
- LDFLAGS="$LDFLAGS $LDFLAGS_CUDA"
- AC_CHECK_LIB(cudart,cudaMalloc, ,HAVECUDA=no)
- AC_CHECK_LIB(cufft,cufftPlan1d, ,HAVECUDA=no)
- fi
-
LDFLAGS="$BACKUP_CUDA_LDFLAGS"
unset BACKUP_CUDA_LDFLAGS
# TODO: check for cuda headers?
@@ -115,11 +125,11 @@ if test x"$NVCC" != xno; then
fi
NVCCFLAGS=""
-AC_MSG_CHECKING([if nvcc works])
if test x"$HAVECUDA" = xyes; then
+ AC_MSG_CHECKING([if nvcc works])
ASTRA_CHECK_NVCC(HAVECUDA,NVCCFLAGS)
+ AC_MSG_RESULT($HAVECUDA)
fi
-AC_MSG_RESULT($HAVECUDA)
AC_ARG_WITH(cuda_compute, [[ --with-cuda-compute=archs comma separated list of CUDA compute models (optional)]],,)
if test x"$HAVECUDA" = xyes; then
@@ -154,7 +164,7 @@ if test x"$with_matlab" != x; then
AC_SUBST(MEX)
MATLAB_ROOT="$with_matlab"
AC_SUBST(MATLAB_ROOT)
-
+ # TODO: maybe catch mex warnings
ASTRA_CHECK_MEX_SUFFIX([mexa64 mexglx mexmaci64 mexmaci],[MEXSUFFIX])
if test x$MEXSUFFIX = x; then
AC_MSG_FAILURE([Unable to determine matlab mex suffix])
@@ -166,6 +176,67 @@ fi
AC_SUBST(HAVEMATLAB)
+# python
+
+AC_ARG_WITH(python, [[ --with-python=path path of Python binary (optional)]],,)
+
+HAVEPYTHON=no
+if test x"$with_python" != x -a x"$with_python" != xno; then
+ if test x"$with_python" = xyes; then
+ PYTHON=python
+ else
+ PYTHON="$with_python"
+ fi
+ AC_MSG_CHECKING(for python)
+ ASTRA_RUN_LOGOUTPUT(echo 'import sys' | $PYTHON -)
+ if test $? -ne 0; then
+ AC_MSG_ERROR(Python binary not found)]
+ fi
+ AC_MSG_RESULT([$PYTHON])
+ HAVEPYTHON=yes
+ AC_SUBST(PYTHON)
+ AC_MSG_CHECKING(for numpy module)
+ ASTRA_TRY_PYTHON([import numpy],,HAVEPYTHON=no)
+ if test x$HAVEPYTHON = xno; then
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(You need the numpy module to use the ASTRA toolbox in Python)
+ fi
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING(for Cython module)
+ ASTRA_TRY_PYTHON([
+import Cython
+from distutils.version import LooseVersion
+assert(LooseVersion(Cython.__version__)>=LooseVersion("0.13"))
+],,HAVEPYTHON=no)
+ if test x$HAVEPYTHON = xno; then
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(You need the Cython module (version >=0.13) to use the ASTRA toolbox in Python)
+ fi
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING(for six module)
+ ASTRA_TRY_PYTHON([import six])
+ if test x$HAVEPYTHON = xno; then
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(You need the six module to use the ASTRA toolbox in Python)
+ fi
+ AC_MSG_RESULT(yes)
+fi
+
+AC_SUBST(HAVEPYTHON)
+
+#OS specific setup
+AC_CANONICAL_HOST
+case $host_os in
+ darwin* )
+ CPPFLAGS_OS="-stdlib=libstdc++ -mmacosx-version-min=10.6"
+ ;;
+ *)
+ CPPFLAGS_OS=""
+ ;;
+esac
+
+AC_SUBST(CPPFLAGS_OS)
+
# TODO:
@@ -179,7 +250,15 @@ AC_SUBST(HAVEMATLAB)
AC_SUBST(SAVED_CPPFLAGS)
AC_SUBST(SAVED_CXXFLAGS)
AC_SUBST(SAVED_LDFLAGS)
-
-
+AC_SUBST(SAVED_LIBS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+
+echo
+echo "Summary of ASTRA Toolbox build options:"
+echo " CUDA : $HAVECUDA"
+echo " Matlab : $HAVEMATLAB"
+echo " Python : $HAVEPYTHON"
+echo
+echo " prefix : $prefix"
+echo