Skip to content

Commit c95fd47

Browse files
committed
Use pip for single-command compilation
1 parent 0635203 commit c95fd47

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

environment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies:
1111
- btllib>=1.7.2
1212
- libtorch=*=cpu*
1313
- pybind11
14+
- scikit-build-core
1415
- ntcard
1516
- ntstat
1617
- ntedit

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["setuptools>=61"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["scikit-build-core", "pybind11"]
3+
build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "aiedit"
@@ -12,3 +12,8 @@ requires-python = ">=3.10"
1212

1313
[project.scripts]
1414
aiedit = "aiedit.main:main"
15+
16+
[tool.scikit-build]
17+
cmake.args = ["-DCMAKE_PREFIX_PATH={env.CONDA_PREFIX}"]
18+
wheel.expand-macos-universal-tags = true
19+
wheel.packages = ["aiedit"]

src/bindings/CMakeLists.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,16 @@ target_link_libraries(
1818
)
1919

2020
set(aiedit_path ${PROJECT_SOURCE_DIR}/aiedit)
21-
set_target_properties(core PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${aiedit_path})
22-
23-
set(_PY_SITE ${Python_SITEARCH})
24-
if(NOT _PY_SITE)
25-
set(_PY_SITE ${Python_SITELIB})
26-
endif()
27-
if(NOT _PY_SITE)
28-
message(FATAL_ERROR "Could not determine Python site-packages.")
29-
endif()
3021

3122
install(
3223
TARGETS core
33-
LIBRARY DESTINATION ${_PY_SITE}/aiedit
34-
RUNTIME DESTINATION ${_PY_SITE}/aiedit
24+
LIBRARY DESTINATION aiedit
25+
RUNTIME DESTINATION aiedit
3526
)
3627

3728
install(
3829
DIRECTORY ${CMAKE_SOURCE_DIR}/aiedit/
39-
DESTINATION ${_PY_SITE}/aiedit
30+
DESTINATION aiedit
4031
FILES_MATCHING
4132
PATTERN "*.py"
4233
PATTERN "*.pt"
@@ -46,9 +37,9 @@ find_program(PYBIND11_STUBGEN NAMES pybind11-stubgen)
4637
if(PYBIND11_STUBGEN)
4738
add_custom_command(
4839
TARGET core
49-
DEPENDS core POST_BUILD
50-
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${aiedit_path} ${PYBIND11_STUBGEN} --output-dir
51-
${aiedit_path} core
40+
POST_BUILD
41+
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=$<TARGET_FILE_DIR:core>
42+
${PYBIND11_STUBGEN} --output-dir ${CMAKE_SOURCE_DIR}/aiedit core
5243
COMMENT "Generating Python stubs"
5344
)
5445
endif()

0 commit comments

Comments
 (0)