From 4675633249e624a5d02afc37bf4c7e585221853b Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 11:22:04 +1100 Subject: [PATCH 1/8] Use scikit-build and (optionally) vcpkg for embree3 dependency. --- .github/workflows/python-test-vcpkg.yml | 85 ++++++++++++++++++++++ .gitignore | 1 + CMakeLists.txt | 93 +++++++++++++++++++++++++ pyproject.toml | 18 ++++- setup.py | 48 ++----------- vcpkg.json | 6 ++ 6 files changed, 206 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/python-test-vcpkg.yml create mode 100644 CMakeLists.txt create mode 100644 vcpkg.json diff --git a/.github/workflows/python-test-vcpkg.yml b/.github/workflows/python-test-vcpkg.yml new file mode 100644 index 0000000..7de5109 --- /dev/null +++ b/.github/workflows/python-test-vcpkg.yml @@ -0,0 +1,85 @@ +name: Python Test (vcpkg build) + +on: + workflow_dispatch: + push: + pull_request: + +jobs: + + python: + name: ${{ github.workflow }} Python package on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.10"] + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Install OS tools + shell: bash + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + brew install autoconf automake libtool + fi + + - uses: lukka/get-cmake@latest + name: Install cmake and ninja (via get-cmake) + + - name: Dump the content of $RUNNER_TEMP + run: find $RUNNER_TEMP + shell: bash + - name: Dump the content of $RUNNER_WORKSPACE + run: find $RUNNER_WORKSPACE + shell: bash + + - name: Restore artifacts, or setup vcpkg for building artifacts + uses: lukka/run-vcpkg@v11 + with: + # This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch. + vcpkgDirectory: '${{ runner.workspace }}/vcpkg' + # The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule. + vcpkgGitCommitId: "c8696863d371ab7f46e213d8f5ca923c4aef2a00" + # The vcpkg.json file, which will be part of cache key computation. + vcpkgJsonGlob: '**/vcpkg.json' + id: runvcpkg + + - name: Prints output of run-vcpkg's action. + run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install python dependencies + shell: bash + run: | + python -m pip install --upgrade pip + python -m pip install cmake setuptools scikit-build wheel 'versioneer[toml]' + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Build and install with pip + env: + VCPKG_ROOT: ${{ runner.workspace }}/vcpkg + run: python -m pip install --user ${{ github.workspace }} + + - name: Debug pyemblite install + shell: bash + run: | + cd ~ + echo $(pwd) + python -c 'import os; import pyemblite; print(os.listdir(os.path.dirname(pyemblite.__file__)))' + python -c 'import os; import pyemblite; print(os.listdir(os.path.join(os.path.dirname(pyemblite.__file__), "models")))' + python -c 'import pyemblite; print(f"pyemblite.__file__={pyemblite.__file__}"); print(dir(pyemblite))' + + - name: Test + shell: bash + run: | + cd ~ + python -m pyemblite.test -fv diff --git a/.gitignore b/.gitignore index 3722485..45702f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .project .pydevproject build +_skbuild dist pyemblite.egg-info pyemblite/*.c diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0b4bd67 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,93 @@ + +CMAKE_MINIMUM_REQUIRED(VERSION 3.21) + +IF (NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE Release) +ENDIF() + +if(DEFINED CMAKE_TOOLCHAIN_FILE) # Print toolchain information + message(STATUS "Using toolchain: ${CMAKE_TOOLCHAIN_FILE}") +elseif(DEFINED ENV{CMAKE_TOOLCHAIN_FILE}) + message(STATUS "Using toolchain: $ENV{CMAKE_TOOLCHAIN_FILE}") + set(CMAKE_TOOLCHAIN_FILE + "$ENV{CMAKE_TOOLCHAIN_FILE}" + CACHE FILEPATH "" + ) +elseif(DEFINED ENV{VCPKG_ROOT}) + message(STATUS "Using vcpkg installed in $ENV{VCPKG_ROOT}") + set(CMAKE_TOOLCHAIN_FILE + "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + CACHE FILEPATH "" + ) +elseif(CMAKE_FETCH_VCPKG OR DEFINED ENV{CMAKE_FETCH_VCPKG}) + message(STATUS "Fetching vcpkg") + include(FetchContent) + FetchContent_Declare(vcpkg + GIT_REPOSITORY https://github.com/microsoft/vcpkg/ + GIT_TAG 2023.12.12 + ) + FetchContent_MakeAvailable(vcpkg) + set(CMAKE_TOOLCHAIN_FILE + "${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake" + CACHE FILEPATH "" + ) + message(STATUS "Fetching vcpkg -- done") +else() + message(STATUS "No VCPKG_ROOT or CMAKE_TOOLCHAIN_FILE defined, skipping vcpkg use.") +endif() + +enable_language(CXX) + +MESSAGE(STATUS "Finding Python...") +FIND_PACKAGE(Python COMPONENTS Interpreter Development.Module REQUIRED) +MESSAGE(STATUS "Finding Cython...") +FIND_PACKAGE(Cython REQUIRED) +MESSAGE(STATUS "Finding NumPy...") +FIND_PACKAGE(NumPy REQUIRED) +MESSAGE(STATUS "Finding embree3...") +find_package(embree 3 CONFIG REQUIRED) +MESSAGE(STATUS "Finding PythonExtensions...") +SET(Python_ADDITIONAL_VERSIONS "${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}") +FIND_PACKAGE(PythonExtensions REQUIRED) + +PROJECT(pyemblite) + +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${NumPy_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pyemblite) + +MESSAGE(STATUS "CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") + +SET( + PYTHON_SITE_PACKAGES_INSTALL_DIR + ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages +) +SET( + PCSR_PYTHON_SITE_PACKAGES_INSTALL_DIR + ${PYTHON_SITE_PACKAGES_INSTALL_DIR}/pcsr +) + +IF (DEFINED VCPKG_INSTALLED_DIR) + # List `vcpkg` dependencies from VCPKG_INSTALLED_DIR so we can install them + # together with the python API. + FILE( + GLOB VCPKG_DEPENDENCIES + RELATIVE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/" + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/*" + ) +ENDIF() + +foreach (cymod rtcore rtcore_scene mesh_construction test_scene) + add_cython_target(${cymod} pyemblite/${cymod}.pyx) + add_library(${cymod} MODULE ${cymod}) + PYTHON_EXTENSION_MODULE(${cymod}) + target_link_libraries(${cymod} embree) + INSTALL( + TARGETS ${cymod} + RUNTIME_DEPENDENCIES + PRE_INCLUDE_REGEXES ${VCPKG_DEPENDENCIES} + PRE_EXCLUDE_REGEXES ".*" + DESTINATION pyemblite + ) +endforeach() + diff --git a/pyproject.toml b/pyproject.toml index b4e8192..8d4a94b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,23 @@ [build-system] -requires = ["setuptools", "Cython", "wheel", "numpy", "versioneer[toml]"] +requires = [ + "setuptools>=42", + "Cython", + "wheel", + "numpy", + "versioneer[toml]", + "scikit-build", + "cmake", + "ninja" +] build-backend = "setuptools.build_meta" +[project] +name = "pyemblite" +dependencies = [ + "numpy>=1.14.5" +] +dynamic = ["version"] + [tool.versioneer] VCS = "git" style = "pep440" diff --git a/setup.py b/setup.py index 0fbcf23..8c875df 100755 --- a/setup.py +++ b/setup.py @@ -1,53 +1,13 @@ -#!/usr/bin/env python -import os -import glob -import numpy as np -from setuptools import setup, Extension, find_packages -from Cython.Build import cythonize -import Cython -from distutils.version import LooseVersion +from skbuild import setup +from setuptools import find_packages import versioneer -include_path = [np.get_include(), ] -libs = ["embree3"] - -define_macros = [] -if LooseVersion(Cython.__version__) >= LooseVersion("3.0"): - # Gets rid of compiler warning: - # - # warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" - # - # But only for Cython version >= 3.0 - define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] - -extensions = \ - list( - [ - Extension( - "pyemblite." + os.path.splitext(os.path.split(pyx_file)[1])[0], - [pyx_file, ], - include_dirs=include_path, - libraries=libs, - define_macros=define_macros, - ) - for pyx_file in glob.glob(os.path.join("pyemblite", "*" + os.path.extsep + "pyx")) - ] - ) -ext_modules = cythonize(extensions, include_path=include_path, language_level=3) - setup( name="pyemblite", version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), - ext_modules=ext_modules, zip_safe=False, packages=find_packages(), - package_data={'pyemblite': ['*.pxd']}, - install_requires=[ - "numpy>=1.7", - ], - setup_requires=[ - "numpy>=1.7", - "cython" - ] + # package_data={}, + cmake_with_sdist=True ) diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..35634b0 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,6 @@ +{ + "dependencies": [ + "tbb", + "embree3" + ] +} From 1357d0aec50ea1ad113f1598251a975ed5dd4113 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 11:31:07 +1100 Subject: [PATCH 2/8] Tweak to .github/workflows/python-test.yml to install scikit-build. --- .github/workflows/python-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 8264343..22b0e11 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -30,9 +30,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install numpy cython setuptools wheel 'versioneer[toml]' flake8 pytest + python -m pip install numpy cython setuptools scikit-build wheel 'versioneer[toml]' flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python -m pip install --user --no-deps --no-build-isolation . + python -m pip install --user . - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names From ae7e7dd9e053af657ca3d6396c3da6a924dac0f2 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 12:14:07 +1100 Subject: [PATCH 3/8] Fix in .github/workflows/python-test-vcpkg.yml, remove erroneous listing of 'models'. --- .github/workflows/python-test-vcpkg.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-test-vcpkg.yml b/.github/workflows/python-test-vcpkg.yml index 7de5109..516fba7 100644 --- a/.github/workflows/python-test-vcpkg.yml +++ b/.github/workflows/python-test-vcpkg.yml @@ -75,7 +75,6 @@ jobs: cd ~ echo $(pwd) python -c 'import os; import pyemblite; print(os.listdir(os.path.dirname(pyemblite.__file__)))' - python -c 'import os; import pyemblite; print(os.listdir(os.path.join(os.path.dirname(pyemblite.__file__), "models")))' python -c 'import pyemblite; print(f"pyemblite.__file__={pyemblite.__file__}"); print(dir(pyemblite))' - name: Test From 9c12ea845964e56e8437c305998797cae5c1fa98 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 13:45:17 +1100 Subject: [PATCH 4/8] Cast geometry id values to int32_t for return by pyemblite.rtcore_scene.EmbreeScene.run. --- pyemblite/rtcore_scene.pyx | 10 ++++++---- pyemblite/test.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pyemblite/rtcore_scene.pyx b/pyemblite/rtcore_scene.pyx index 346f8db..96d77ab 100644 --- a/pyemblite/rtcore_scene.pyx +++ b/pyemblite/rtcore_scene.pyx @@ -1,6 +1,7 @@ cimport cython cimport numpy as np from libcpp cimport bool +from numpy cimport int32_t import numpy as np import logging import numbers @@ -72,6 +73,7 @@ cdef class EmbreeScene: cdef np.ndarray[np.float32_t, ndim=1] u cdef np.ndarray[np.float32_t, ndim=1] v cdef np.ndarray[np.float32_t, ndim=2] Ng + cdef int32_t INVALID_GEOMETRY_ID=rtcg.RTC_INVALID_GEOMETRY_ID cdef rayQueryType query_type @@ -109,7 +111,7 @@ cdef class EmbreeScene: geomID = np.empty(nv, dtype="int32") else: intersect_ids = np.empty(nv, dtype="int32") - intersect_ids.fill(rtcg.RTC_INVALID_GEOMETRY_ID) + intersect_ids.fill(INVALID_GEOMETRY_ID) cdef rtcr.RTCIntersectContext ray_ctx rtcr.rtcInitIntersectContext( &ray_ctx) @@ -153,8 +155,8 @@ cdef class EmbreeScene: else: tfars[i] = ray_hit.ray.tfar else: - primID[i] = ray_hit.hit.primID - geomID[i] = ray_hit.hit.geomID + primID[i] = ray_hit.hit.primID + geomID[i] = ray_hit.hit.geomID u[i] = ray_hit.hit.u v[i] = ray_hit.hit.v tfars[i] = ray_hit.ray.tfar @@ -164,7 +166,7 @@ cdef class EmbreeScene: Ng[i, 2] = ray_hit.hit.Ng_z else: rtcOccluded1(self.scene_i, &ray_ctx, &(ray_hit.ray)) - intersect_ids[i] = ray_hit.hit.geomID + intersect_ids[i] = ray_hit.hit.geomID if do_dict_return: return {'u':u, 'v':v, 'Ng': Ng, 'tfar': tfars, 'primID': primID, 'geomID': geomID} diff --git a/pyemblite/test.py b/pyemblite/test.py index 3469f7b..34c5226 100644 --- a/pyemblite/test.py +++ b/pyemblite/test.py @@ -145,7 +145,7 @@ def tearDown(self): def test_intersect_simple(self): res = self.scene.run(self.origins, self.dirs) self.logger.info("res=%s", res) - self.assertTrue(np.all([0, 1, 1, -1] == res)) + self.assertSequenceEqual([0, 1, 1, -1], np.asarray(res).tolist()) def test_intersect_distance(self): self.logger.info("origins=%s", self.origins) From 49684a1b4a81988ce352a16f61858bbb30a31fc1 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 13:57:57 +1100 Subject: [PATCH 5/8] Add wheel building workflow .github/workflows/python-wheel-vcpkg.yml. --- .github/workflows/python-wheel-vcpkg.yml | 150 +++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/python-wheel-vcpkg.yml diff --git a/.github/workflows/python-wheel-vcpkg.yml b/.github/workflows/python-wheel-vcpkg.yml new file mode 100644 index 0000000..1abef11 --- /dev/null +++ b/.github/workflows/python-wheel-vcpkg.yml @@ -0,0 +1,150 @@ +name: Python Wheels (vcpkg build) + +on: + workflow_dispatch: + push: + tags: + - "v*.*.*" + +jobs: + + build_wheels: + name: ${{ github.workflow }} Python build wheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.10"] + + steps: + - uses: actions/checkout@v3 + + - name: Install OS tools + shell: bash + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + brew install autoconf automake libtool + fi + + - uses: lukka/get-cmake@latest + name: Install cmake and ninja (via get-cmake) + + - name: Restore artifacts, or setup vcpkg for building artifacts + uses: lukka/run-vcpkg@v11 + with: + # This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch. + vcpkgDirectory: '${{ runner.workspace }}/vcpkg' + # The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule. + vcpkgGitCommitId: "c8696863d371ab7f46e213d8f5ca923c4aef2a00" + # The vcpkg.json file, which will be part of cache key computation. + vcpkgJsonGlob: '**/vcpkg.json' + id: runvcpkg + + - name: Prints output of run-vcpkg's action. + run: | + echo "VCPKG_ROOT=${VCPKG_ROOT}" + echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.2 + + - name: Build wheels + shell: bash + run: | + echo "VCPKG_ROOT=${VCPKG_ROOT}" + python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_ENVIRONMENT_LINUX: "CMAKE_FETCH_VCPKG=ON" + # vcpkg does not support i686 nor aarch64 + CIBW_ARCHS: "auto64" + # Skip musllinux builds + CIBW_SKIP: "*-musllinux_*" + # CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" + CIBW_BUILD: "cp310-*" + # Don't repair macOS wheels + CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" + CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install cmake" + CIBW_BEFORE_ALL_LINUX: "/usr/bin/yum install --assumeyes --verbose zip unzip tar cmake" + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" + # Run the package tests using `pytest` + CIBW_TEST_COMMAND: "python -m pyemblite.test -fv" + + - uses: actions/upload-artifact@v4 + with: + # name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + name: cibw-wheels-${{ matrix.os }} + path: ./wheelhouse/*.whl + retention-days: 10 + + build_sdist: + name: Build python sdist + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + steps: + - uses: actions/checkout@v3 + + - uses: lukka/get-cmake@latest + name: Install cmake and ninja (via get-cmake) + + - name: Restore artifacts, or setup vcpkg for building artifacts + uses: lukka/run-vcpkg@v11 + with: + # This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch. + vcpkgDirectory: '${{ runner.workspace }}/vcpkg' + # The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule. + vcpkgGitCommitId: "c8696863d371ab7f46e213d8f5ca923c4aef2a00" + # The vcpkg.json file, which will be part of cache key computation. + vcpkgJsonGlob: '**/vcpkg.json' + id: runvcpkg + + - name: Prints output of run-vcpkg's action. + run: | + echo "VCPKG_ROOT=${VCPKG_ROOT}" + echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install sdist build dependencies + shell: bash + run: | + python -m pip install --upgrade pip + python -m pip install "setuptools>=42" "versioneer[toml]" "scikit-build" "cmake" "ninja" + + - name: Create python sdist + run: python setup.py sdist --formats=gztar,zip + + - name: Upload python sdist + uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: ./dist/* + + release: + name: Make a Release + needs: [build_sdist, build_wheels] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Download python sdist and wheels + uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: ./release_artifacts/ + merge-multiple: true + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: ./release_artifacts/* From 9d34560a8df12c12954f3b1f5b86e38ae9a72126 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 18:01:27 +1100 Subject: [PATCH 6/8] Update to README.rst. --- README.rst | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.rst b/README.rst index 437bb8a..e0a6c60 100644 --- a/README.rst +++ b/README.rst @@ -71,26 +71,26 @@ or from source directory:: cd pyemblite python -m pip install --no-deps --no-build-isolation --user . -If you're on windows, you need to have embree3 installed. -Use the most recent version, make sure you unzip the contents of the -zip file into a folder where the MS build tools can find them. +If you're on windows, you can use + `vcpkg `_ to manage non-python dependencies +(can also be used on Linux and MacOS): -You can always add the embree3 folder to your library and include path by changing the LIB and INCLUDE environment variables: +.. code-block:: console -``set INCLUDE="C:\Path\to\embree\include\dir:%INCLUDE%"`` + PS > git clone https://github.com/microsoft/vcpkg + PS > .\vcpkg\bootstrap-vcpkg.bat + PS > $Env:VCPKG_ROOT=$(Resolve-Path ./vcpkg) + PS > git clone git@github.com:Shane-J-Latham/pcsr.git + PS > cd pcsr + PS > python -m pip install --prefix=\path\to\install\root . -``set LIB="C:\Path\to\embree\lib\dir:%LIB%"`` - -You also still need to have build tools installed (some kind of C/C++ compiler). -One way to achieve this is to install Visual Studio Build tools. Visual studio +You also still need to have build tools installed (some kind of C/C++ compiler). +One way to achieve this is to install Visual Studio Build tools. Visual studio build tools likely require the installation of visual studio community edition first. -This link should (hopefully) get you started: - +This link should (hopefully) get you started: + https://visualstudio.microsoft.com/downloads/ -Finally, you'll need to manually copy the Embree3.dll from (standard path when installed) ``C:\Program Files\Intel\Embree3\bin`` -to ``C:\windows\system32`` and (if you are on windows as you likely are these days) also to ``C:\windows\sysWOW64`` . -That *should* do it... Requirements ============ From 6b61cdf0b9da0ea361c249c7cab45591d1ccf5d8 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 18:07:09 +1100 Subject: [PATCH 7/8] Tweak to README.rst. --- README.rst | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index e0a6c60..4a4ade0 100644 --- a/README.rst +++ b/README.rst @@ -59,23 +59,26 @@ Example:: Installation ============ -Install from latest github source:: +Install from latest github source: - python -m pip install --user setuptools cython wheel numpy 'versioneer[toml]' - python -m pip install --no-deps --no-build-isolation --user git+https://github.com/AppliedMathematicsANU/pyemblite.git#egg=pyemblite +.. code-block:: console + $ python -m pip install --user setuptools cython wheel numpy 'versioneer[toml]' + $ python -m pip install --no-deps --no-build-isolation --user git+https://github.com/AppliedMathematicsANU/pyemblite.git#egg=pyemblite -or from source directory:: +or from source directory: - python -m pip install --user setuptools cython wheel numpy 'versioneer[toml]' - git clone git@github.com:AppliedMathematicsANU/pyemblite.git - cd pyemblite - python -m pip install --no-deps --no-build-isolation --user . +.. code-block:: console -If you're on windows, you can use - `vcpkg `_ to manage non-python dependencies -(can also be used on Linux and MacOS): + $ python -m pip install --user setuptools cython wheel numpy 'versioneer[toml]' + $ git clone git@github.com:AppliedMathematicsANU/pyemblite.git + $ cd pyemblite + $ python -m pip install --no-deps --no-build-isolation --user . -.. code-block:: console + +If you're on windows, you can use `vcpkg `_ to +manage non-python dependencies (can also be used on Linux and MacOS): + +.. code-block:: powershell PS > git clone https://github.com/microsoft/vcpkg PS > .\vcpkg\bootstrap-vcpkg.bat @@ -84,6 +87,7 @@ If you're on windows, you can use PS > cd pcsr PS > python -m pip install --prefix=\path\to\install\root . + You also still need to have build tools installed (some kind of C/C++ compiler). One way to achieve this is to install Visual Studio Build tools. Visual studio build tools likely require the installation of visual studio community edition first. From 7d9a837fe7a018cc89fed2d1a8bca4d13337b5f9 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 6 Jan 2024 18:08:37 +1100 Subject: [PATCH 8/8] Another tweak to README.rst. --- README.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 4a4ade0..6011b14 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,10 @@ Python wrapper for Embree-3. Source code adapted from Quick Start =========== -Example:: +Example: + + +.. code-block:: python import numpy as np import trimesh