Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "deps/pybind11"]
path = deps/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "deps/polyscope"]
path = deps/polyscope
url = https://github.com/nmwsharp/polyscope.git
[submodule "deps/eigen"]
path = deps/eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "deps/nanobind"]
path = deps/nanobind
url = https://github.com/wjakob/nanobind
32 changes: 25 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
cmake_minimum_required(VERSION 3.15.0) # minimum imposed by scikit-build-core
project(polyscope LANGUAGES CXX)

# Default to release build
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 20)

## Gather dependencies

# Eigen
# == Eigen
set(EIGEN3_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/deps/eigen/")

# Recurse in to pybind
set(PYBIND11_NEWPYTHON ON)
add_subdirectory(deps/pybind11)
# == Nanobind
if (CMAKE_VERSION VERSION_LESS 3.18)
set(DEV_MODULE Development)
else()
set(DEV_MODULE Development.Module)
endif()

# We need polyscope
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# find python version to target for bindings
find_package(Python 3.9 COMPONENTS Interpreter ${DEV_MODULE} REQUIRED)

# recurse into nanobind
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/nanobind)

# == polyscope
add_subdirectory(deps/polyscope)

pybind11_add_module(polyscope_bindings
nanobind_add_module(polyscope_bindings
src/cpp/core.cpp
src/cpp/surface_mesh.cpp
src/cpp/point_cloud.cpp
Expand All @@ -25,6 +42,7 @@ pybind11_add_module(polyscope_bindings
src/cpp/floating_quantities.cpp
src/cpp/implicit_helpers.cpp
src/cpp/managed_buffer.cpp

src/cpp/imgui.cpp
src/cpp/implot.cpp

Expand Down
2 changes: 1 addition & 1 deletion deps/eigen
Submodule eigen updated from 4fd5d1 to d71c30
1 change: 1 addition & 0 deletions deps/nanobind
Submodule nanobind added at c5a3a3
1 change: 0 additions & 1 deletion deps/pybind11
Submodule pybind11 deleted from a2e59f
14 changes: 3 additions & 11 deletions src/cpp/camera_view.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
#include <pybind11/eigen.h>
#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>

#include "Eigen/Dense"

#include "polyscope/camera_view.h"
#include "polyscope/polyscope.h"

#include "utils.h"

namespace py = pybind11;
namespace ps = polyscope;


// clang-format off
void bind_camera_view(py::module& m) {
void bind_camera_view(nb::module_& m) {

// == Helper quantity classes

Expand All @@ -40,9 +32,9 @@ void bind_camera_view(py::module& m) {

// Static adders and getters
m.def("register_camera_view", &ps::registerCameraView,
py::arg("name"), py::arg("parameters"), "Register a camera view", py::return_value_policy::reference);
nb::arg("name"), nb::arg("parameters"), "Register a camera view", nb::rv_policy::reference);
m.def("remove_camera_view", &ps::removeCameraView, "Remove a camera view by name");
m.def("get_camera_view", &ps::getCameraView, "Get a camera view by name", py::return_value_policy::reference);
m.def("get_camera_view", &ps::getCameraView, "Get a camera view by name", nb::rv_policy::reference);
m.def("has_camera_view", &ps::hasCameraView, "Check for a camera view by name");

}
Expand Down
Loading
Loading