Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reach for the arcs #121

Merged
merged 45 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
664a4ba
Adding Poisson surface reconstruction bindings
odedstein Apr 18, 2024
8b5f040
typos
sgsellan Apr 25, 2024
a615d72
stochastic psr rework, fixed test
sgsellan Apr 25, 2024
1b5154b
integrating Reach for the Arcs
odedstein May 29, 2024
4a57331
testing wheels dependency that is missing
sgsellan May 31, 2024
57d5bb7
windows include?
sgsellan May 31, 2024
b5e787b
include fix
sgsellan May 31, 2024
d41cc55
defining M_PI on windows as well
odedstein May 31, 2024
970ca92
did I need this?
sgsellan May 31, 2024
83f0c27
how about just this one library
sgsellan May 31, 2024
888ae7a
ah, forgot the '-y'
sgsellan Jun 1, 2024
63ac418
more dependencies
sgsellan Jun 1, 2024
6054889
capitalization...
sgsellan Jun 1, 2024
2794ee7
test
sgsellan Jun 1, 2024
c57fdfb
more dependencies...
sgsellan Jun 1, 2024
f113d31
weird linux error
sgsellan Jun 1, 2024
d2e469e
cleaned up wheels, still erroring?
sgsellan Jun 1, 2024
706eeae
dumb bug
sgsellan Jun 1, 2024
8674c99
same error
sgsellan Jun 1, 2024
bada204
linux specific iunstructions?
sgsellan Jun 1, 2024
33375da
disambiguiated..
sgsellan Jun 1, 2024
740d083
nevermind...
sgsellan Jun 1, 2024
11cf7c5
changing manylinux image
sgsellan Jun 1, 2024
0d8f7fe
latest 2014 manylinux image?
sgsellan Jun 1, 2024
a997d97
2010 wheels
sgsellan Jun 1, 2024
e4ae3a2
manylinux_2_
sgsellan Jun 1, 2024
ebdef21
apt get instead of yum?
sgsellan Jun 1, 2024
b46bda2
now? package manager
sgsellan Jun 1, 2024
b938be5
apt get?
sgsellan Jun 1, 2024
f7be30a
whoops
sgsellan Jun 1, 2024
f956f06
back to yum
sgsellan Jun 1, 2024
8b87b44
dnf?
sgsellan Jun 1, 2024
71faf2c
apt-get with proper source
sgsellan Jun 1, 2024
e897ce9
back to after fixing dependencies...
sgsellan Jun 1, 2024
3d8188c
auditwheel
sgsellan Jun 1, 2024
f1ffd4f
correct cibw placeholder
sgsellan Jun 1, 2024
2ca974c
without auditwheel-symbols
sgsellan Jun 1, 2024
ed96f06
jic
sgsellan Jun 1, 2024
4ddf997
trying old webgpu?
sgsellan Jun 1, 2024
374851f
back to diagnosing
sgsellan Jun 1, 2024
a669062
manylinux version?
odedstein Jun 1, 2024
2b489e2
typo
odedstein Jun 1, 2024
5d33d2c
Merge branch 'main' into reach_for_the_arcs
odedstein Jun 2, 2024
c121fa0
resolving conflict correctly
odedstein Jun 2, 2024
b7e08b3
nonmanifoldness check in rfts
sgsellan Jun 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 12 additions & 139 deletions .github/workflows/ciwheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,80 +31,38 @@ jobs:
path: dist/*.tar.gz

build_wheels:

# Only run if the commit message contains '[ci build]' OR always run if it's a tag
# This will not respect the tag if it appears in a pull request commit message. Those builds always show up as 'synchronize' events, and there is no easy way to get the corresponding commit messages. We instead pull the PR title to check for tags.
# More info here: https://github.community/t/accessing-commit-message-in-pull-request-event/17158/13
# if: "contains(toJSON(github.event.commits.*.message), '[ci build]') || contains(toJSON(github.event.pull_request.title), '[ci build]') || contains(github.ref, 'refs/tags')"

strategy:
fail-fast: false
matrix:
# Launch separate job for each python. The build is so much longer than
# machine configuration/setup, so parallel builds will be faster. More
# importantly, github times out after 6 hours _per job_.

# debugging
# cpversion: [ "cp39"]
# os: [ { runs-on: ubuntu-latest, cibw-arch: manylinux_x86_64}]
cpversion: ["cp36", "cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]
os: [ { runs-on: ubuntu-latest, cibw-arch: manylinux_x86_64}, { runs-on: macos-latest, cibw-arch: macosx_x86_64}, { runs-on: macos-latest, cibw-arch: macosx_arm64}, { runs-on: windows-latest, cibw-arch: win_amd64} ]
# cpversion: ["cp36"]
# os: [ { runs-on: windows-latest, cibw-arch: win_amd64}]
exclude:
- os: { runs-on: macos-latest, cibw-arch: macosx_arm64}
cpversion: "cp36"
- os: { runs-on: macos-latest, cibw-arch: macosx_arm64}
cpversion: "cp37"



name: Build wheels ${{ matrix.cpversion }}-${{ matrix.os.cibw-arch }}
runs-on: ${{ matrix.os.runs-on }}


env:
CIBW_BUILD_VERBOSITY: 3
# This is very dubious... It *may* work because these are just cpp libraries that should not depend on the python version. Still, super-dubious.
# CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install delvewheel; $rootPath = Join-Path -Path (Get-Location) -ChildPath 'build'; $folders = Get-ChildItem -Path $rootPath -Recurse -Directory; foreach ($folder in $folders) { $env:Path += \";$($folder.FullName)\" }"

# CIBW_BEFORE_BUILD_WINDOWS: |
# python .github/workflows/update-path.py
# python -m pip install delvewheel
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: |
# python .github/workflows/update-path.py
# python -m delvewheel repair --no-mangle-all -w {dest_dir} {wheel}
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "python -m delvewheel repair --no-mangle-all --add-path build\\temp.win-amd64-3.6\\Release;build\\temp.win-amd64-3.6\\Release\\Release;build\\temp.win-amd64-3.6\\Release\\_deps\\gmp-src\\lib;build\\temp.win-amd64-3.6\\Release\\_deps\\mpfr-src\\lib -w {dest_dir} {wheel} "
# CIBW_TEST_COMMAND_WINDOWS: "python -m pip install tetgen && cd /d {project} && python -m unittest -v"
# CIBW_TEST_COMMAND_MACOS: "python -m pip install tetgen && cd {project} && python -m unittest -v"
# CIBW_TEST_COMMAND_LINUX: "python -m pip install tetgen && cd {project} && python -m unittest -v"
# CIBW_TEST_COMMAND: "python -m pip install tetgen && python -m unittest -v"
# CIBW_BEFORE_BUILD_LINUX : "yum remove -y cmake && python -m pip install\ cmake && yum -y install gmp-devel\ mpfr-devel && python -m pip install numpy"
CIBW_BEFORE_BUILD_LINUX: "yum install -y libXrandr libXrandr-devel libXinerama libXinerama-devel libXcursor libXcursor-devel libXi libXi-devel && python -m pip install auditwheel-symbols"
# CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel-symbols --manylinux 2_28 {wheel} && auditwheel repair --plat manylinux_2_28_x86_64 -w {dest_dir} {wheel}"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --plat manylinux_2_28_x86_64 -w {dest_dir} {wheel}"
CIBW_MANYLINUX_X86_64_IMAGE: 'manylinux_2_28'
# # CIBW_BEFORE_BUILD_LINUX: "dnf install -y libXrandr libXrandr-devel libXinerama libXinerama-devel libXcursor libXcursor-devel libXi libXi-devel"
# # CIBW_BEFORE_BUILD_LINUX: "apt-get update && apt-get install -y libxrandr2 libxrandr-dev libxinerama1 libxinerama-dev libxcursor1 libxcursor-dev libxi6 libxi-dev"
# CIBW_BEFORE_BUILD_LINUX: "sed -i 's|http://deb.debian.org/debian|https://archive.debian.org/debian|g' /etc/apt/sources.list && sed -i 's|http://security.debian.org/debian-security|https://archive.debian.org/debian-security|g' /etc/apt/sources.list && apt-get update && apt-get install -y libxrandr2 libxrandr-dev libxinerama1 libxinerama-dev libxcursor1 libxcursor-dev libxi6 libxi-dev"

# CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64:latest
# CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_28_x86_64:latest"
# CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux_2_28_i686:latest
CIBW_BUILD: "${{ matrix.cpversion }}-${{ matrix.os.cibw-arch }}"
# CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_ENVIRONMENT: "MAX_JOBS=2"
# Why universal2 here? It's not included above in CIBW_BUILD
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
CIBW_ENVIRONMENT_MACOS: "CMAKE_OSX_ARCHITECTURES=\"${{ matrix.os.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.os.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.os.cibw-arch == 'macosx_universal2' && 'arm64;x86_64' || '' }}\""
MACOSX_DEPLOYMENT_TARGET: 10.16
# CIBW_PRERELEASE_PYTHONS: True


# env:
# CIBW_BUILD: "${{ matrix.cpversion }}-${{ matrix.os.cibw-arch }}"
# # CIBW_BUILD: cp37-*
# CIBW_BUILD_VERBOSITY: 3
# CIBW_ENVIRONMENT: "MAX_JOBS=2"
# CIBW_BEFORE_BUILD_LINUX : "yum remove -y cmake && python -m pip install\ cmake && yum -y install gmp-devel\ mpfr-devel && python -m pip install numpy"
# # CIBW_BEFORE_BUILD_MACOS: "python -m pip install cython numpy"
# CIBW_BEFORE_BUILD_MACOS: "python -m pip install numpy"
# CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install numpy && python -m pip install delvewheel"
# # This is very dubious... It *may* work because these are just cpp libraries that should not depend on the python version. Still, super-dubious.
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "python -m delvewheel repair --no-mangle-all --add-path build\\temp.win-amd64-3.6\\Release;build\\temp.win-amd64-3.6\\Release\\Release;build\\temp.win-amd64-3.6\\Release\\_deps\\gmp-src\\lib;build\\temp.win-amd64-3.6\\Release\\_deps\\mpfr-src\\lib -w {dest_dir} {wheel} "
# # CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "cd C: && cmd //c tree //F"
# # CIBW_SKIP: "*-win32 *-manylinux_i686 pp*"
# MACOSX_DEPLOYMENT_TARGET: 10.15


steps:
- uses: actions/checkout@v3
Expand All @@ -114,94 +72,9 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]


# - uses: actions/setup-python@v4
# name: Install Python
# with:
# python-version: '3.7'

# - name: Install cibuildwheel
# run: |
# python -m pip install --upgrade pip
# python -m pip install cibuildwheel==2.16

# - name: Add build subdirectories to PATH
# shell: pwsh
# if: runner.os == 'Windows'
# run: |
# $folder = "build"
# Get-ChildItem -Path $folder -Directory -Recurse | ForEach-Object {
# $env:Path += ";$($_.FullName)"
# }


# - name: Test
# run: |
# python -m pip install .

# - name: Configure cibuildwheel
# shell: bash
# run: |
# CMAKE_ARCH="${{ matrix.cibw-arch == 'win32' && '-A Win32' || '' }}"
# CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.cibw-arch == 'macosx_universal2' && '"arm64;x86_64"' || '' }}
# echo "CIBW_ARCHS_MACOS=x86_64 arm64 universal2" >> $GITHUB_ENV
# echo "CIBW_BUILD=${{ matrix.cpversion }}-${{ matrix.cibw-arch }}" >> $GITHUB_ENV
# echo "CIBW_ENVIRONMENT_MACOS=CMAKE_OSX_ARCHITECTURES=\"$CMAKE_OSX_ARCHITECTURES\"" >> $GITHUB_ENV

# This shouldn't be necessary
# - name: Install dependencies (Ubuntu)
# shell: bash -l {0}
# if: runner.os == 'Linux'
# run: |
# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install \
# libmpfr-dev \
# libgmp-dev \

# - name: Package source distribution
# if: runner.os == 'Linux'
# run: |
# python setup.py sdist -d wheelhouse --formats=gztar

# - name: Build wheels
# run: |
# python -m cibuildwheel --output-dir wheelhouse


# - name: Fix Windows wheels
# run: |
# python -m pip install delvewheel
# cd wheelhouse
# ls
# delvewheel repair *.whl
# python -m delvewheel repair *.whl

# Upload binaries to github
- uses: actions/upload-artifact@v3
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: |
./wheelhouse/*.whl
./wheelhouse/*.tar.gz
# # Push the resulting binaries to pypi on a tag starting with 'v'
# upload_pypi:
# needs: [build_wheels]
# runs-on: ubuntu-latest
# # upload to PyPI on every tag starting with 'v'
# # if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# # alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: artifact
# path: dist

# - uses: pypa/[email protected]
# with:
# user: __token__
# password: ${{ secrets.pypi_password }}
# skip_existing: true
# # To test: repository_url: https://test.pypi.org/legacy/
./wheelhouse/*.tar.gz
45 changes: 44 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,29 @@ endif()
option(LIBIGL_COPYLEFT_CGAL "Use CGAL" ON)
option(LIBIGL_EMBREE "Build target igl::embree" ON)
include(libigl)
igl_include(glfw)
igl_include(embree)

# Include PoissonRecon
include(PoissonRecon)
add_library(PoissonRecon INTERFACE)
target_include_directories(PoissonRecon INTERFACE "${CMAKE_BINARY_DIR}/_deps/poissonrecon-src/Src/")

# Include nanoflann
include(nanoflann)

# Include webgpu
include(webgpu)
include(glfw3webgpu)
if(TARGET webgpu AND TARGET glfw3webgpu)
add_compile_definitions(GL_AVAILABLE)
set(GL_LIBS webgpu glfw3webgpu)
else()
set(GL_LIBS "")
endif()

# List of all libraries to link
set(LIBRARIES_TO_LINK igl::core igl::embree PoissonRecon)
set(LIBRARIES_TO_LINK igl::core igl::embree nanoflann PoissonRecon ${GL_LIBS})
set(COPYLEFT_LIBRARIES_TO_LINK igl::core igl_copyleft::cgal)

add_library(cpytoolbox
Expand All @@ -47,6 +62,11 @@ add_library(cpytoolbox
src/cpp/read_obj.h
src/cpp/write_obj.h
src/cpp/point_cloud_to_mesh.h
src/cpp/reach_for_the_arcs/outside_points_from_rasterization.h
src/cpp/reach_for_the_arcs/locally_make_feasible.h
src/cpp/reach_for_the_arcs/fine_tune_point_cloud_iter.h
src/cpp/reach_for_the_arcs/sAABB.h
src/cpp/reach_for_the_arcs/resolve_collisions_on_sphere.h
src/cpp/remesher/collapse_edges.h
src/cpp/remesher/equalize_valences.h
src/cpp/remesher/remesh_botsch.h
Expand All @@ -62,6 +82,11 @@ add_library(cpytoolbox
src/cpp/read_obj.cpp
src/cpp/write_obj.cpp
src/cpp/point_cloud_to_mesh.cpp
src/cpp/reach_for_the_arcs/outside_points_from_rasterization.cpp
src/cpp/reach_for_the_arcs/locally_make_feasible.cpp
src/cpp/reach_for_the_arcs/fine_tune_point_cloud_iter.cpp
src/cpp/reach_for_the_arcs/sAABB.cpp
src/cpp/reach_for_the_arcs/resolve_collisions_on_sphere.cpp
src/cpp/remesher/collapse_edges.cpp
src/cpp/remesher/equalize_valences.cpp
src/cpp/remesher/remesh_botsch.cpp
Expand Down Expand Up @@ -120,6 +145,9 @@ pybind11_add_module(gpytoolbox_bindings
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/binding_write_ply.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/binding_curved_hessian_intrinsic.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/binding_point_cloud_to_mesh.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/reach_for_the_arcs/binding_outside_points_from_rasterization.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/reach_for_the_arcs//binding_locally_make_feasible.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/reach_for_the_arcs//binding_fine_tune_point_cloud_iter.cpp"
)

pybind11_add_module(gpytoolbox_bindings_copyleft
Expand All @@ -145,3 +173,18 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
COMMAND_EXPAND_LISTS)
endif()

# Manually copy wgpu to the right place
target_copy_webgpu_binaries(gpytoolbox_bindings)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Extra difficult on mac.
add_custom_command(
TARGET gpytoolbox_bindings POST_BUILD
COMMAND
${CMAKE_INSTALL_NAME_TOOL} "-change"
"@executable_path/libwgpu_native.dylib"
"$<TARGET_FILE_DIR:gpytoolbox_bindings>/libwgpu_native.dylib"
"$<TARGET_FILE:gpytoolbox_bindings>"
VERBATIM
)
endif()

12 changes: 12 additions & 0 deletions LICENSE.MIT
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ and modifications by AxisMaps (https://colorbrewer2.org)

This software contains code written by Michael Kazhdan (Johns Hopkins University) for PoissonRecon, also released
under the MIT license (see https://github.com/mkazhdan/PoissonRecon/blob/master/LICENSE)

========================

This software includes, during its compilation step, BSD2-Licensed code from nanoflann (github.com/jlblancoc/nanoflann).

========================

This software includes, during its compilation step, MIT-Licensed code from https://github.com/eliemichel/WebGPU-Cpp and https://github.com/eliemichel/LearnWebGPU-Code by Elie Michel
This repository contains a code snippet from https://stackoverflow.com/a/76726123

=======

11 changes: 11 additions & 0 deletions cmake/glfw3webgpu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if(TARGET glfw3webgpu)
return()
endif()

include(FetchContent)
FetchContent_Declare(
glfw3webgpu
GIT_REPOSITORY https://github.com/eliemichel/glfw3webgpu.git
GIT_TAG e4cd9131c7472b000641a104116c2fecf13d55a7
)
FetchContent_MakeAvailable(glfw3webgpu)
11 changes: 11 additions & 0 deletions cmake/nanoflann.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if(TARGET nanoflann)
return()
endif()

include(FetchContent)
FetchContent_Declare(
nanoflann
GIT_REPOSITORY https://github.com/jlblancoc/nanoflann.git
GIT_TAG e0a985204e999a2caed0fdbb71ee8c556621a4f3
)
FetchContent_MakeAvailable(nanoflann)
11 changes: 11 additions & 0 deletions cmake/webgpu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if(TARGET webgpu)
return()
endif()

include(FetchContent)
FetchContent_Declare(
webgpu
GIT_REPOSITORY https://github.com/eliemichel/WebGPU-distribution.git
GIT_TAG 9dd47f8515dfd7112b750da07e719460a88bf2e8
)
FetchContent_MakeAvailable(webgpu)
7 changes: 7 additions & 0 deletions src/cpp/gpytoolbox_bindings_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ void binding_read_ply(py::module& m);
void binding_write_ply(py::module& m);
void binding_curved_hessian_intrinsic(py::module& m);
void binding_point_cloud_to_mesh(py::module& m);
void binding_outside_points_from_rasterization(py::module& m);
void binding_outside_points_from_rejection_sampling(py::module& m);
void binding_locally_make_feasible(py::module& m);
void binding_fine_tune_point_cloud_iter(py::module& m);

PYBIND11_MODULE(gpytoolbox_bindings, m) {

Expand All @@ -50,6 +54,9 @@ PYBIND11_MODULE(gpytoolbox_bindings, m) {
binding_write_ply(m);
binding_curved_hessian_intrinsic(m);
binding_point_cloud_to_mesh(m);
binding_outside_points_from_rasterization(m);
binding_locally_make_feasible(m);
binding_fine_tune_point_cloud_iter(m);

m.def("help", [&]() {printf("hi"); });
}
Expand Down
Loading
Loading