Skip to content

Commit e2c7a13

Browse files
committed
Add BUILD_PYPI option, use it to control installtion of libraries into sdk/Python folder, also modify setup.py and add pyproject.tom1
1 parent 65b568f commit e2c7a13

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

Bindings/Python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_BINARY_DIR}/version.py" opensim)
251251

252252
# Copy setup.py for each build configuration.
253253
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/setup.py" ".")
254+
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/pyproject.tom1" ".")
254255

255256
# __init__.py.
256257
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" opensim)

Bindings/Python/pyproject.tom1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "opensim"
7+
version = "0.1.0" # You may want to dynamically inject this from version.py
8+
description = "OpenSim Simulation Framework"
9+
authors = [{ name = "OpenSim Team", email = "[email protected]" }]
10+
license = { text = "Apache 2.0" }
11+
dynamic = ["version"]
12+
readme = "README.md"
13+
urls = { homepage = "http://opensim.stanford.edu/" }
14+
classifiers = [
15+
"Intended Audience :: Science/Research",
16+
"Operating System :: OS Independent",
17+
"Programming Language :: Python :: 3",
18+
"Topic :: Scientific/Engineering :: Physics"
19+
]
20+
dependencies = [ "numpy>=2.0" ]
21+
22+
[project.scripts]
23+
opensim-moco-generate-report = "opensim.report:main"
24+
25+
[tool.setuptools]
26+
include-package-data = true
27+
28+
[tool.setuptools.packages.find]
29+
where = ["."]
30+
include = ["opensim"]
31+
32+
[tool.setuptools.package-data]
33+
opensim = ["_*.*", "*.dylib", "*.dll", "*.so*"]

Bindings/Python/setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@
5151
classifiers=[
5252
'Intended Audience :: Science/Research',
5353
'Operating System :: OS Independent',
54-
'Programming Language :: Python :: 2.7',
5554
'Programming Language :: Python :: 3',
5655
'Topic :: Scientific/Engineering :: Physics',
5756
],
57+
install_requires=[
58+
"numpy>=2.0,<2.3"
59+
]
5860
)
61+
62+
#python setup.py bdist_wheel --python-tag cp310

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,12 @@ set(BUILD_JAVA_WRAPPING OFF CACHE BOOL "Build Java wrapping (needed if you're bu
500500

501501
set(BUILD_PYTHON_WRAPPING OFF CACHE BOOL "Build Python wrapping (needed if you're building the Python wrapping; requires that you have SWIG and Python installed on your machine.)")
502502

503+
set(BUILD_PYPI OFF CACHE BOOL "Build Python wrapping into a pypi package wheel")
504+
505+
if(BUILD_PYPI)
506+
set(OPENSIM_PYTHON_STANDALONE ON CACHE BOOL "Enable Standalone python packaging" FORCE)
507+
endif()
508+
503509
set(OPENSIM_PYTHON_VERSION 3)
504510

505511
if(${BUILD_JAVA_WRAPPING})

0 commit comments

Comments
 (0)