forked from jamesbowman/openexrpython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
60 lines (56 loc) · 2.05 KB
/
setup.py
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
import os
import platform
import sys
from distutils.command.build_py import build_py as _build_py
from distutils.core import Extension, setup
from distutils.extension import Extension
from distutils.sysconfig import get_config_var
from distutils.version import LooseVersion
version = "1.3.2+geomagical.3"
compiler_args = ["-g", '-DVERSION="%s"' % version]
openexr_lib = "openexr-install/lib64"
if not os.path.exists(openexr_lib):
openexr_lib = "openexr-install/lib"
lib_suffix = ".so.25"
link_args = [f"-Wl,-rpath,$ORIGIN/{openexr_lib}"]
if sys.platform == "darwin":
lib_suffix = ".25.dylib"
link_args = []
compiler_args.append("-std=c++14")
if "MACOSX_DEPLOYMENT_TARGET" not in os.environ:
current_system = LooseVersion(platform.mac_ver()[0])
python_target = LooseVersion(str(get_config_var("MACOSX_DEPLOYMENT_TARGET")))
if python_target < "10.9" and current_system >= "10.9":
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.9"
setup(
name="OpenEXR",
author="James Bowman",
author_email="[email protected]",
url="http://www.excamera.com/sphinx/articles-openexr.html",
description="Python bindings for ILM's OpenEXR image file format",
long_description="Python bindings for ILM's OpenEXR image file format",
version=version,
ext_modules=[
Extension(
"OpenEXR",
["OpenEXR.cpp"],
include_dirs=["openexr-install/include/OpenEXR"],
library_dirs=[openexr_lib],
libraries=["Iex", "Half", "Imath", "IlmImf", "z"],
extra_compile_args=compiler_args,
extra_link_args=link_args,
)
],
py_modules=["Imath"],
packages=[""],
package_data={
"": [
f"{openexr_lib}/libIex-2_5{lib_suffix}",
f"{openexr_lib}/libHalf-2_5{lib_suffix}",
f"{openexr_lib}/libImath-2_5{lib_suffix}",
f"{openexr_lib}/libIlmImf-2_5{lib_suffix}",
f"{openexr_lib}/libIexMath-2_5{lib_suffix}",
f"{openexr_lib}/libIlmThread-2_5{lib_suffix}",
]
},
)