Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win32: Fix CAFS issues wrt CMake-3.13+ #561

Merged
merged 2 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/draco-config-install.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ set(DRACO_C4 "@DRACO_C4@" )
set(Draco_MPIEXEC_EXECUTABLE "@MPIEXEC_EXECUTABLE@")
set(Draco_MPIEXEC_MAX_NUMPROCS "@MPIEXEC_MAX_NUMPROCS@")
set(Draco_MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@")
set(Draco_MPI_C_WORKS "@MPI_C_WORKS@") # Used to help CAFS setup on Win32

## CUDA
set( USE_CUDA "@USE_CUDA@" )
Expand Down
32 changes: 23 additions & 9 deletions config/setupMPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,13 @@ macro( setupMPILibrariesUnix )
# Preserve data that may already be set.
if( DEFINED ENV{MPIRUN} )
set( MPIEXEC_EXECUTABLE $ENV{MPIRUN} CACHE STRING
"Program to execute MPI prallel programs." )
"Program to execute MPI parallel programs." )
elseif( DEFINED ENV{MPIEXEC_EXECUTABLE} )
set( MPIEXEC_EXECUTABLE $ENV{MPIEXEC_EXECUTABLE} CACHE STRING
"Program to execute MPI prallel programs." )
"Program to execute MPI parallel programs." )
elseif( DEFINED ENV{MPIEXEC} )
set( MPIEXEC_EXECUTABLE $ENV{MPIEXEC} CACHE STRING
"Program to execute MPI prallel programs." )
"Program to execute MPI parallel programs." )
endif()

# If this is a Cray system and the Cray MPI compile wrappers are used,
Expand Down Expand Up @@ -468,13 +468,27 @@ macro( setupMPILibrariesWindows )

message(STATUS "Looking for MPI...")
find_package( MPI QUIET )

# If this macro is called from a MinGW builds system (for a CAFS
# subdirectory) and is trying to MS-MPI, the above check will fail (when
# cmake > 3.12). However, MS-MPI is known to be good when linking with
# Visual Studio so override the 'failed' report.
if(
# NOT "${MPI_C_FOUND}" AND "${Draco_MPI_C_WORKS}" AND
"${MPI_C_LIBRARIES}" MATCHES "msmpi" AND
"${CMAKE_GENERATOR}" STREQUAL "MinGW Makefiles")
if( EXISTS "${MPI_C_LIBRARIES}" AND EXISTS "${MPI_C_INCLUDE_DIRS}" )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic seems complicated it. Can it be simplified to set both the variables true only on the existence of the MPI libraries and directories?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- it is very complicated because I need to work around a bug in cmake. I think I can eliminate the first two checks. I'll try do do this -- but it may break the no-MPI build.

set( MPI_C_FOUND TRUE )
set( MPI_Fortran_FOUND TRUE )
endif()
endif()

# For MS-MPI, mpifptr.h is architecture dependent. Figure out
# what arch this is and save this path to MPI_Fortran_INCLUDE_PATH
list( GET MPI_CXX_LIBRARIES 0 first_cxx_mpi_library )
if( first_cxx_mpi_library AND NOT MPI_Fortran_INCLUDE_PATH )
# For MS-MPI, mpifptr.h is architecture dependent. Figure out what arch
# this is and save this path to MPI_Fortran_INCLUDE_PATH
list( GET MPI_C_LIBRARIES 0 first_c_mpi_library )
if( first_c_mpi_library AND NOT MPI_Fortran_INCLUDE_PATH )
get_filename_component( MPI_Fortran_INCLUDE_PATH
"${first_cxx_mpi_library}" DIRECTORY )
"${first_c_mpi_library}" DIRECTORY )
string( REGEX REPLACE "[Ll]ib" "Include" MPI_Fortran_INCLUDE_PATH
${MPI_Fortran_INCLUDE_PATH} )
set( MPI_Fortran_INCLUDE_PATH
Expand Down Expand Up @@ -638,7 +652,7 @@ macro( setupMPILibrariesWindows )
endif()

if( ${MPI_C_FOUND} )
message(STATUS "Looking for MPI...${MPIEXEC_EXECUTABLE}")
message(STATUS "Looking for MPI...found${MPIEXEC_EXECUTABLE}")
else()
message(STATUS "Looking for MPI...not found")
endif()
Expand Down
15 changes: 11 additions & 4 deletions config/unix-g++.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@
#
# Declare CMake options related to GCC
#
option( GCC_ENABLE_ALL_WARNINGS "Add \"-Weffc++\" to the compile options." OFF )
if( NOT DEFINED GCC_ENABLE_ALL_WARNINGS )
option( GCC_ENABLE_ALL_WARNINGS "Add \"-Weffc++\" to the compile options."
OFF )
endif()
if( NOT DEFINED GCC_ENABLE_GLIBCXX_DEBUG )
option( GCC_ENABLE_GLIBCXX_DEBUG
"Use special version of libc.so that includes STL bounds checking." OFF )
endif()

#
# Compiler flag checks
Expand All @@ -34,9 +39,11 @@ check_c_compiler_flag( "-march=native" HAS_MARCH_NATIVE )
if( DEFINED CMAKE_CXX_COMPILER_ID )
check_cxx_compiler_flag( "-Wnoexcept" HAS_WNOEXCEPT )
check_cxx_compiler_flag( "-Wsuggest-attribute=const" HAS_WSUGGEST_ATTRIBUTE )
check_cxx_compiler_flag( "-Wunused-local-typedefs" HAS_WUNUSED_LOCAL_TYPEDEFS )
#check_cxx_compiler_flag( "-Wunused-macros" HAS_WUNUSED_MACROS )
check_cxx_compiler_flag( "-Wzero-as-null-pointer-constant" HAS_WZER0_AS_NULL_POINTER_CONSTANT )
check_cxx_compiler_flag( "-Wunused-local-typedefs"
HAS_WUNUSED_LOCAL_TYPEDEFS )
#check_cxx_compiler_flag( "-Wunused-macros" HAS_WUNUSED_MACROS )
#check_cxx_compiler_flag( "-Wzero-as-null-pointer-constant"
# HAS_WZERO_AS_NULL_POINTER_CONSTANT )
endif()

# is this bullseye?
Expand Down
2 changes: 1 addition & 1 deletion config/vendor_libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ macro( setupQt )
# Instruct CMake to run moc automatically when needed (only for
# subdirectories that need Qt)
# set(CMAKE_AUTOMOC ON)
message( STATUS "Looking for Qt SDK....${QTDIR}." )
message( STATUS "Looking for Qt SDK....found ${QTDIR}." )
else()
set( QT_FOUND "QT-NOTFOUND" )
message( STATUS "Looking for Qt SDK....not found." )
Expand Down