diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4507ce9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + + - name: Cache CUDA Toolkit + id: cache-cuda + uses: actions/cache@v4 + with: + path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6 + key: cuda-12.6.0-nvcc-cudart + + - name: Install CUDA Toolkit + if: steps.cache-cuda.outputs.cache-hit != 'true' + shell: powershell + run: | + $url = "https://developer.download.nvidia.com/compute/cuda/12.6.0/network_installers/cuda_12.6.0_windows_network.exe" + Invoke-WebRequest -Uri $url -OutFile cuda_installer.exe + Start-Process -FilePath .\cuda_installer.exe -ArgumentList '-s','nvcc_12.6','cudart_12.6' -Wait -NoNewWindow + + - name: Set CUDA environment + shell: powershell + run: | + echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6" >> $env:GITHUB_ENV + echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin" >> $env:GITHUB_PATH + + - name: Install Vulkan SDK + uses: jakoch/install-vulkan-sdk-action@v1.0.5 + with: + vulkan_version: 1.3.290.0 + install_runtime: false + cache: true + + - name: Build and install + run: pip install . -v + env: + CMAKE_GENERATOR: Ninja + + - name: Verify import + run: python -c "import touchpy; print(f'touchpy {touchpy.__version__} OK')" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..40eee5c --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,67 @@ +name: Documentation + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + + - name: Cache CUDA Toolkit + id: cache-cuda + uses: actions/cache@v4 + with: + path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6 + key: cuda-12.6.0-nvcc-cudart + + - name: Install CUDA Toolkit + if: steps.cache-cuda.outputs.cache-hit != 'true' + shell: powershell + run: | + $url = "https://developer.download.nvidia.com/compute/cuda/12.6.0/network_installers/cuda_12.6.0_windows_network.exe" + Invoke-WebRequest -Uri $url -OutFile cuda_installer.exe + Start-Process -FilePath .\cuda_installer.exe -ArgumentList '-s','nvcc_12.6','cudart_12.6' -Wait -NoNewWindow + + - name: Set CUDA environment + shell: powershell + run: | + echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6" >> $env:GITHUB_ENV + echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin" >> $env:GITHUB_PATH + + - name: Install Vulkan SDK + uses: jakoch/install-vulkan-sdk-action@v1.0.5 + with: + vulkan_version: 1.3.290.0 + install_runtime: false + cache: true + + - name: Build and install touchpy + run: pip install . -v + env: + CMAKE_GENERATOR: Ninja + + - name: Install docs dependencies + run: pip install -r docs/requirements.txt + + - name: Build documentation + run: sphinx-build -M html docs/source docs/build + + - name: Deploy to docs branch + uses: peaceiris/actions-gh-pages@v4 + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html + publish_branch: docs + force_orphan: false diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000..37f3583 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,115 @@ +name: Build Wheels + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build_wheels: + name: Build wheels (Python ${{ matrix.python }}) + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + python: ["cp39", "cp310", "cp311", "cp312", "cp313"] + steps: + - uses: actions/checkout@v4 + + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + + - name: Cache CUDA Toolkit + id: cache-cuda + uses: actions/cache@v4 + with: + path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6 + key: cuda-12.6.0-nvcc-cudart + + - name: Install CUDA Toolkit + if: steps.cache-cuda.outputs.cache-hit != 'true' + shell: powershell + run: | + $url = "https://developer.download.nvidia.com/compute/cuda/12.6.0/network_installers/cuda_12.6.0_windows_network.exe" + Invoke-WebRequest -Uri $url -OutFile cuda_installer.exe + Start-Process -FilePath .\cuda_installer.exe -ArgumentList '-s','nvcc_12.6','cudart_12.6' -Wait -NoNewWindow + + - name: Set CUDA environment + shell: powershell + run: | + echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6" >> $env:GITHUB_ENV + echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin" >> $env:GITHUB_PATH + + - name: Install Vulkan SDK + uses: jakoch/install-vulkan-sdk-action@v1.0.5 + with: + vulkan_version: 1.3.290.0 + install_runtime: false + cache: true + + - name: Build wheel + uses: pypa/cibuildwheel@v2.22 + env: + CIBW_BUILD: "${{ matrix.python }}-win_amd64" + CIBW_ARCHS_WINDOWS: "AMD64" + CMAKE_GENERATOR: Ninja + + - uses: actions/upload-artifact@v4 + with: + name: wheel-${{ matrix.python }} + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: sdist + path: dist/*.tar.gz + + publish: + name: Publish to PyPI + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + if: github.event_name == 'release' + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + pattern: wheel-* + path: dist/ + merge-multiple: true + + - uses: actions/download-artifact@v4 + with: + name: sdist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + upload_release_assets: + name: Upload release assets + needs: [build_wheels] + runs-on: ubuntu-latest + if: github.event_name == 'release' + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + pattern: wheel-* + path: dist/ + merge-multiple: true + + - name: Upload wheels to release + uses: softprops/action-gh-release@v2 + with: + files: dist/*.whl diff --git a/CMakeLists.txt b/CMakeLists.txt index 23b55fb..70cbcdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,21 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(spdlog) +FetchContent_Declare( + VulkanMemoryAllocator + GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git + GIT_TAG v3.1.0 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" +) +FetchContent_MakeAvailable(VulkanMemoryAllocator) + +# Source includes VMA as "vma/vk_mem_alloc.h" (matching Vulkan SDK layout) +# but the VMA repo puts it at include/vk_mem_alloc.h — create the expected structure +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/_vma_include/vma") +file(COPY "${vulkanmemoryallocator_SOURCE_DIR}/include/vk_mem_alloc.h" + DESTINATION "${CMAKE_BINARY_DIR}/_vma_include/vma") + # touchpy ################################################################################################# find_package(Python 3.9 @@ -105,6 +120,7 @@ target_include_directories(touchpy PRIVATE ${SOURCE_DIR} ${CUDAToolkit_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/external/TouchEngine-Windows/include" + "${CMAKE_BINARY_DIR}/_vma_include" ) target_link_directories(touchpy PRIVATE diff --git a/docs/Makefile b/docs/Makefile index be51262..d0c3cbf 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,7 +6,7 @@ SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = source -BUILDDIR = ../install/docs +BUILDDIR = build # Put it first so that "make" without argument is like "make help". help: diff --git a/docs/requirements.txt b/docs/requirements.txt index fb62be0..a97fab4 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,6 @@ -sphinx==7.3.6 -sphinx-autoapi==3.1.0b0 -furo==2024.1.29 +sphinx>=7.3 +sphinx-autoapi>=3.1 +furo sphinx-copybutton +numpydoc +myst_parser diff --git a/docs/source/conf.py b/docs/source/conf.py index ee19c38..34d93c7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,18 +4,12 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html -from pathlib import Path -import sys -localImportPath = Path.cwd().parents[1] / 'install/modules' - -if str(localImportPath) not in sys.path: - sys.path.insert(0,str(localImportPath)) - +from importlib.metadata import version as get_version project = 'TouchPy' copyright = '2024' author = 'IntentDev' -release = '0.10' +release = get_version('touchpy') #==== start autoapi variant ======================== @@ -28,7 +22,9 @@ 'numpydoc', 'myst_parser'] -autoapi_dirs = ['../../out/install_build/py312'] +import touchpy +import os +autoapi_dirs = [os.path.dirname(touchpy.__file__)] autoapi_type = "python" autoapi_options = [ 'members', 'undoc-members', 'private-members', 'show-module-summary', 'special-members', 'imported-members', ]