set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}")
endif()
+if(WIN32 OR MINGW)
+ message(FATAL_ERROR "SimGrid does not build on native windows, nor with MinGW. Please use WSL2 instead.")
+endif()
+
message(STATUS "Configuring SimGrid v${release_version}")
set(SIMGRID_VERSION_STRING "SimGrid version ${release_version}")
set(libsimgrid_version "${release_version}")
-set(libsimgrid-java_version "${release_version}")
# Basic checks on cmake
-cmake_minimum_required(VERSION 3.5)
-#for lto, to avoid warning (should be removed when switching to requiring cmake >= 3.9)
-if(NOT CMAKE_VERSION VERSION_LESS "3.9")
- cmake_policy(SET CMP0069 NEW)
-endif()
-# once we move >= 3.13, we should use target_link_option in examples/sthread
+cmake_minimum_required(VERSION 3.12)
+# once we move CMake to >= 3.13, we should use target_link_option in examples/sthread
message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/tools/cmake/Modules)
### SET THE LIBRARY EXTENSION
if(APPLE)
set(LIB_EXE "dylib")
-elseif(WIN32)
- set(LIB_EXE "a")
- set(BIN_EXE ".exe")
else()
set(LIB_EXE "so")
endif()
endif()
# tesh.py needs python 3 (or the module python-subprocess32 on python2.8+)
-if(CMAKE_VERSION VERSION_LESS "3.12")
- set(PythonInterp_FIND_VERSION 3)
- set(PythonInterp_FIND_VERSION_COUNT 1)
- set(PythonInterp_FIND_VERSION_MAJOR 3)
- include(FindPythonInterp)
- if(NOT PYTHONINTERP_FOUND)
- message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
- endif()
-else()
- find_package(Python3 COMPONENTS Interpreter Development)
- if(NOT Python3_Interpreter_FOUND)
- message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
- endif()
- set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
+find_package(Python3 COMPONENTS Interpreter)
+if(NOT Python3_Interpreter_FOUND)
+ message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
endif()
+set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(INTERNAL_INCLUDES
${CMAKE_BINARY_DIR}
${CMAKE_HOME_DIRECTORY}
- ${CMAKE_HOME_DIRECTORY}/src/include
)
if(enable_smpi)
set(INTERNAL_INCLUDES ${INTERNAL_INCLUDES} /usr/include/)
endif()
-if(WIN32)
- set(CMAKE_INCLUDE_WIN "${CMAKE_C_COMPILER}")
- set(CMAKE_LIB_WIN "${CMAKE_C_COMPILER}")
- string(REGEX REPLACE "/bin/gcc.*" "/include" CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
- string(REGEX REPLACE "/bin/gcc.*" "/lib" CMAKE_LIB_WIN "${CMAKE_LIB_WIN}")
- set(INTERNAL_INCLUDES ${INTERNAL_INCLUDES} ${CMAKE_INCLUDE_WIN})
- unset(CMAKE_INCLUDE_WIN)
-endif()
-
# library dependency cannot start with a space (CMP0004), so initialize it with something that is never deactivated.
set(SIMGRID_DEP "-lm")
### Determine the assembly flavor that we need today
set(HAVE_RAW_CONTEXTS 0)
include(CMakeDetermineSystem)
+foreach(arch i686 x86_64 arm64)
+ set(SIMGRID_PROCESSOR_${arch} 0)
+endforeach()
IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
IF(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32 bits
message(STATUS "System processor: i686 (${CMAKE_SYSTEM_PROCESSOR}, 32 bits)")
set(SIMGRID_PROCESSOR_i686 1)
- set(SIMGRID_PROCESSOR_x86_64 0)
ELSE()
message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
- set(SIMGRID_PROCESSOR_i686 0)
set(SIMGRID_PROCESSOR_x86_64 1)
ENDIF()
- if (WIN32)
- message(STATUS "Disable fast raw contexts on Windows.")
- elseif(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
message(STATUS "Disable fast raw contexts on x32 ABI.")
else()
set(HAVE_RAW_CONTEXTS 1)
endif()
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+ message(STATUS "System processor: arm64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
+ set(SIMGRID_PROCESSOR_arm64 1)
ELSE()
- set(SIMGRID_PROCESSOR_i686 0)
- set(SIMGRID_PROCESSOR_x86_64 0)
+ message(STATUS "System processor (${CMAKE_SYSTEM_PROCESSOR}) not explicitly accounted for")
ENDIF()
include(CheckFunctionExists)
message(STATUS "Disabling model BMF because Eigen3 was not found. If it's installed, use EIGEN3_HINT to hint cmake about the location of Eigen3Config.cmake")
endif()
-set(SIMGRID_HAVE_MSG 0)
-if(enable_msg)
- set(SIMGRID_HAVE_MSG 1)
-endif()
-
-if(WIN32)
- set(Boost_USE_STATIC_LIBS 1)
-endif()
-
set(HAVE_PAPI 0)
if(enable_smpi_papi)
include(FindPAPI)
set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp")
set(_Boost_STACKTRACE_ADDR2LINE_HEADERS "boost/stacktrace.hpp")
- if(minimal-bindings) # When we want a minimal jarfile, don't even search for boost optional components
+ if(minimal-bindings) # When we want a minimal python library, don't even search for boost optional components
message(STATUS "Don't even look for boost optional components, as we build minimal binding libraries.")
find_package(Boost 1.48)
else()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
-elseif(MINGW)
- # Use the GNU version of unusual modifiers like PRIx64
- add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
- set(CMAKE_REQUIRED_DEFINITIONS "-D__USE_MINGW_ANSI_STDIO=1")
else()
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
endif()
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
+if(NOT HAVE_SYSCONF)
+ message(FATAL_ERROR "Cannot build without sysconf.")
+endif()
CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
CHECK_SYMBOL_EXISTS(vasprintf stdio.h HAVE_VASPRINTF)
-if(MINGW)
- # The detection of vasprintf fails on MinGW, assumingly because it's
- # defined as an inline function in stdio.h instead of a regular
- # function. So force the result to be 1 despite of the test.
- set(HAVE_VASPRINTF 1)
-endif()
CHECK_INCLUDE_FILE("sys/sendfile.h" HAVE_SENDFILE_H)
CHECK_FUNCTION_EXISTS(sendfile HAVE_SENDFILE)
endif()
if(enable_model-checking AND NOT "${CMAKE_SYSTEM}" MATCHES "Linux|FreeBSD")
- message(WARNING "Support for model-checking has not been enabled on ${CMAKE_SYSTEM}: disabling it")
- set(enable_model-checking FALSE)
+ message(FATAL_ERROR "Support for model-checking has not been enabled on ${CMAKE_SYSTEM}. Please use a Linux docker to use the model checker.")
endif()
if(enable_model-checking AND minimal-bindings)
include_directories(${LIBDW_INCLUDE_DIR} ${LIBELF_INCLUDE_DIR} ${LIBEVENT_INCLUDE_DIR})
set(SIMGRID_DEP "${SIMGRID_DEP} ${LIBEVENT_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBDW_LIBRARIES}")
set(SIMGRID_HAVE_MC 1)
- if("${CMAKE_SYSTEM}" MATCHES "FreeBSD" AND enable_java)
- message(WARNING "FreeBSD + Model-Checking + Java = too much for now. Disabling the Java bindings.")
- set(enable_java FALSE)
- endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gdwarf-4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-4")
else()
mark_as_advanced(PATH_LIBDW_H)
mark_as_advanced(PATH_LIBDW_LIB)
-if(enable_java AND NOT enable_msg)
- message(FATAL_ERROR "Cannot activate the Java bindings without the MSG module. Either add -Denable_msg=ON or -Denable_java=OFF")
-endif()
-
if (enable_model-checking AND enable_ns3)
message(WARNING "Activating both model-checking and ns-3 bindings is considered experimental.")
endif()
if(enable_smpi)
SET(HAVE_SMPI 1)
- if(WIN32)
- message (STATUS "Warning: no support for SMPI automatic privatization on Windows.")
- SET(HAVE_PRIVATIZATION 0)
- else()
- SET(HAVE_PRIVATIZATION 1)
- endif()
+ SET(HAVE_PRIVATIZATION 1)
else()
SET(HAVE_SMPI 0)
endif()
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpi${script}.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpi${script} @ONLY)
endforeach()
-if(NOT WIN32)
- foreach(script cc cxx ff f90 run)
- execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpi${script})
- execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpi${script})
- endforeach()
-endif()
+foreach(script cc cxx ff f90 run)
+ execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpi${script})
+ execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpi${script})
+endforeach()
set(generated_headers_to_install
${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
${CMAKE_BINARY_DIR}/bin/smpiff
${CMAKE_BINARY_DIR}/bin/smpif90
${CMAKE_BINARY_DIR}/bin/smpirun
- ${CMAKE_BINARY_DIR}/bin/colorize
${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace
)
include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MaintainerMode.cmake)
### Make Libs
-if(NOT WIN32)
- include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLib.cmake)
-else()
- include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLibWin.cmake)
-endif()
-
-if(enable_java)
- include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Java.cmake)
-endif()
+include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLib.cmake)
# Python binding (with pybind11)
################
set(pybind11_FOUND OFF)
endif()
endif()
+endif()
- if(NOT PYTHONLIBS_FOUND AND NOT Python3_Development_FOUND)
- message(STATUS "Python libs not found. Turn pybind11 off.")
-
- set(pybind11_FOUND OFF)
- endif()
+find_package(Python3 COMPONENTS Development)
+if(NOT Python3_Development_FOUND OR NOT pybind11_FOUND)
+ message(STATUS "SimGrid Python bindings cannot be built on this system.")
+ set(default_enable_python OFF)
+else()
+ set(default_enable_python ON)
endif()
-option(enable_python "Whether the Python bindings are activated." ${pybind11_FOUND}) # ON by default if dependencies are met
+option(enable_python "Whether the Python bindings are activated." ${default_enable_python}) # ON by default if dependencies are met
if("${CMAKE_SYSTEM}" MATCHES "FreeBSD" AND enable_model-checking AND enable_python)
message(WARNING "FreeBSD + Model-Checking + Python = too much for now. Disabling the Python bindings.")
endif()
if(enable_python)
+ if(NOT Python3_Development_FOUND)
+ message(FATAL_ERROR "Please install the development components of Python (python3-dev on Debian) to build the Python bindings (or disable that option).")
+ endif()
if(pybind11_FOUND)
message(STATUS "Found pybind11.")
if(NOT enable_lto)
message(" is gnu ..............: ${CMAKE_COMPILER_IS_GNUCC}")
message(" Compiler: C++ ...............: ${CMAKE_CXX_COMPILER} (id: ${CMAKE_CXX_COMPILER_ID})")
message(" version .............: ${CMAKE_CXX_COMPILER_VERSION}")
-if(${Java_FOUND})
- message(" Compiler: Javac .............: ${Java_JAVAC_EXECUTABLE}")
- message(" version .............: ${Java_VERSION_STRING}")
- message(" runtime .............: ${Java_JAVA_EXECUTABLE}")
-endif()
if(CMAKE_Fortran_COMPILER)
message(" Compiler: Fortran ...........: ${SMPI_Fortran_COMPILER} (id: ${CMAKE_Fortran_COMPILER_ID})")
message(" version .............: ${CMAKE_Fortran_COMPILER_VERSION}")
message(" with LTO ....................: ${enable_lto}")
message("")
-if (SIMGRID_HAVE_MSG)
- message(" Compile MSG .................: ON")
-else()
- message(" Compile MSG .................: OFF")
-endif()
-
if (SIMGRID_HAVE_NS3)
message(" Compile ns-3 ................: ON (path: ${NS3_PATH})")
else()
message(" Compile ns-3 ................: OFF (hint: ${NS3_HINT})")
endif()
-if (${Java_FOUND})
- message(" Compile Java ................: ON")
- message(" Native lib in jar .........: ${enable_lib_in_jar}")
-else()
- message(" Compile Java ................: OFF")
-endif()
if(pybind11_FOUND)
message(" Compile Python bindings .....: ${enable_python}")
message(" module ....................: ${PYTHON_MODULE_PREFIX}simgrid${PYTHON_MODULE_EXTENSION}")