How to recompile "hrtf_mesh_grading", in case the compiled Windows binaries from Here are obsolete or not working
Tutorial Status | Date Written | Date Last Updated |
---|---|---|
Complete. | 2022-10-29 | 2022-10-29 |
Note, "hrtf_mesh_grading" is native for Linux so the original instructions are valid for these platforms: https://github.com/cg-tub/hrtf_mesh_grading#getting-started .
To re-compile hrtf_mesh_grading.exe use any MinGW 64bit compiler. This method uses MSYS2 version of MinGW64 compiler, but there are also other valid approaches to use MinGW compiler variants on Windows.
Sidenote MSYS2 is also used to compile NumCalc.exe for Mesh2HRTF.
Go to https://www.msys2.org and get the MSYS2 by following the excellent Installation instructions on the front-page.
First run the Windows Installer using simple GUI.
Then Update everything using pacman within “MSYS2 MSYS.exe” by pasting-in the following commands (answer “Y” or just hit Enter key on all prompts). Tip: re-run all update commands more than once until it says that there is nothing more to update.:
pacman -Syu
(Update the package database and base packages.)
pacman -Su
(Update the rest of the base packages)
Install the MinGW with GCC needed for NumCalc compiling:
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
Close “MSYS2 MSYS.exe”
To make "hrtf_mesh_grading" source code (as of 2022-10) compile on Windows, it is required to comment-out some compiling instructions that cause problems:
1- In the “..\hrtf_mesh_grading\pmp-library\src\apps\CMakeLists.txt” change
# build mconvert only on unix / OS-X
if(NOT WIN32)
add_executable(hrtf_mesh_grading hrtf-mesh-grading.cpp)
target_link_libraries(hrtf_mesh_grading pmp)
add_executable(mconvert mconvert.cpp)
target_link_libraries(mconvert pmp)
endif()
to
# build mconvert, always
# if(NOT WIN32)
add_executable(hrtf_mesh_grading hrtf-mesh-grading.cpp)
target_link_libraries(hrtf_mesh_grading pmp)
add_executable(mconvert mconvert.cpp)
target_link_libraries(mconvert pmp)
# endif()
2- In the “..\hrtf_mesh_grading\pmp-library\external\rply\CMakeLists.txt” change
add_compile_options(/wd4700)
to
# add_compile_options(/wd4700)
3- in the “..\hrtf_mesh_grading\pmp-library\CMakeLists.txt” change
add_compile_options(/wd4267) # conversion from size_t
add_compile_options(/wd4244) # conversion from double to float
add_compile_options(/wd4305) # truncation from double to float
to
# add_compile_options(/wd4267) # conversion from size_t
# add_compile_options(/wd4244) # conversion from double to float
# add_compile_options(/wd4305) # truncation from double to float
Open “MSYS2 MinGW 64-bit.exe” that you just installed and proceed to compile NumCalc.exe:
cd C:
cd path/on/drive/C:/WhereYouHave/hrtf_mesh_grading/pmp-library
mkdir build
cd build
cmake .. -G "MSYS Makefiles"
Compiling is initiated using the normal Linux make command:
make
In the "build" folder you should have several .exe files ready , but there are a few steps left before running the simulation.
To make your "hrtf_mesh_grading.exe" work some additional DLL files need to be copied from MSYS2 distribution. (Note, it is somehow possible to include all the necessary DLLs into .exe file during compilation, but this method works too):
Move the relevant compiled files to a folder where you will use it, for example to “C:\hrtf_mesh_grading_WindowsExe\bin\” (like here: https://sourceforge.net/p/mesh2hrtf-tools/code/ci/master/tree/hrtf_mesh_grading_WindowsExe/bin/ ). Relevant files are:
Try running “mpview.exe”. Most likely you will get "............... .dll not found" error which means that it needs some .dll files in the same folder as hrtf_mesh_grading.exe to run. You can find all the missing .dll files in the C:\msys64\mingw64\bin
folder. Just copy the files with the right name into the “..\hrtf_mesh_grading_WindowsExe\bin\” folder. Most likely the needed DLLs are:
When everything is correct, if you double-click “mpview.exe” it will open a GUI and remain open - it means everything is working and ready to be used.
Done