forked from b45ch1/pyadolc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py.EXAMPLE
81 lines (62 loc) · 2.32 KB
/
setup.py.EXAMPLE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# build with: $ python setup.py build_ext --inplace
# clean with: # python setup.py clean --all
# see:
# http://www.scipy.org/Documentation/numpy_distutils
# http://docs.cython.org/docs/tutorial.html
from numpy.distutils.misc_util import get_numpy_include_dirs
from numpy.distutils.misc_util import Configuration
from numpy.distutils.core import setup
from numpy.distutils.core import Command
# ADAPT THIS TO FIT YOUR SYSTEM
include_dirs = [get_numpy_include_dirs(),'./adolc-2.0.0']
extra_compile_args = ['-ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB']
library_dirs = ['/data/walter/opt_software/boost_1_34_1/bin.v2/libs/python/build/gcc-4.2.1/release','./adolc-2.0.0/adolc/.libs']
libraries = ['boost_python-gcc42-1_34_1','adolc']
# IT IS USUALLY NOT NECESSARY TO CHANGE ANTHING BELOW THIS POINT
# override default setup.py help output
import sys
if len(sys.argv) == 1:
print """
You didn't enter what to do!
Options:
1: build the extension with
python setup.py build_ext --inplace
2: remove generated files with
python setup.py clean --all
Remark: This is an override of the default behaviour of the distutils setup.
"""
exit()
class clean(Command):
"""
This class is used in numpy.distutils.core.setup.
When $python setup.py clean is called, an instance of this class is created and then it's run method is called.
"""
description = "Clean everything"
user_options = [("all","a","the same")]
def initialize_options(self):
self.all = None
def finalize_options(self):
pass
def run(self):
import os
os.system("rm -rf build")
os.system("rm _adolc.so")
os.system("rm -f py_adolc.os num_util.os")
os.system("rm *.pyc")
config = Configuration('',parent_package='',top_path='')
config.add_extension(
name = '_adolc',
sources = ['py_adolc.cpp', 'num_util.cpp'],
include_dirs = include_dirs,
extra_compile_args = extra_compile_args,
library_dirs = library_dirs,
runtime_library_dirs = library_dirs,
libraries = libraries
)
#include_dirs, define_macros, undef_macros, library_dirs, libraries, runtime_library_dirs, extra_objects, extra_compile_args, extra_link_args, export_symbols, swig_opts, depends, language, f2py_options, module_dirs, extra_info.
options_dict = config.todict()
options_dict['cmdclass'] = {'clean':clean}
#, cmdclass = {'clean':clean}
#setup(**config.todict())
setup(**options_dict)