${CMAKE_MODULE_PATH}
${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules
)
+
+# x86_64
+# x86
+# i.86
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86")
+ IF(${ARCH_32_BITS})
+ set(PROCESSOR_i686 1)
+ set(SIMGRID_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
+ message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}")
+ ELSE(${ARCH_32_BITS})
+ message(STATUS "System processor: amd64")
+ set(SIMGRID_SYSTEM_PROCESSOR "amd64")
+ set(PROCESSOR_x86_64 1)
+ set(PROCESSOR_i686 0)
+ ENDIF(${ARCH_32_BITS})
+ set(HAVE_RAWCTX 1)
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
+ message(STATUS "System processor: alpha")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
+ message(STATUS "System processor: arm")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
+ # mips* machines are bi-endian mostly so processor does not tell
+ # endianess of the underlying system.
+ message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
+ message(STATUS "System processor: ppc64")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
+ message(STATUS "System processor: ppc")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
+ # Both flavours can run on the same processor
+ message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
+ message(STATUS "System processor: parisc" "parisc64")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
+ # s390 binaries can run on s390x machines
+ message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
+
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
+ message(STATUS "System processor: sh")
+
+ELSE(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") #PROCESSOR NOT fIND
+ message(STATUS "PROCESSOR NOT FOUND: ${CMAKE_SYSTEM_PROCESSOR}")
+
+ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86")
+
+message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
+
include(CheckFunctionExists)
+include(CheckTypeSize)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(TestBigEndian)
-include(FindGraphviz)
TEST_BIG_ENDIAN(BIGENDIAN)
+include(FindGraphviz)
+include(FindPCRE)
+
+set(HAVE_GTNETS 0)
+if(enable_gtnets)
+ include(FindGTnets)
+endif(enable_gtnets)
+if(enable_smpi)
+ include(FindF2c)
+endif(enable_smpi)
+if(enable_lua)
+ include(FindLua51Simgrid)
+endif(enable_lua)
+set(HAVE_NS3 0)
+if(enable_ns3)
+ include(FindNS3)
+endif(enable_ns3)
+
# Checks for header libraries functions.
-CHECK_LIBRARY_EXISTS(pthread pthread_create NO_DEFAULT_PATHS pthread)
-CHECK_LIBRARY_EXISTS(pthread sem_init NO_DEFAULT_PATHS HAVE_SEM_INIT_LIB)
-CHECK_LIBRARY_EXISTS(pthread sem_timedwait NO_DEFAULT_PATHS HAVE_SEM_TIMEDWAIT_LIB)
-CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock NO_DEFAULT_PATHS HAVE_MUTEX_TIMEDLOCK_LIB)
-CHECK_LIBRARY_EXISTS(rt clock_gettime NO_DEFAULT_PATHS HAVE_POSIX_GETTIME)
+CHECK_LIBRARY_EXISTS(pthread pthread_create "" pthread)
+CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB)
+CHECK_LIBRARY_EXISTS(pthread sem_open "" HAVE_SEM_OPEN_LIB)
+CHECK_LIBRARY_EXISTS(pthread sem_timedwait "" HAVE_SEM_TIMEDWAIT_LIB)
+CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
+CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME)
CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
CHECK_INCLUDE_FILE("winsock.h" HAVE_WINSOCK_H)
CHECK_INCLUDE_FILE("winsock2.h" HAVE_WINSOCK2_H)
+CHECK_INCLUDE_FILE("WinDef.h" HAVE_WINDEF_H)
CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
+CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
CHECK_FUNCTION_EXISTS(usleep HAVE_USLEEP)
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
+CHECK_FUNCTION_EXISTS(mergesort HAVE_MERGESORT)
+
+#Check if __thread is defined
+exec_program("${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_thread_storage.c"
+ OUTPUT_VARIABLE HAVE_thread_storage_run)
+if(HAVE_thread_storage_run)
+ set(HAVE_THREAD_LOCAL_STORAGE 0)
+else(HAVE_thread_storage_run)
+ set(HAVE_THREAD_LOCAL_STORAGE 1)
+endif(HAVE_thread_storage_run)
+
+# Our usage of mmap is Linux-specific (flag MAP_ANONYMOUS), but kFreeBSD uses a GNU libc
+IF(NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD" AND NOT "${CMAKE_SYSTEM}" MATCHES "GNU")
+ SET(HAVE_MMAP 0)
+ message(STATUS "Warning: MMAP is thought as non functional on this architecture (${CMAKE_SYSTEM})")
+ENDIF(NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD" AND NOT "${CMAKE_SYSTEM}" MATCHES "GNU")
if(WIN32) #THOSE FILES ARE FUNCTIONS ARE NOT DETECTED BUT THEY SHOULD...
set(HAVE_UCONTEXT_H 1)
set(CONTEXT_UCONTEXT 0)
SET(CONTEXT_THREADS 0)
-SET(HAVE_RUBY 0)
-set(HAVE_LUA 0)
SET(HAVE_TRACING 0)
if(enable_tracing)
SET(HAVE_TRACING 1)
endif(enable_tracing)
+if(enable_jedule)
+ SET(HAVE_JEDULE 1)
+endif(enable_jedule)
+
if(enable_latency_bound_tracking)
SET(HAVE_LATENCY_BOUND_TRACKING 1)
else(enable_latency_bound_tracking)
if(enable_gtnets)
- message("turning latency_bound_tracking to ON because GTNeTs is ON")
+ message(STATUS "Warning : Turning latency_bound_tracking to ON because GTNeTs is ON")
SET(enable_latency_bound_tracking ON)
SET(HAVE_LATENCY_BOUND_TRACKING 1)
else(enable_gtnets)
SET(MMALLOC_WANT_OVERIDE_LEGACY 0)
endif(enable_model-checking AND HAVE_MMAP)
-if(enable_lua)
- include(FindLua51Simgrid)
- if(LUA51_FOUND)
- set(HAVE_LUA 1)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${LUA_INCLUDE_DIR} ")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${LUA_LIBRARY_DIR} ")
- else(LUA51_FOUND)
- message("Lua binding need version 5.1 and cmake version 2.8")
- message("Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
- endif(LUA51_FOUND)
-endif(enable_lua)
-
-if(enable_ruby)
- include(FindRuby)
- if(RUBY_LIBRARY)
- if(RUBY_VERSION_MAJOR MATCHES "1" AND RUBY_VERSION_MINOR MATCHES "8")
- set(LIB_RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
- string(REGEX MATCH "ruby.*[0-9]" RUBY_LIBRARY_NAME ${RUBY_LIBRARY})
- if(NOT RUBY_LIBRARY_NAME)
- set(RUBY_LIBRARY_NAME ruby)
- endif(NOT RUBY_LIBRARY_NAME)
- string(REGEX REPLACE "/libruby.*$" "" RUBY_LIBRARY ${RUBY_LIBRARY})
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${RUBY_CONFIG_INCLUDE_DIR} ") #path to config.h
- string(COMPARE EQUAL "${RUBY_INCLUDE_DIR}" "${RUBY_CONFIG_INCLUDE_DIR}" operation)
- if(NOT operation)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${RUBY_INCLUDE_DIR} ") #path to ruby.h
- endif(NOT operation)
- ADD_DEFINITIONS("-I${CMAKE_HOME_DIRECTORY}/src/bindings/ruby -I${CMAKE_HOME_DIRECTORY}/src/simix")
- SET(HAVE_RUBY 1)
- else(RUBY_VERSION_MAJOR MATCHES "1" AND RUBY_VERSION_MINOR MATCHES "8")
- message("Ruby binding need version 1.8.x actually version ${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.x")
- SET(HAVE_RUBY 0)
- endif(RUBY_VERSION_MAJOR MATCHES "1" AND RUBY_VERSION_MINOR MATCHES "8")
- else(RUBY_LIBRARY)
- SET(HAVE_RUBY 0)
- endif(RUBY_LIBRARY)
-
- if(NOT RUBY_EXECUTABLE)
- message("Take care : you don't have ruby executable so you can compile and build examples but can't execute them!!!")
- endif(NOT RUBY_EXECUTABLE)
-
-endif(enable_ruby)
-
-#--------------------------------------------------------------------------------------------------
-### Initialize of Smpi
-
-if(enable_smpi)
- include(FindF2c)
- if(HAVE_F2C_H)
- string(REGEX MATCH "-I${HAVE_F2C_H} " operation "${CMAKE_C_FLAGS}")
- if(NOT operation)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${HAVE_F2C_H} ")
- endif(NOT operation)
- else(HAVE_F2C_H)
- message("-- You should install f2c before use smpi.")
- endif(HAVE_F2C_H)
-endif(enable_smpi)
-
#--------------------------------------------------------------------------------------------------
-### Initialize of CONTEXT GTNETS
-if(NOT enable_gtnets OR enable_supernovae)
- SET(HAVE_GTNETS 0)
-else(NOT enable_gtnets OR enable_supernovae)
- set(GTNETS_LDFLAGS "-L${gtnets_path}/lib")
- set(GTNETS_CPPFLAGS "-I${gtnets_path}/include/gtnets")
- exec_program("${CMAKE_CXX_COMPILER} ${GTNETS_CPPFLAGS} -lgtnets ${GTNETS_LDFLAGS} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gtnets.cpp " OUTPUT_VARIABLE COMPILE_GTNETS_VAR)
- if(COMPILE_GTNETS_VAR)
- SET(HAVE_GTNETS 0)
- else(COMPILE_GTNETS_VAR)
- SET(HAVE_GTNETS 1)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ")
- string(REGEX MATCH "${gtnets_path}/lib" operation "$ENV{LD_LIBRARY_PATH}")
- if(NOT operation)
- message(FATAL_ERROR "\n\nTo use GTNETS don't forget to set LD_LIBRARY_PATH with \n\texport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${gtnets_path}/lib\n\n")
- endif(NOT operation)
- endif(COMPILE_GTNETS_VAR)
-endif(NOT enable_gtnets OR enable_supernovae)
+### Check for some architecture dependent values
+CHECK_TYPE_SIZE(int SIZEOF_INT)
+CHECK_TYPE_SIZE(void* SIZEOF_VOIDP)
-#--------------------------------------------------------------------------------------------------
-#--------------------------------------------------------------------------------------------------
-### Initialize of pcre
-find_library(PATH_PCRE_LIB pcre)
-find_file(PATH_PCRE_H "pcre.h")
-set(HAVE_PCRE_LIB 0)
-if(PATH_PCRE_LIB AND PATH_PCRE_H)
- string(REGEX REPLACE "/libpcre.*[.]${LIB_EXE}$" "" PATHLIBPCRE "${PATH_PCRE_LIB}")
- string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}")
- string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
- if(NOT operation)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ")
- endif(NOT operation)
- string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}")
- if(NOT operation)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ")
- endif(NOT operation)
- set(HAVE_PCRE_LIB 1)
-else(PATH_PCRE_LIB)
- message("-- You should install libpcre (please install the libpcre3-dev package or equivalent)")
-endif(PATH_PCRE_LIB AND PATH_PCRE_H)
#--------------------------------------------------------------------------------------------------
### Initialize of CONTEXT THREADS
endif(pthread)
if(pthread)
- ### HAVE_SEM_INIT
+ ### Test that we have a way to create semaphores
+ if(HAVE_SEM_OPEN_LIB)
+ exec_program("${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_open.c -lpthread -o testprog"
+ OUTPUT_VARIABLE HAVE_SEM_OPEN_run)
+ if(HAVE_SEM_OPEN_run)
+ set(HAVE_SEM_OPEN 0)
+ message(STATUS "Warning: sem_open not compilable")
+ else(HAVE_SEM_OPEN_run)
+ exec_program("./testprog" RETURN_VALUE HAVE_SEM_OPEN_run2 OUTPUT_VARIABLE var_compil)
+ if(HAVE_SEM_OPEN_run2)
+ set(HAVE_SEM_OPEN 0)
+ message(STATUS "Warning: sem_open not executable")
+ else(HAVE_SEM_OPEN_run2)
+ set(HAVE_SEM_OPEN 1)
+ endif(HAVE_SEM_OPEN_run2)
+ endif(HAVE_SEM_OPEN_run)
+ else(HAVE_SEM_OPEN_LIB)
+ set(HAVE_SEM_OPEN 0)
+ endif(HAVE_SEM_OPEN_LIB)
+
if(HAVE_SEM_INIT_LIB)
- exec_program("${CMAKE_C_COMPILER} -lpthread ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_init.c" OUTPUT_VARIABLE HAVE_SEM_INIT_run)
+ exec_program("${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_init.c -lpthread -o testprog"
+ OUTPUT_VARIABLE HAVE_SEM_INIT_run)
if(HAVE_SEM_INIT_run)
set(HAVE_SEM_INIT 0)
+ message(STATUS "Warning: sem_init not compilable")
else(HAVE_SEM_INIT_run)
- set(HAVE_SEM_INIT 1)
+ exec_program("./testprog" RETURN_VALUE HAVE_SEM_INIT_run OUTPUT_VARIABLE var_compil)
+ if(HAVE_SEM_INIT_run)
+ set(HAVE_SEM_INIT 0)
+ message(STATUS "Warning: sem_init not executable")
+ else(HAVE_SEM_INIT_run)
+ set(HAVE_SEM_INIT 1)
+ endif(HAVE_SEM_INIT_run)
endif(HAVE_SEM_INIT_run)
+ else(HAVE_SEM_INIT_LIB)
+ set(HAVE_SEM_INIT 0)
endif(HAVE_SEM_INIT_LIB)
- ### HAVE_SEM_TIMEDWAIT
+ if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
+ message(FATAL_ERROR "Semaphores are not usable (neither sem_open nor sem_init is both compilable and executable), but they are mandatory to threads (you may need to mount /dev).")
+ endif(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
+
+ ### Test that we have a way to timewait for semaphores
if(HAVE_SEM_TIMEDWAIT_LIB)
exec_program("${CMAKE_C_COMPILER} -lpthread ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_timedwait.c" OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run)
file(READ "${simgrid_BINARY_DIR}/conftestval" mcsc)
STRING(REPLACE "\n" "" mcsc "${mcsc}")
if(mcsc)
- set(mcsc "yes")
- elseif(mcsc)
+ set(mcsc "yes")
+ set(HAVE_UCONTEXT_H 1)
+ else(mcsc)
set(mcsc "no")
endif(mcsc)
- else(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
+ else(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
set(mcsc "no")
endif(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
ENDIF(CMAKE_CROSSCOMPILING)
endif(HAVE_WINDOWS_H)
endif(mcsc MATCHES "no" AND pthread)
-if(with_context MATCHES "ucontext" AND mcsc MATCHES "no")
- message(FATAL_ERROR "-Dwith-context=ucontext specified but ucontext unusable.")
-endif(with_context MATCHES "ucontext" AND mcsc MATCHES "no")
+#Only windows
-set(with_context_ok 0)
-if(with_context MATCHES "windows")
- set(with_context_ok 1)
+if(WIN32)
if(NOT HAVE_WINDOWS_H)
message(FATAL_ERROR "no appropriate backend found windows")
endif(NOT HAVE_WINDOWS_H)
-endif(with_context MATCHES "windows")
-
-if(with_context MATCHES "pthreads")
- set(with_context_ok 1)
- set(with_context "pthread")
-endif(with_context MATCHES "pthreads")
-
-if(with_context MATCHES "auto")
- set(with_context_ok 1)
- set(with_context "ucontext")
- message("with_context auto change to ucontext")
-endif(with_context MATCHES "auto")
-
-if(with_context MATCHES "ucontext")
- set(with_context_ok 1)
- if(mcsc)
- set(CONTEXT_UCONTEXT 1)
- else(mcsc)
- if(windows_context MATCHES "yes")
- set(with_context "windows")
- message("with_context ucontext change to windows")
- else(windows_context MATCHES "yes")
- set(with_context "pthread")
- message("with_context ucontext change to pthread")
- endif(windows_context MATCHES "yes")
- endif(mcsc)
-endif(with_context MATCHES "ucontext")
-
-if(with_context MATCHES "pthread")
- set(with_context_ok 1)
- if(NOT pthread)
- message(FATAL_ERROR "Cannot find pthreads (try -Dwith_context=ucontext if you haven't already tried).")
- endif(NOT pthread)
- SET(CONTEXT_THREADS 1)
-endif(with_context MATCHES "pthread")
-
-if(with_context MATCHES "ucontext")
- SET(CONTEXT_THREADS 0)
-endif(with_context MATCHES "ucontext")
-
-if(NOT with_context_ok)
- message(FATAL_ERROR "-Dwith-context must be either ucontext or pthread")
-endif(NOT with_context_ok)
+endif(WIN32)
+
+if(windows_context MATCHES "yes")
+ message(STATUS "Context change to windows")
+endif(windows_context MATCHES "yes")
+
+#If can have both context
+
+if(mcsc)
+ set(CONTEXT_UCONTEXT 1)
+endif(mcsc)
+
+if(pthread)
+ set(CONTEXT_THREADS 1)
+endif(pthread)
+
###############
## SVN version check
##
-if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.svn)
- find_file(SVN ".svn" ${CMAKE_HOME_DIRECTORY})
- exec_program("svnversion ${CMAKE_HOME_DIRECTORY}" OUTPUT_VARIABLE "SVN_VERSION")
- message("SVN_VERSION : ${SVN_VERSION}")
-endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.svn)
-
-if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git)
+if(EXISTS .git)
+exec_program("git remote" OUTPUT_VARIABLE remote RETURN_VALUE ret)
+exec_program("git config --get remote.${remote}.url" OUTPUT_VARIABLE url RETURN_VALUE ret)
+if(url)
exec_program("git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --oneline -1" OUTPUT_VARIABLE "GIT_VERSION")
+ message(STATUS "Git version: ${GIT_VERSION}")
exec_program("git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --format=%ai ." OUTPUT_VARIABLE "GIT_DATE")
- exec_program("git svn info" ${CMAKE_HOME_DIRECTORY} OUTPUT_VARIABLE "GIT_SVN_VERSION")
-
+ message(STATUS "Git date: ${GIT_DATE}")
string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
STRING(REPLACE " +0000" "" GIT_DATE ${GIT_DATE})
STRING(REPLACE " " "~" GIT_DATE ${GIT_DATE})
STRING(REPLACE ":" "-" GIT_DATE ${GIT_DATE})
-
- exec_program("git config --get svn-remote.svn.url"
- OUTPUT_VARIABLE url
- RETURN_VALUE ret)
- if(ret EQUAL 0)
- exec_program("git svn info" ${CMAKE_HOME_DIRECTORY}
- OUTPUT_VARIABLE "GIT_SVN_VERSION")
- string(REPLACE "\n" ";" GIT_SVN_VERSION ${GIT_SVN_VERSION})
- foreach(line ${GIT_SVN_VERSION})
- string(REGEX MATCH "^Revision:.*" line_good ${line})
- if(line_good)
- string(REPLACE "Revision: " ""
- line_good ${line_good})
- set(SVN_VERSION ${line_good})
- endif(line_good)
- endforeach(line ${GIT_SVN_VERSION})
- endif(ret EQUAL 0)
-endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git)
+endif(url)
+endif(EXISTS .git)
###################################
## SimGrid and GRAS specific checks
set(GRAS_BIGENDIAN 0)
endif(BIGENDIAN)
+# The syntax of this magic string is given in src/gras/DataDesc/ddt_convert.c
+# It kinda matches the values that the gras_arch_desc_t structure can take
+
+# Basically, the syntax is one char l or B for endianness (little or Big)
+# then there is a bunch of blocks separated by _.
+# C block is for char, I block for integers, P block for pointers and
+# D block for floating points
+# For each block there is an amount of chuncks separated by :, each of
+# them describing a data size. For example there is only one chunk
+# in the char block, because no architecture provide several sizes
+# of chars. In integer block, there is 4 chunks: "short int", "int",
+# "long int", "long long int". There is 2 pointer chunks for data
+# pointers and pointers on functions (thanks to the AMD64 madness).
+# Thee two floating points chuncks are for "float" and "double".
+# Each chunk is of the form datasize/minimal_alignment_size
+
+# These informations are used to convert a data stream from one
+# formalism to another. Only the GRAS_ARCH is transfered in the
+# stream, and it it of cruxial importance to keep these detection
+# information here synchronized with the data hardcoded in the
+# source in src/gras/DataDesc/ddt_convert.c
+
+# If you add something here (like a previously unknown architecture),
+# please add it to the source code too.
+# Please do not modify stuff here since it'd break the GRAS protocol.
+# If you really need to change stuff, please also bump
+# GRAS_PROTOCOL_VERSION in src/gras/Msg/msg_interface.h
+
+SET(GRAS_THISARCH "none")
+
if(val_big MATCHES "l_C:1/1:_I:2/1:4/1:4/1:8/1:_P:4/1:4/1:_D:4/1:8/1:")
#gras_arch=0; gras_size=32; gras_arch_name=little32_1;
SET(GRAS_ARCH_32_BITS 1)
SET(GRAS_ARCH_32_BITS 0)
SET(GRAS_THISARCH 4)
endif(val_big MATCHES "l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:")
+if(val_big MATCHES "l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:8/8:8/8:_D:4/4:8/8:")
+ #gras_arch=5; gras_size=64; gras_arch_name=little64_2;
+ SET(GRAS_ARCH_32_BITS 0)
+ SET(GRAS_THISARCH 5)
+endif(val_big MATCHES "l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:8/8:8/8:_D:4/4:8/8:")
if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:")
- #gras_arch=5; gras_size=32; gras_arch_name=big32;
+ #gras_arch=6; gras_size=32; gras_arch_name=big32_8;
SET(GRAS_ARCH_32_BITS 1)
- SET(GRAS_THISARCH 5)
+ SET(GRAS_THISARCH 6)
endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:")
if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4:")
- #gras_arch=6; gras_size=32; gras_arch_name=big32_8_4;
+ #gras_arch=7; gras_size=32; gras_arch_name=big32_8_4;
SET(GRAS_ARCH_32_BITS 1)
- SET(GRAS_THISARCH 6)
+ SET(GRAS_THISARCH 7)
endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4:")
if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:")
- #gras_arch=7; gras_size=32; gras_arch_name=big32_4;
+ #gras_arch=8; gras_size=32; gras_arch_name=big32_4;
SET(GRAS_ARCH_32_BITS 1)
- SET(GRAS_THISARCH 7)
+ SET(GRAS_THISARCH 8)
endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:")
if(val_big MATCHES "B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:")
- #gras_arch=8; gras_size=32; gras_arch_name=big32_2;
+ #gras_arch=9; gras_size=32; gras_arch_name=big32_2;
SET(GRAS_ARCH_32_BITS 1)
- SET(GRAS_THISARCH 8)
+ SET(GRAS_THISARCH 9)
endif(val_big MATCHES "B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:")
if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:")
- #gras_arch=9; gras_size=64; gras_arch_name=big64;
+ #gras_arch=10; gras_size=64; gras_arch_name=big64;
SET(GRAS_ARCH_32_BITS 0)
- SET(GRAS_THISARCH 9)
+ SET(GRAS_THISARCH 10)
endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:")
if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4:")
- #gras_arch=10;gras_size=64; gras_arch_name=big64_8_4;
+ #gras_arch=11; gras_size=64; gras_arch_name=big64_8_4;
SET(GRAS_ARCH_32_BITS 0)
- SET(GRAS_THISARCH 10)
+ SET(GRAS_THISARCH 11)
endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4:")
+if(GRAS_THISARCH MATCHES "none")
+ message(STATUS "architecture: ${val_big}")
+ message(FATAL_ERROR "GRAS_THISARCH is empty: '${GRAS_THISARCH}'")
+endif(GRAS_THISARCH MATCHES "none")
# Check architecture signature end
try_run(RUN_GRAS_VAR COMPILE_GRAS_VAR
if(HAVE_MAKECONTEXT OR WIN32)
set(makecontext_CPPFLAGS "-DTEST_makecontext")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
- set(makecontext_CPPFLAGS_2 "-DOSX")
+ set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE")
endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(WIN32 AND __VISUALC__)
}
va_end(ap);
}
- int main(int argc, char *argv[])
+ int main(void)
{
- test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9);
+ test(\"test\", 1, 2, 3, 4, 5, 6, 7, 8, 9);
exit(0);
}"
)
endif(COMPILE_VA_NULL_VAR)
endforeach(fct ${diff_va})
-file(REMOVE "${PROJECT_DIRECTORY}/buildtools/Cmake/test_prog/prog_va_copy.c")
#--------------------------------------------------------------------------------------------------
### check for getline
set(ADDR2LINE "${ADDR2LINE}/addr2line")
endif(ADDR2LINE)
+
+
+### Check if OSX can compile with ucontext (with gcc 4.[1-5] it is broken)
+if(APPLE)
+ if(APPLE_NEED_GCC_VERSION GREATER COMPILER_C_VERSION_MAJOR_MINOR)
+ message(STATUS "Ucontext can't be used with this version of gcc (must be greater than 4.5)")
+ set(HAVE_UCONTEXT_H 0)
+ endif(APPLE_NEED_GCC_VERSION GREATER COMPILER_C_VERSION_MAJOR_MINOR)
+endif(APPLE)
+
### File to create
-configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
+configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in" "${CMAKE_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
SET( CMAKEDEFINE "#cmakedefine" )
-configure_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/gras_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h" @ONLY IMMEDIATE)
-configure_file("${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h" "${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h" @ONLY IMMEDIATE)
-configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
+configure_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/gras_config.h.in" "${CMAKE_BINARY_DIR}/src/gras_config.h" @ONLY IMMEDIATE)
+configure_file("${CMAKE_BINARY_DIR}/src/gras_config.h" "${CMAKE_BINARY_DIR}/src/gras_config.h" @ONLY IMMEDIATE)
+configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in" "${CMAKE_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
set(top_srcdir "${CMAKE_HOME_DIRECTORY}")
set(srcdir "${CMAKE_HOME_DIRECTORY}/src")
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(top_builddir ${CMAKE_HOME_DIRECTORY})
set(libdir ${exec_prefix}/lib)
-set(CMAKE_LINKARGS "${CMAKE_CURRENT_BINARY_DIR}/lib")
-set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/lib:${gtnets_path}/lib:$LD_LIBRARY_PATH")
-
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/hostfile ${CMAKE_CURRENT_BINARY_DIR}/examples/smpi/hostfile COPYONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform_with_routers.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform_with_routers.xml COPYONLY)
-
-exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABLE OKITOKI)
-exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c" OUTPUT_VARIABLE OKITOKI)
-exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff" OUTPUT_VARIABLE OKITOKI)
-exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun" OUTPUT_VARIABLE OKITOKI)
+set(CMAKE_LINKARGS "${CMAKE_BINARY_DIR}/lib")
+set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:${GTNETS_LIB_PATH}:${HAVE_NS3_LIB}:$LD_LIBRARY_PATH")
+
+configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/smpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/smpif.h @ONLY)
+configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
+configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_BINARY_DIR}/bin/smpif2c @ONLY)
+configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
+configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
+
+exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABLE OKITOKI)
+exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif2c" OUTPUT_VARIABLE OKITOKI)
+exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff" OUTPUT_VARIABLE OKITOKI)
+exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun" OUTPUT_VARIABLE OKITOKI)
+
+set(generated_headers_to_install
+ ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/smpif.h
+ ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
+)
+
+set(generated_headers
+ ${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h
+ ${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h
+)
+
+set(generated_files_to_clean
+${generated_headers}
+${generated_headers_to_install}
+${CMAKE_BINARY_DIR}/bin/smpicc
+${CMAKE_BINARY_DIR}/bin/smpif2c
+${CMAKE_BINARY_DIR}/bin/smpiff
+${CMAKE_BINARY_DIR}/bin/smpirun
+${CMAKE_BINARY_DIR}/bin/colorize
+${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
+${CMAKE_BINARY_DIR}/examples/smpi/smpi_traced.trace
+${CMAKE_BINARY_DIR}/src/supernovae_sg.c
+${CMAKE_BINARY_DIR}/src/supernovae_gras.c
+${CMAKE_BINARY_DIR}/src/supernovae_smpi.c
+)
+
+if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
+else("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
+ configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/hostfile ${CMAKE_BINARY_DIR}/examples/smpi/hostfile COPYONLY)
+ configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY)
+ configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform_with_routers.xml ${CMAKE_BINARY_DIR}/examples/msg/small_platform_with_routers.xml COPYONLY)
+ configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/tracing/platform.xml ${CMAKE_BINARY_DIR}/examples/msg/tracing/platform.xml COPYONLY)
+
+ set(generated_files_to_clean
+ ${generated_files_to_clean}
+ ${CMAKE_BINARY_DIR}/examples/smpi/hostfile
+ ${CMAKE_BINARY_DIR}/examples/msg/small_platform.xml
+ ${CMAKE_BINARY_DIR}/examples/msg/small_platform_with_routers.xml
+ ${CMAKE_BINARY_DIR}/examples/msg/tracing/platform.xml
+ )
+endif("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
+
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
+"${generated_files_to_clean}")
+
+
+IF(${ARCH_32_BITS})
+ set(WIN_ARCH "32")
+ELSE(${ARCH_32_BITS})
+ set(WIN_ARCH "64")
+ENDIF(${ARCH_32_BITS})
+configure_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/simgrid.nsi.in" "${CMAKE_BINARY_DIR}/simgrid.nsi" @ONLY IMMEDIATE)