missing MPI_C_LIBRARIES MPI_C_INCLUDE_PATH on Windows

  Kiến thức lập trình

On Ubuntu I compiled this project https://github.com/ElmerCSC/elmerfem

This is the CMake file

IF(WITH_MPI)
  # Advanced properties
  MARK_AS_ADVANCED(
    MPI_EXTRA_LIBRARY
    MPI_LIBRARY
    )

  FIND_PACKAGE(MPI REQUIRED)
  # Workaround if MPI is found but MPI_FOUND is not set (windows+msmpi+findmpi)
  SET(MPI_FOUND TRUE CACHE BOOL "")
  MARK_AS_ADVANCED(MPI_FOUND)
  INCLUDE_DIRECTORIES(${MPI_Fortran_INCLUDE_PATH})
  # MPI libraries may be needed for testing
  SET(CMAKE_C_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES})
  SET(CMAKE_CXX_REQUIRED_LIBRARIES ${MPI_CXX_LIBRARIES})
  SET(CMAKE_Fortran_REQUIRED_LIBRARIES ${MPI_Fortran_LIBRARIES})
ENDIF(WITH_MPI)

and I got this when compiling the project

Error        CMake Error at cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find MPI_C (missing: MPI_C_LIBRARIES MPI_C_INCLUDE_PATH)        C:UsersRProjectselmerfemcmake/Modules/FindPackageHandleStandardArgs.cmake    108        

but I’ve installed Microsoft MPI on windows

C:UsersR>set MSMPI
MSMPI_BENCHMARKS=C:Program FilesMicrosoft MPIBenchmarks
MSMPI_BIN=C:Program FilesMicrosoft MPIBin
MSMPI_INC=C:Program Files (x86)Microsoft SDKsMPIInclude
MSMPI_LIB32=C:Program Files (x86)Microsoft SDKsMPILibx86
MSMPI_LIB64=C:Program Files (x86)Microsoft SDKsMPILibx64

I wonder if this project is even compilable on windows.

I changed the cmake file to this and it still cannot find those two variables

  if(WIN32)
    # Manually specify the MPI paths
    SET(MPI_C_INCLUDE_PATH "$ENV{MSMPI_INC}")
    SET(MPI_C_LIBRARIES "$ENV{MSMPI_LIB64}/msmpi.lib")
    SET(MPI_CXX_LIBRARIES "$ENV{MSMPI_LIB64}/msmpi.lib")
    SET(MPI_Fortran_LIBRARIES "$ENV{MSMPI_LIB64}/msmpi.lib")

    # MPI libraries may be needed for testing
    SET(CMAKE_C_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES})
    SET(CMAKE_CXX_REQUIRED_LIBRARIES ${MPI_CXX_LIBRARIES})
    SET(CMAKE_Fortran_REQUIRED_LIBRARIES ${MPI_Fortran_LIBRARIES})
  endif()

it looks right to me tho, but Im not too proficient with cmake.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT