Performed steps
I'm using Visual Studio 2019 and it's CMake toolchain for windows
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="C:\workspace\Codes\openPMD-api\install\Win" -DopenPMD_USE_MPI:STRING="OFF" -DopenPMD_USE_HDF5:STRING="ON" -DopenPMD_USE_PYTHON:STRING="OFF" -DopenPMD_INSTALL:STRING="ON"
and
cmake --build .
led to the following output/problem during install
C:\workspace\Codes\openPMD-api\include\openPMD\IO\AbstractIOHandler.hpp(29): fatal error C1083: Cannot open include file: 'mpi.h': No such file or directory
(And many other files like this)
System environment
I'm trying to install openPMD on Windows using the Visual Studio IDE, which is usually very convenient to set up CMake installations.
Even though I specified openPMD_USE_MPI=OFF, which works during the prebuild phase since it never tries to find the MPI module, then I saw that in the actual code I get openPMD_HAVE_MPI=1, so it tries to include mpi.h, which I don't have.
I found a workaround that let me build and install it by adding
add_compile_definitions(openPMD_HAVE_MPI=0)
in the appropriate lines (146 of the latest dev branch) of the CMakeLists.txt'.
My guess is that eventually the
```
set(openPMD_HAVE_MPI FALSE)
````
command doesn't result in a defined variable in the code when using the Microsoft compiler so in theconfig.hpp` file it force-defines it to be 1.
Anyway, I could make it build using the workaround, but I'm not sure if I was doing something wrong instead.
Thank you!
Hi @titoiride,
Thanks for checking and reporting this! Please excuse the delay in answering, due to a deadline that occupied me last week.
I cannot reproduce this locally yet. Can we try to dig deeper?
Can you add a message(STATUS "+++++ ${openPMD_HAVE_MPI} +++++") before the configure_file call here?
https://github.com/openPMD/openPMD-api/blob/04d50c8c7f9793fb1e7829000411a48309d220f2/CMakeLists.txt#L836-L840
What does that line print?
We can also look together into this via Zoom (see Slack ping).
After resetting Visual Studio and re-cloning openPMD, I couldn't reproduce the issue.
It must have been some messed up cached variable, now everything works fine.
Thanks!
Thanks for testing & confirming.
Don't hesitate to check in again if anything should be flaky in VS.
Most helpful comment
After resetting Visual Studio and re-cloning openPMD, I couldn't reproduce the issue.
It must have been some messed up cached variable, now everything works fine.
Thanks!