diff --git a/README.md b/README.md index dbadca6..4699024 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,21 @@ cmake .. make -j ``` +### Installing on Windows + +The usual CMake dance changes a little on Windows. Instead of using `make -j`, on Windows, CMake will produce a visual studio solution that you can use to build the project. The following procedure was tested on Windows 10 using Visual Studio 2022. + +1. Open the Remesher.sln solution in Visual Studio. +2. Build the `ALL_BUILD` project. +3. The `.pyd` file will be in `build/[Debug OR Release]`. Add this directory to your path. + +#### Troubleshooting + +- The `remesh` project needs to output a static library (`.lib`) but by default may output a dynamic library (`.dll`). To fix this, open the project properties and change `Configuration Properties > General > Configuration Type` to `Static Library (.lib)` and change `Configuration Properties > Advanced > Target File Extension` to `.lib`. +- The `pyremesh` project needs to find python on the path to build. The simplest (but probably wrong) way seems to be: disable the `python` execution alias in `System Settings > Manage App Execution Aliases` (OS settings, not visual studio). And then manually add a python executable to the system path. +- There is currently [a pybind11 bug](https://github.com/pybind/pybind11/issues/3459) that causes errors on debug builds. Simplest fix: build with a Release config. + + ### Setting the Path Once you built the project, a script `setpath.sh` will be copied to your build diff --git a/src/collapse_edges.h b/src/collapse_edges.h index 0873557..ef08066 100644 --- a/src/collapse_edges.h +++ b/src/collapse_edges.h @@ -2,9 +2,9 @@ #define COLLAPSE_EDGES - +#include "macros.h" #include - +BOTSCH_EXPORT void collapse_edges(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::VectorXi & feature, Eigen::VectorXd & high, Eigen::VectorXd & low); diff --git a/src/equalize_valences.h b/src/equalize_valences.h index 736deb1..f4dfc2a 100644 --- a/src/equalize_valences.h +++ b/src/equalize_valences.h @@ -2,9 +2,9 @@ #define EQUALIZE_VALENCES - +#include "macros.h" #include - +BOTSCH_EXPORT void equalize_valences(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::VectorXi & feature); diff --git a/src/macros.h b/src/macros.h new file mode 100644 index 0000000..1bc105b --- /dev/null +++ b/src/macros.h @@ -0,0 +1,5 @@ +#if defined(_MSC_VER) +# define BOTSCH_EXPORT __declspec(dllexport) +#else +# define BOTSCH_EXPORT +#endif \ No newline at end of file diff --git a/src/remesh_botsch.h b/src/remesh_botsch.h index 3ecb319..db41d71 100644 --- a/src/remesh_botsch.h +++ b/src/remesh_botsch.h @@ -2,26 +2,26 @@ #define REMESH_BOTSCH - +#include "macros.h" #include - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F,Eigen::VectorXd & target,int iters, Eigen::VectorXi & feature, bool project); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F,Eigen::VectorXd & target,int iters, Eigen::VectorXi & feature); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::VectorXd & target,int iters); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::VectorXd & target,int iters, bool project); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::VectorXd & target); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F, double target_double,int iters); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F, double target_double,int iters, bool project); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F, double target_double); - +BOTSCH_EXPORT void remesh_botsch(Eigen::MatrixXd & V,Eigen::MatrixXi & F); diff --git a/src/split_edges.h b/src/split_edges.h index 1dd9921..add30a2 100644 --- a/src/split_edges.h +++ b/src/split_edges.h @@ -2,9 +2,9 @@ #define SPLIT_EDGES - +#include "macros.h" #include - +BOTSCH_EXPORT void split_edges(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::MatrixXi & E0, Eigen::MatrixXi & uE, Eigen::VectorXi & EMAP0, std::vector> & uE2E,Eigen::VectorXd & high, Eigen::VectorXd & low,const std::vector & edges_to_split); diff --git a/src/split_edges_until_bound.h b/src/split_edges_until_bound.h index 13493b1..1d4de79 100644 --- a/src/split_edges_until_bound.h +++ b/src/split_edges_until_bound.h @@ -2,9 +2,9 @@ #define SPLIT_EDGES_UNTIL_BOUND - +#include "macros.h" #include - +BOTSCH_EXPORT void split_edges_until_bound(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::VectorXi & feature, Eigen::VectorXd & high, Eigen::VectorXd & low); diff --git a/src/tangential_relaxation.h b/src/tangential_relaxation.h index 40bb8fb..7b56971 100644 --- a/src/tangential_relaxation.h +++ b/src/tangential_relaxation.h @@ -2,9 +2,9 @@ #define TANGENTIAL_RELAXATION - +#include "macros.h" #include - +BOTSCH_EXPORT void tangential_relaxation(Eigen::MatrixXd & V,Eigen::MatrixXi & F, Eigen::VectorXi & feature, Eigen::MatrixXd & V0 ,Eigen::MatrixXi & F0, Eigen::VectorXd & lambda);