### SMPI vs. Fortran
if ((NOT DEFINED enable_smpi) OR enable_smpi)
- if(enable_fortran)
- include(FindGFortran)
- else()
- SET(SMPI_FORTRAN 0)
- endif()
+ # First unset the compiler in case we're re-running cmake over a previous
+ # configuration where it was saved as smpiff
+ unset(CMAKE_Fortran_COMPILER)
- if(NOT APPLE) # smpi is enabled by default
- # Call enable_language(Fortran) in order to load the build rules for this language, needed by
- # teshsuite/smpi/mpich-test/. Use CMAKE_FORCE_Fortran_COMPILER to bypass checks for a working compiler (smpiff
- # doesn't exist at configure time).
- include(CMakeForceCompiler)
- if(NOT COMMAND CMAKE_FORCE_Fortran_COMPILER)
- MACRO(CMAKE_FORCE_Fortran_COMPILER compiler id)
- SET(CMAKE_Fortran_COMPILER "${compiler}")
- SET(CMAKE_Fortran_COMPILER_ID_RUN TRUE)
- SET(CMAKE_Fortran_COMPILER_ID ${id})
- SET(CMAKE_Fortran_COMPILER_WORKS TRUE)
- SET(CMAKE_Fortran_COMPILER_FORCED TRUE)
-
- # Set old compiler id variables.
- IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
- SET(CMAKE_COMPILER_IS_GNUG77 1)
- ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
- ENDMACRO(CMAKE_FORCE_Fortran_COMPILER)
- endif()
- CMAKE_FORCE_Fortran_COMPILER(smpiff smpiff)
+ SET(SMPI_FORTRAN 0)
+ if(enable_fortran)
enable_language(Fortran OPTIONAL)
endif()
+
+ if(CMAKE_Fortran_COMPILER)
+ # Fortran compiler detected: save it, then replace by smpiff
+ set(SAVED_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}" CACHE FILEPATH "The real Fortran compiler")
+ set(CMAKE_Fortran_COMPILER smpiff)
+ set(SMPI_FORTRAN 1)
+ endif(CMAKE_Fortran_COMPILER)
+
endif()
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
set(libsimgrid-java_version "${release_version}")
### SET THE LIBRARY EXTENSION
-if(APPLE) #MAC
+if(APPLE)
set(LIB_EXE "dylib")
+elseif(WIN32)
+ set(LIB_EXE "a")
+ set(BIN_EXE ".exe")
else()
- if(WIN32) #WINDOWS
- set(LIB_EXE "a")
- set(BIN_EXE ".exe")
- else() #UNIX
- set(LIB_EXE "so")
- endif()
+ set(LIB_EXE "so")
endif()
execute_process(COMMAND ${CMAKE_LINKER} -version OUTPUT_VARIABLE LINKER_VERSION)
CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME)
CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_PTHREAD)
-CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB)
+if(NOT APPLE) # OS X El Capitan deprecates this function
+ CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB)
+endif()
CHECK_LIBRARY_EXISTS(pthread sem_open "" HAVE_SEM_OPEN_LIB)
set(HAVE_PTHREAD_SETAFFINITY 0)
CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np "" HAVE_PTHREAD_SETAFFINITY)
endif()
endif()
file(REMOVE sem_init)
+ else()
+ set(HAVE_SEM_INIT 0)
endif()
if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
### Setup the distrib
include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Distrib.cmake)
-### Build the doc (Windows downloads the doc instead of regenerating)
-#
-if(NOT WIN32)
- include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Documentation.cmake)
-else()
- find_program(WGET_PROGRAM NAMES wget)
- message(STATUS "wget: ${WGET_PROGRAM}")
- if(WGET_PROGRAM)
- ADD_CUSTOM_TARGET(documentation
- COMMENT "Downloading the SimGrid documentation..."
- COMMAND ${WGET_PROGRAM} -r -np -nH -nd http://simgrid.gforge.inria.fr/simgrid/${release_version}/doc/
- WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html
- )
- endif()
-endif()
+### Build the docs if asked to
+include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Documentation.cmake)
### Print the result of configuration
message("")
endif()
endif()
if(CMAKE_Fortran_COMPILER)
- message(" Compiler: Fortran ...........: ${CMAKE_Fortran_COMPILER} (id: ${CMAKE_Fortran_COMPILER_ID})")
+ message(" Compiler: Fortran ...........: ${SAVED_Fortran_COMPILER} (id: ${CMAKE_Fortran_COMPILER_ID})")
message(" version .............: ${CMAKE_Fortran_COMPILER_VERSION}")
endif()
message(" Linker: .....................: ${CMAKE_LINKER}")