Skip to content

Commit

Permalink
Fix Mingw compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Baljak committed Mar 6, 2022
1 parent 1cad194 commit 75386c5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 243 deletions.
14 changes: 10 additions & 4 deletions CMAKE/FortranMangling.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
FUNCTION(COMPILE RESULT)
MESSAGE(STATUS "=========")
MESSAGE(STATUS "Compiling and Building BLACS INSTALL Testing to set correct variables")


if(CMAKE_BUILD_TYPE)
SET(BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})
endif()

# Configure:
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND}
"-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "${PROJECT_SOURCE_DIR}//BLACS/INSTALL"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/BLACS/INSTALL/
"-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "${PROJECT_SOURCE_DIR}/BLACS/INSTALL"
-G ${CMAKE_GENERATOR} ${BUILD_TYPE}
-DCMAKE_Fortran_COMPILER_FORCED=TRUE -DCMAKE_C_COMPILER_FORCED=TRUE
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/BLACS/INSTALL/
RESULT_VARIABLE RESVAR OUTPUT_VARIABLE LOG1_OUT ERROR_VARIABLE LOG1_ERR
)
if(RESVAR EQUAL 0)
Expand Down
24 changes: 9 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ endif ()
#
# MPI
#
#set(MPI_BASE_DIR "/Users/julie/opt/openmpi/" CACHE PATH "MPI Path")
#set(MPI_BASE_DIR "/Users/julie/opt/mpich2/" CACHE PATH "MPI Path")
set(CMAKE_PREFIX_PATH "${MPI_BASE_DIR};${CMAKE_PREFIX_PATH}")
#set(MPI_COMPILER ${MPI_BASE_DIR}/bin/mpicc)

find_package(MPI)
if (MPI_FOUND)
Expand All @@ -51,14 +48,11 @@ if (MPI_FOUND)
DOC "MPI Fortran compiler.")
MARK_AS_ADVANCED(MPI_Fortran_COMPILER)



if ("${MPI_Fortran_COMPILER}" STREQUAL "MPI_Fortran_COMPILER-NOTFOUND")
message(ERROR "--> MPI Fortran Compiler NOT FOUND (please set MPI_BASE_DIR accordingly")
else()
message(STATUS "--> MPI Fortran Compiler : ${MPI_Fortran_COMPILER}")
SET(Fortran_COMPILER "${CMAKE_Fortran_COMPILER}")
#SET(CMAKE_Fortran_COMPILER "${MPI_Fortran_COMPILER}")
message(STATUS "--> Fortran Compiler : ${CMAKE_Fortran_COMPILER}")
endif()

Expand Down Expand Up @@ -159,18 +153,18 @@ else(LAPACK_FOUND)
message(STATUS "--> LAPACK and BLAS were not found. Reference LAPACK and BLAS will be downloaded and installed")
include(ExternalProject)
ExternalProject_Add(
lapack
URL http://www.netlib.org/lapack/lapack.tgz
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SCALAPACK_BINARY_DIR}
lapack
URL http://www.netlib.org/lapack/lapack.tgz
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SCALAPACK_BINARY_DIR}
PREFIX ${SCALAPACK_BINARY_DIR}/dependencies
)
if (UNIX)
if (NOT MSVC)
SET(LAPACK_LIBRARIES ${SCALAPACK_BINARY_DIR}/lib/liblapack.a CACHE STRING "LAPACK library" FORCE)
SET(BLAS_LIBRARIES ${SCALAPACK_BINARY_DIR}/lib/libblas.a CACHE STRING "BLAS library" FORCE)
else (UNIX) # On Windows
else () # MSVC
SET(LAPACK_LIBRARIES ${SCALAPACK_BINARY_DIR}/lib/liblapack.lib CACHE STRING "LAPACK library" FORCE)
SET(BLAS_LIBRARIES ${SCALAPACK_BINARY_DIR}/lib/libblas.lib CACHE STRING "BLAS library" FORCE)
endif (UNIX)
endif ()
ENDIF()
ENDIF()

Expand Down Expand Up @@ -232,14 +226,14 @@ add_subdirectory(SRC)
append_subdir_files(src "SRC")
append_subdir_files(src-C "SRC")

if (UNIX)
if (NOT MSVC)
add_library(scalapack ${blacs} ${tools} ${tools-C} ${extra_lapack} ${pblas} ${pblas-F} ${ptzblas} ${ptools} ${pbblas} ${redist} ${src} ${src-C})
set_target_properties(scalapack PROPERTIES
VERSION ${SCALAPACK_VERSION}
SOVERSION ${SCALAPACK_VERSION_MAJOR}.${SCALAPACK_VERSION_MINOR})
target_link_libraries( scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
scalapack_install_library(scalapack)
else (UNIX) # Need to separate Fortran and C Code
else () # Need to separate Fortran and C Code
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON )
add_library(scalapack ${blacs} ${tools-C} ${pblas} ${ptools} ${redist} ${src-C})
set_target_properties(scalapack PROPERTIES
Expand All @@ -253,7 +247,7 @@ else (UNIX) # Need to separate Fortran and C Code
target_link_libraries( scalapack-F ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
scalapack_install_library(scalapack)
scalapack_install_library(scalapack-F)
endif (UNIX)
endif ()

option(SCALAPACK_BUILD_TESTS "Build all tests of the ScaLAPACK library" ON)
if(${SCALAPACK_BUILD_TESTS})
Expand Down
224 changes: 0 additions & 224 deletions scalapack_build.cmake

This file was deleted.

0 comments on commit 75386c5

Please sign in to comment.