Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Stop trying to build on native WIN32, it's broken anyway
[simgrid.git] / CMakeLists.txt
index 10e82d7..583e482 100644 (file)
@@ -10,6 +10,10 @@ else()
   set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}")
 endif()
 
+if(WIN32 OR MINGW)
+  message(FATAL "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}")
@@ -114,9 +118,6 @@ endif()
 ### 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()
@@ -173,15 +174,6 @@ if(NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/include/)
   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")
 
@@ -198,9 +190,7 @@ IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
     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)
@@ -259,10 +249,6 @@ 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)
@@ -334,10 +320,6 @@ CHECK_INCLUDE_FILE("pthread_np.h" HAVE_PTHREAD_NP_H) # for pthread_setaffinity_n
 
 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()
@@ -350,17 +332,14 @@ CHECK_FUNCTION_EXISTS(dlfunc HAVE_DLFUNC)
 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)
@@ -430,12 +409,7 @@ 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()
@@ -599,12 +573,10 @@ foreach(script cc cxx ff f90 run)
   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
@@ -788,11 +760,7 @@ add_dependencies(tests tests-mc)
 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()
+include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLib.cmake)
 
 if(enable_java)
   include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Java.cmake)