diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bdbe66f..031f88c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,20 +53,23 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - - run: pip install -U -e .[dev] - env: - # https://github.com/scikit-build/scikit-build/issues/740 - SETUPTOOLS_ENABLE_FEATURES: legacy-editable + - name: pip install -U -e .[dev] + # in-place for pytest (-e . doesn't work yet for scikit-build-core) + run: | + pip install toml + python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["build-system"]["requires"]), end="")' \ + | xargs -0 pip install + python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["project"]["optional-dependencies"]["dev"]), end="")' \ + | xargs -0 pip install + pip install --no-build-isolation --no-deps -t . -U -v . -Ccmake.define.CUVEC_DEBUG=1 + git restore cuvec/src - run: pytest - uses: codecov/codecov-action@v3 - name: compile -Wall run: | git clean -Xdf - pip install toml - python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["build-system"]["requires"]), end="")' \ - | xargs -0 pip install - python setup.py build -- -DCUVEC_DEBUG=1 \ - -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" + python -m build -n -w \ + -Ccmake.define.CMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" cuda: if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) name: CUDA py${{ matrix.python }} @@ -80,20 +83,24 @@ jobs: fetch-depth: 0 - name: Run setup-python run: setup-python -p${{ matrix.python }} 'cuda-version<12' cupy - - run: pip install -U -e .[dev] - env: - # https://github.com/scikit-build/scikit-build/issues/740 - SETUPTOOLS_ENABLE_FEATURES: legacy-editable + - name: pip install -U -e .[dev] + # in-place for pytest (-e . doesn't work yet for scikit-build-core) + run: | + pip install toml + python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["build-system"]["requires"]), end="")' \ + | xargs -0 pip install + python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["project"]["optional-dependencies"]["dev"]), end="")' \ + | xargs -0 pip install + pip install --no-build-isolation --no-deps -t . -U -v . -Ccmake.define.CUVEC_DEBUG=1 + git restore cuvec/src - run: pytest - uses: codecov/codecov-action@v3 - name: compile -Wall run: | git clean -Xdf - pip install toml - python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["build-system"]["requires"]), end="")' \ - | xargs -0 pip install - python setup.py build -- -DCUVEC_DEBUG=1 \ - -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" + python -m build -n -w \ + -Ccmake.define.CMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" \ + -Ccmake.define.CMAKE_CUDA_ARCHITECTURES=all - name: Post Run setup-python run: setup-python -p${{ matrix.python }} -Dr if: ${{ always() }} diff --git a/.gitignore b/.gitignore index 910da84..9f801ee 100644 --- a/.gitignore +++ b/.gitignore @@ -3,16 +3,12 @@ __pycache__/ # build *.so -CMakeFiles/ -cmake_install.cmake -/cuvec/*.ninja* -/cuvec/AMYPADcuvecConfig*.cmake -/cuvec/CMakeCache.txt -/cuvec/CMakeInit.txt /cuvec/_dist_ver.py +/cuvec/cmake/ +/cuvec-*.dist-info/ +/cuvec/*PYTHON_wrap.cxx /cuvec/example_swig.py /cuvec/swvec.py -/build/ /dist/ /docs/build/ diff --git a/cuvec/CMakeLists.txt b/cuvec/CMakeLists.txt index d0913df..5f79f9c 100644 --- a/cuvec/CMakeLists.txt +++ b/cuvec/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.18 FATAL_ERROR) -if("${SKBUILD_PROJECT_VERSION}" STREQUAL "") +cmake_minimum_required(VERSION 3.24 FATAL_ERROR) +if(NOT DEFINED SKBUILD_PROJECT_VERSION) set(SKBUILD_PROJECT_VERSION 2 CACHE STRING "version" FORCE) endif() string(REGEX REPLACE [[([0-9]+)\.([0-9]+)\.([0-9]+).*]] [[\1.\2.\3]] SKBUILD_PROJECT_VERSION "${SKBUILD_PROJECT_VERSION}") @@ -9,6 +9,9 @@ option(CUVEC_CUDA_OPTIONAL "Make CUDA optional rather than forced" ON) cmake_policy(PUSH) cmake_policy(SET CMP0074 NEW) # _ROOT hints for find_package +if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) + set(CMAKE_CUDA_ARCHITECTURES native CACHE STRING "CUDA arch" FORCE) +endif() cmake_policy(SET CMP0104 NEW) # CMAKE_CUDA_ARCHITECTURES find_package(Python COMPONENTS Interpreter Development.Module REQUIRED) # NumPy if(NOT CUVEC_CUDA_OPTIONAL) @@ -38,7 +41,7 @@ endif() cmake_policy(POP) message(STATUS "CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}") -if("${CMAKE_BUILD_TYPE}" STREQUAL "") +if(NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) endif() message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") diff --git a/pyproject.toml b/pyproject.toml index b0c712a..c28c6f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,8 +8,9 @@ build-backend = "scikit_build_core.build" metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" sdist.include = ["cuvec/_dist_ver.py"] sdist.exclude = ["docs", "tests", ".*"] +wheel.exclude = ["cuvec/src/**"] minimum-version = "0.5" -cmake.minimum-version = "3.18" +cmake.minimum-version = "3.24" cmake.source-dir = "cuvec" [tool.setuptools_scm]