How to Build AutoRemesher on Windows: Complete Step-by-Step Guide
Build AutoRemesher on Windows by installing Visual Studio 2022, CMake, and Qt 5.15.2, then compiling the bundled Intel TBB library, generating Qt makefiles with qmake, and invoking nmake to produce release\autoremesher.exe.
AutoRemesher is a cross-platform C++ application for automatic mesh remeshing that uses Qt for its GUI and Intel TBB for threading. According to the huxingyi/autoremesher repository source code, the Windows build process requires specific toolchain configurations and third-party library compilation before the main application can link successfully.
Prerequisites
Before starting, ensure your development environment includes the correct toolchain versions. The build system relies on specific MSVC compiler features and Qt modules.
- Visual Studio 2022 with the Desktop development with C++ workload (provides
cl,nmake, and the Windows SDK) - CMake (required to compile the bundled TBB library)
- Qt 5.15.2 (specifically the
msvc2019_64package)
Add CMake and Qt to your system PATH so that cmake.exe and qmake.exe are accessible from the command line (e.g., C:\Qt\5.15.2\msvc2019_64\bin).
Step-by-Step Build Instructions
1. Open the Visual Studio Command Prompt
Launch the x64 Native Tools Command Prompt for VS 2022 from the Start menu. This environment sets up the necessary variables for the MSVC toolchain, ensuring the compiler and linker are available.
2. Build Intel TBB
AutoRemesher bundles Intel TBB under thirdparty/tbb and must compile it as a shared library before linking. Navigate to the TBB directory and run CMake with specific flags to disable unnecessary components:
cd thirdparty\tbb
cmake -B build2 ^
-DTBB_BUILD_SHARED=ON ^
-DTBB_BUILD_STATIC=OFF ^
-DTBB_BUILD_TBBMALLOC=OFF ^
-DTBB_BUILD_TBBMALLOC_PROXY=OFF ^
-DTBB_BUILD_TESTS=OFF
cmake --build build2 --config Release
cd ..\..
This produces thirdparty\tbb\build2\Release\tbb.dll and the corresponding import library that the main project references in autoremesher.pro under the win32 block.
3. Generate Qt Project Files
Use qmake with the Windows-specific specification to generate the Makefile (actually an NMake file):
qmake -spec win32-msvc
The autoremesher.pro file contains the platform-specific configuration for this step, including the win32 block that adds winextras when available and defines PLATFORM = "Win32". It also includes Windows-specific compiler flags like /bigobj and /MP.
4. Configure Parallel Compilation
Enable MSVC parallel compilation to speed up the build process:
set CL=/MP
This flag instructs the compiler to process multiple source files simultaneously.
5. Compile the Application
Invoke nmake using the Release configuration:
nmake -f Makefile.Release
The autoremesher.pro file defines the Release build flags as /O2 /GL /Qpar /fp:fast, enabling link-time optimization (/GL), aggressive parallel compilation (/Qpar), and fast floating-point mode (/fp:fast). The resulting binary is placed at release\autoremesher.exe.
6. Run the Executable
You can now launch the application from the command line:
release\autoremesher.exe --help
The executable supports both GUI mode and CLI mode for headless processing, accepting arguments like --input, --output, --target-quads, and --sharp-edge.
Architecture Overview
Understanding the project structure helps troubleshoot build issues and customize the compilation.
Qt Core Modules – The project file includes QT += core widgets opengl and conditionally adds openglwidgets for Qt 6 compatibility. The win32 block adds winextras and links against -luser32 and -lopengl32.
Threading Layer – AutoRemesher links against the TBB library compiled in step 2 via -ltbb in the win32 block of autoremesher.pro.
Geometry Processing – The core remeshing algorithms reside in thirdparty/geogram/ and thirdparty/isotropicremesher/, with include paths set in autoremesher.pro (INCLUDEPATH += thirdparty/geogram/...).
Source Organization – The main remeshing logic lives in src/AutoRemesher/autoremesher.cpp and src/AutoRemesher/isotropicremesher.cpp, while the Qt GUI is assembled from src/mainwindow.cpp, src/graphicswidget.cpp, and other widget classes under src/.
Summary
- Install Visual Studio 2022, CMake, and Qt 5.15.2 (
msvc2019_64) before building. - Compile the bundled Intel TBB library in
thirdparty/tbbusing CMake to producetbb.dll. - Generate makefiles with
qmake -spec win32-msvcfrom the Visual Studio Command Prompt. - Enable parallel compilation with
set CL=/MPto reduce build times. - Build the Release binary using
nmake -f Makefile.Release, which outputsrelease\autoremesher.exe. - The
autoremesher.profile controls all platform-specific settings, compiler flags, and library linking for Windows.
Frequently Asked Questions
What compiler version does AutoRemesher require on Windows?
AutoRemesher requires the MSVC 2019 or 2022 compiler included with Visual Studio 2022. The autoremesher.pro file specifies win32-msvc and uses flags like /bigobj and /MP that are specific to the Microsoft compiler toolchain. While MinGW might work with modifications, the official build instructions and project configuration target the native Visual Studio compiler.
Why do I need to build TBB separately instead of using a prebuilt binary?
The repository bundles TBB source code under thirdparty/tbb and links against it via -ltbb in the win32 block of autoremesher.pro. Building from source ensures ABI compatibility with your specific MSVC version and allows the project to control build flags. The CMake configuration explicitly disables unnecessary components (TBBMalloc, tests) to reduce compile time and binary size.
Can I build AutoRemesher with Qt 6 instead of Qt 5.15.2?
Yes, with minor modifications. The autoremesher.pro file contains a conditional block greaterThan(QT_MAJOR_VERSION, 5): QT += openglwidgets that handles the OpenGL widget module relocation in Qt 6. However, the primary development and testing target is Qt 5.15.2, so Qt 6 builds may require additional adjustments to the win32 configuration blocks.
How do I run AutoRemesher in command-line mode without the GUI?
After building release\autoremesher.exe, invoke it from the command prompt with the --input and --output arguments. The entry point in src/main.cpp parses CLI arguments and supports headless operation for batch processing, allowing you to specify parameters like --target-quads and --sharp-edge directly without launching the GUI window.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →