OSDN Git Service

vc2008, gcc-4.5
[meshio/meshio.git] / swig / python / setup.py
1 import os
2 import shutil
3 from distutils.core import setup, Extension
4
5 def exec_command(cmd):
6     print cmd
7     os.system(cmd)
8
9 if os.name=='nt':
10     BOOST_ROOT='C:/boost/boost_1_46_1'
11     # for vc
12     extra_compile_args=["/EHsc", "/wd4996"]
13     libraries=[]
14     include_dirs=['../../src', BOOST_ROOT]
15     if os.path.exists("meshio/mqo.py"):
16         os.remove("meshio/mqo.py")
17     if os.path.exists("meshio/pmd.py"):
18         os.remove("meshio/pmd.py")
19     exec_command("swig -c++ -python -o mqo_wrap.cpp -D_MSC_VER ../mqo.i")
20     exec_command("swig -c++ -python -o pmd_wrap.cpp -D_MSC_VER ../pmd.i")
21     shutil.move("mqo.py", "meshio")
22     shutil.move("pmd.py", "meshio")
23 else:
24     extra_compile_args=['-std=c++0x']
25     libraries=["iconv"]
26     include_dirs=['../../src']
27     if os.path.exists("meshio/mqo.py"):
28         os.remove("meshio/mqo.py")
29     if os.path.exists("meshio/pmd.py"):
30         os.remove("meshio/pmd.py")
31     exec_command("swig -c++ -python -o mqo_wrap.cpp ../mqo.i")
32     exec_command("swig -c++ -python -o pmd_wrap.cpp ../pmd.i")
33     shutil.move("mqo.py", "meshio")
34     shutil.move("pmd.py", "meshio")
35
36 setup(
37         name='meshio',
38         version='1.0',
39         description='3D mesh IO library',
40         author='ousttrue',
41         author_email='ousttru@gmail.com',
42         url='http://meshio.sourceforge.jp/',
43
44         packages=['meshio'],
45
46         ext_modules = [
47             Extension("meshio._mqo", 
48                 language="c++",
49                 sources=["mqo_wrap.cpp", "../../src/mqo.cpp", "../../src/binary.cpp"], 
50                 include_dirs=include_dirs,
51                 extra_compile_args=extra_compile_args,
52                 libraries=libraries
53                 ),
54
55             Extension("meshio._pmd", 
56                 language="c++",
57                 sources=["pmd_wrap.cpp", "../../src/pmd.cpp", "../../src/binary.cpp"], 
58                 include_dirs=include_dirs,
59                 extra_compile_args=extra_compile_args,
60                 libraries=libraries
61                 ),
62             ]
63         )
64