-
-
Notifications
You must be signed in to change notification settings - Fork 649
Expand file tree
/
Copy pathsetup_v3.py
More file actions
104 lines (95 loc) · 2.95 KB
/
Copy pathsetup_v3.py
File metadata and controls
104 lines (95 loc) · 2.95 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env python3
"""
Setup script for TinyObjLoader v3 Python bindings
This builds the v3 module separately from the v2 module using:
- Python Stable ABI (abi3) for forward compatibility
- Python 3.10+ minimum requirement
- No dependency on Python.h at build time (uses manual ABI definitions)
"""
import sys
import os
from setuptools import setup, Extension
# Read version
try:
from python import _version
__version__ = _version.__version__
except:
__version__ = "3.0.0"
with open("README.md", "r", encoding="utf8") as fh:
long_description = fh.read()
# Compiler and linker flags for stable ABI
extra_compile_args = [
'-std=c++14',
'-fno-exceptions', # v3 doesn't use exceptions
'-fno-rtti', # v3 doesn't use RTTI
'-DPy_LIMITED_API=0x030A0000', # Python 3.10+
]
extra_link_args = []
# Platform-specific flags
if sys.platform == 'darwin':
# macOS
extra_compile_args.extend([
'-mmacosx-version-min=10.13',
'-fvisibility=hidden',
])
elif sys.platform.startswith('linux'):
# Linux
extra_compile_args.extend([
'-fvisibility=hidden',
])
extra_link_args.extend([
'-Wl,--exclude-libs,ALL',
])
elif sys.platform == 'win32':
# Windows MSVC
if 'MSC' in sys.version:
extra_compile_args = [
'/std:c++14',
'/DPy_LIMITED_API=0x030A0000',
'/D_CRT_SECURE_NO_WARNINGS',
]
# Define the extension module
ext_modules = [
Extension(
"tinyobjloader_v3",
sources=sorted([
"python/tinyobj_v3_bindings.cc",
"python/tinyobj_v3_loader.cc",
]),
include_dirs=["."],
language="c++",
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
py_limited_api=True, # Enable stable ABI
),
]
setup(
name="tinyobjloader-v3",
version=__version__,
author="Syoyo Fujita",
author_email="syoyo@lighttransport.com",
url="https://github.com/tinyobjloader/tinyobjloader",
description="TinyObjLoader v3 - Modern C++14 Wavefront OBJ parser",
long_description=long_description,
long_description_content_type='text/markdown',
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Manufacturing",
"Topic :: Artistic Software",
"Topic :: Multimedia :: Graphics :: 3D Modeling",
"Topic :: Scientific/Engineering :: Visualization",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: C++",
],
ext_modules=ext_modules,
python_requires=">=3.10",
zip_safe=False,
)