Skip to content

Commit

Permalink
update README.rst, setup.py and SConstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Walter committed May 22, 2014
1 parent 4757f03 commit bcf62d3
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 75 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -27,9 +27,6 @@ build
adolc-2.0.0
jac_pat.mtx

setup.py
SConstruct

# EXCEPTIONS
!README
!.gitignore
7 changes: 5 additions & 2 deletions README.rst
Expand Up @@ -65,7 +65,7 @@ EXAMPLE USAGE::

THIS VERSION OF PYADOLC IS KNOWN TO WORK WITH:

* ADOL-C 2.5.1
* ADOL-C 2.5.1 (or commit >= d7a0b87fe4cd1344930a0d3ccc048e0a7038c5c8 from https://gitorious.org/adol-c)
* ColPack 1.0.9
* Ubuntu Linux
* Python 2.7.3
Expand Down Expand Up @@ -102,8 +102,11 @@ INSTALLATION:
* CLONE PYADOLC: ``cd /path/to/adol-c/`` and then ``git clone https://github.com/b45ch1/pyadolc.git python``
You should then have a folder /path/to/adol-c/python containing the file SConstruct
* BUILD PYADOLC:
Go to the folder /path/to/adol-c/python and run ``scons``
Go to the folder /path/to/adol-c/python and run ``scons``.
This should compile and link everything you need.
If you want to install ``pyadolc`` in a different path than ``/path/to/adol-c/python``, you have to set the following ENV variables
``export ADOLC_DIR=/path/to/adolc`` and ``export COLPACK_DIR=/path/to/colpack`` before running scons.

* TEST YOUR INSTALLATION:
* run ``python -c "import adolc; adolc.test()"``. All tests should pass.
* If anything goes wrong, please file a bug report.
Expand Down
21 changes: 20 additions & 1 deletion SConstruct
Expand Up @@ -32,6 +32,24 @@ INCLUDEPATH = [
adolc_include_path,
]



print ''
print '\033[1;31mplease check that the following settings are correct for your system\033[1;m'
print 'INCLUDEPATH = %s\n'%str(INCLUDEPATH)
print 'LIBPATH = %s\n'%str(LIBPATH)
print '''
If ADOL-C or Colpack cannot be found, you can manually set the paths via
``export ADOLC_DIR=/path/to/adol-c`` and ``export COLPACK_DIR=/path/to/colpack``
* where /path/to/adol-c contains the folders ``ADOL-C/include`` and ``ADOL-C/.libs``.
* where /path/to/colpack contains the folders ``./include`` and ``./lib64``, containing ``libColPack.so`` and the include files
'''
raw_input("Press enter to continue.")



# 0: setup the command line parsing
AddOption('--prefix',
dest='prefix',
Expand All @@ -45,7 +63,8 @@ env = Environment(
PREFIX = GetOption('prefix'),
TMPBUILD = '/tmp/builddir',
CPPPATH=[distutils.sysconfig.get_python_inc(),numpy.get_include()] + INCLUDEPATH,
CXXFLAGS="-ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB -O0 -g -Wall",
# CXXFLAGS="-ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB -O0 -g -Wall",
CXXFLAGS="-ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB -O1 -Wall",
LIBPATH= LIBPATH,
LIBS= LIBS,
RPATH = LIBPATH, #include information where shared libraries can be found to avoid errors like: "ImportError: libboost_python-gcc42-mt-1_34_1.so.1.34.1: cannot open shared object file: No such file or directory"
Expand Down
64 changes: 0 additions & 64 deletions SConstruct.EXAMPLE

This file was deleted.

37 changes: 32 additions & 5 deletions setup.py.EXAMPLE → setup.py
Expand Up @@ -14,19 +14,40 @@
from distutils.core import setup, Extension
from distutils.core import Command
from numpy.distutils.misc_util import get_numpy_include_dirs
from time import sleep
import inspect


BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
ADOLC_DIR = os.environ.get('ADOLC_DIR', BASEDIR)
COLPACK_DIR = os.environ.get('COLPACK_DIR', os.path.join(BASEDIR, 'ThirdParty/ColPack'))

adolc_include_path = os.path.join(ADOLC_DIR, 'ADOL-C/include')
adolc_library_path = os.path.join(ADOLC_DIR, 'ADOL-C/.libs')

colpack_include_path = os.path.join(COLPACK_DIR, 'include')
colpack_lib_path = os.path.join(COLPACK_DIR, 'lib64')


# ADAPT THIS TO FIT YOUR SYSTEM
extra_compile_args = ['-ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB']
include_dirs = [get_numpy_include_dirs()[0],'/home/b45ch1/workspace/ADOL-C/trunk/ADOL-C','/home/b45ch1/workspace/ColPack/build/include']
library_dirs = ['/home/b45ch1/workspace/ADOL-C/trunk/ADOL-C/src/.libs','/home/b45ch1/workspace/ColPack/build/lib']
include_dirs = [get_numpy_include_dirs()[0], adolc_include_path, colpack_include_path]
library_dirs = [adolc_library_path, colpack_lib_path]
libraries = ['boost_python','adolc', 'ColPack']

print ''
print '\033[1;31musing scons is the preferred method to compile pyadolc. If this script does not work, try to use scons.\033[1;m'
print '\033[1;31mplease check that the following settings are correct for your system\033[1;m'
print 'include_dirs = %s\n'%str(include_dirs)
print 'library_dirs = %s\n'%str(library_dirs)
sleep(1)
print '''
If ADOL-C or Colpack cannot be found, you can manually set the paths via
``export ADOLC_DIR=/path/to/adol-c`` and ``export COLPACK_DIR=/path/to/colpack``
* where /path/to/adol-c contains the folders ``ADOL-C/include`` and ``ADOL-C/.libs``.
* where /path/to/colpack contains the folders ``./include`` and ``./lib64``, containing ``libColPack.so`` and the include files
'''
raw_input("Press enter to continue.")


# PACKAGE INFORMATION
Expand Down Expand Up @@ -69,9 +90,15 @@
Options:
1: build the extension with
python setup.py build
2: install the extension with
python setup.py install
3: alternatively build inplace
python setup.py build_ext --inplace
2: remove generated files with
4: remove generated files with
python setup.py clean --all
Expand Down

0 comments on commit bcf62d3

Please sign in to comment.