manifold-visualizer icon indicating copy to clipboard operation
manifold-visualizer copied to clipboard

Compilation with VS2022 on Windows10

Open chaosink opened this issue 2 years ago • 0 comments

After a few tries, I got a successful compilation and run on Windows10. Write the steps here which may be helpful to others.

  • The C++ source code of the manifolds project requires C++17. Add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") to line 24 of <path_to_project>\CMakeLists.txt.
  • Though C++17 is used, MSVC still cannot handle some code of the nanogui-python-obj project. We need Clang to compile it.
  • Add #define STB_IMAGE_IMPLEMENTATION before line 41 of <path_to_project>\ext\nanogui\src\example1.cpp.
    • We can skip this step because the example1 project is not required actually. It's only an example of nanogui.
  • Now the compilation should pass. Next, run the application.
  • Move <path_to_project>\build\ext\nanogui\Release\nanogui.cp39-win_amd64.pyd to its upper directory.
  • Set the environment variable
    • Powershell: $env:PYTHONPATH="<path_to_project>\build\Release;<path_to_project>\build\ext\nanogui\Release;$env:PYTHONPATH"
    • Command Prompt: set PYTHONPATH="<path_to_project>\build\Release;<path_to_project>\build\ext\nanogui\Release;%PYTHONPATH%"
  • python <path_to_project>/python/viewer.py

chaosink avatar Sep 14 '22 17:09 chaosink