This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathsetup.py
89 lines (79 loc) · 2.53 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import platform
from setuptools import setup, Extension
from os import system
VERSION_MAJOR = 1
VERSION_MINOR = 3
VERSION_PATCH = 10
VERSION = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_PATCH}"
DESC = """Python bindings for ILM's OpenEXR image file format.
To install this package, make sure your system already has the OpenEXR library
installed before.
If you detect any problem, please feel free to report the issue on the GitHub
page:
https://github.com/sanguinariojoe/pip-openexr/issues
"""
print("Looking for libOpenEXR...")
if platform.system() == "Linux" and system("ldconfig -p | grep libOpenEXR"):
# There is no libOpenEXR, probably an old version of OpenEXR
libraries = ["Iex", "Half", "Imath", "IlmImf", "z"]
else:
libraries = ["Iex", "OpenEXR", "z"]
include_dirs = [
"/usr/include/OpenEXR",
"/usr/local/include/OpenEXR",
"/opt/local/include/OpenEXR",
"/usr/include/Imath",
"/usr/local/include/Imath",
"/opt/local/include/Imath",
]
library_dirs = [
"/usr/lib",
"/usr/local/lib",
"/opt/local/lib",
"/opt/homebrew/opt/openexr/lib",
"/opt/homebrew/opt/imath/lib",
]
definitions = [
("PYOPENEXR_VERSION_MAJOR", f"{VERSION_MAJOR}"),
("PYOPENEXR_VERSION_MINOR", f"{VERSION_MINOR}"),
("PYOPENEXR_VERSION_PATCH", f"{VERSION_PATCH}"),
]
extra_compile_args = []
if platform.system() == "Darwin":
extra_compile_args += ["-std=c++11", "-Wc++11-extensions", "-Wc++11-long-long"]
include_dirs += [
"/opt/homebrew/opt/openexr/include/OpenEXR",
"/opt/homebrew/opt/imath/include/Imath",
]
library_dirs += ["/opt/homebrew/opt/openexr/lib", "/opt/homebrew/opt/imath/lib"]
if platform.system() == "Windows":
include_dirs += [
"C:/Program Files (x86)/OpenEXR/include/Imath",
"C:/Program Files (x86)/OpenEXR/include/OpenEXR",
]
library_dirs += [
"C:/Program Files (x86)/OpenEXR/lib",
"C:/Program Files/zlib/lib"
]
setup(
name="OpenEXR",
author="James Bowman",
author_email="[email protected]",
url="https://github.com/sanguinariojoe/pip-openexr",
description="Python bindings for ILM's OpenEXR image file format",
long_description=DESC,
version=VERSION,
ext_modules=[
Extension(
"OpenEXR",
["OpenEXR.cpp"],
language="c++",
define_macros=definitions,
include_dirs=include_dirs,
library_dirs=library_dirs,
libraries=libraries,
extra_compile_args=extra_compile_args,
)
],
py_modules=["Imath"],
)