manifold-visualizer
manifold-visualizer copied to clipboard
Compilation with VS2022 on Windows10
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. Addset(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.- Install Clang: Clang/LLVM support in Visual Studio projects
- Use Clang for the
nanogui-python-obj
project: Configure a Windows project to use Clang tools
- 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 ofnanogui
.
- We can skip this step because the
- 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%"
- Powershell:
-
python <path_to_project>/python/viewer.py