Skip to content

Commit

Permalink
editable build (#3)
Browse files Browse the repository at this point in the history
* editable build

* fix

---------

Co-authored-by: TANG ZHIXIONG <[email protected]>
  • Loading branch information
district10 and TANG ZHIXIONG authored Nov 28, 2023
1 parent 3aad525 commit 8b64cd7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.15...3.26)

# https://scikit-build-core.readthedocs.io/en/latest/cmakelists.html#accessing-information
project(
${SKBUILD_PROJECT_NAME}
VERSION ${SKBUILD_PROJECT_VERSION}
Expand All @@ -25,6 +26,8 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
endif()

# TODO, use set(PYBIND11_NEWPYTHON ON)?
# https://scikit-build-core.readthedocs.io/en/latest/getting_started.html
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)

Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
PROJECT_SOURCE_DIR ?= $(abspath ./)
PROJECT_NAME ?= $(shell basename $(PROJECT_SOURCE_DIR))
BUILD_DIR ?= $(PROJECT_SOURCE_DIR)/build
INSTALL_DIR ?= $(BUILD_DIR)/install
NUM_JOB ?= 8

all:
@echo nothing special
Expand Down Expand Up @@ -51,14 +49,19 @@ test_in_dev_container:
--network host --security-opt seccomp=unconfined \
-v `pwd`:`pwd` -w `pwd` -it $(DEV_CONTAINER_IMAG) bash


PYTHON ?= python3
build:
# CMAKE_BUILD_PARALLEL_LEVEL=8
$(PYTHON) -m pip install --no-build-isolation --config-settings=editable.rebuild=true -Cbuild-dir=build -ve.
python_install:
$(PYTHON) -m pip install . --verbose
python_build:
python_wheel:
$(PYTHON) -m pip wheel . --verbose
python_sdist:
$(PYTHON) -m pip sdist .
$(PYTHON) -m pip sdist . --verbose
python_test: pytest
.PHONY: build

# conda create -y -n py36 python=3.6
# conda create -y -n py37 python=3.7
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ dependencies = [
test = ["pytest"]


# docs: https://scikit-build-core.readthedocs.io/en/latest/configuration.html
[tool.scikit-build]
wheel.expand-macos-universal-tags = true
# cmake.build-type = "Debug"
# build-dir = "build/{wheel_tag}"

[tool.scikit-build.cmake.define]
# SOME_DEFINE = "ON"


[tool.pytest.ini_options]
Expand Down

0 comments on commit 8b64cd7

Please sign in to comment.