From: navarrop Date: Wed, 4 Aug 2010 08:05:12 +0000 (+0000) Subject: More windows compatibility for context. X-Git-Tag: v3_5~732 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/bd043f62d4d7bf22adb68d5193ec1bb2aaae3c7b More windows compatibility for context. Add visual basic and Devcpp compilers. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8089 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 19fb40dd6a..a8ac91d054 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,23 +49,34 @@ if(WIN32) message(" -- CMAKE_BUILD_TOOL ${CMAKE_BUILD_TOOL}") message(" -- LINKER ${CMAKE_LINKER}") message(" -- CMAKE_GENERATOR ${CMAKE_GENERATOR}") - message(" -- INCLUDES ${INCLUDES}\n\n") - set(__STRICT_ANSI__ 1) - set(_MSC_VER 1) - set(_XBT_WIN32 1) + message(" -- INCLUDES ${INCLUDES}") + message(" -- BORLAND ${BORLAND}") + message(" -- VISUALC ${MSVC}") + message(" -- GNUC ${CMAKE_COMPILER_IS_GNUCC}\n\n") if(BORLAND) ### BORLAND COMPILER set(__BORLANDC__ 1) set(_XBT_BORLANDC_COMPILER 1) endif(BORLAND) - if(MSVC_VERSION) ### MicroSoftVisualC COMPILER + + if(MSVC) ### MicroSoftVisualC COMPILER set(__VISUALC__ 1) set(_XBT_VISUALC_COMPILER 1) - endif(MSVC_VERSION) + set(_MSC_VER 1) + set(__STRICT_ANSI__ 1) + set(_M_IX86 1) + endif(MSVC) + + if(CMAKE_COMPILER_IS_GNUCC) + set(__GNUC__ 1) + endif(CMAKE_COMPILER_IS_GNUCC) + if(ARCH_32_BITS) ### Arch 32bits - set(_WIN32 1) + set(_WIN32 1) else(ARCH_32_BITS) ### Arch 64bits - set(_WIN64 1) + set(_WIN64 1) endif(ARCH_32_BITS) + + set(_XBT_WIN32 1) endif(WIN32) add_definitions (${INCLUDES}) @@ -87,9 +98,9 @@ include(${PROJECT_DIRECTORY}/buildtools/Cmake/Flags.cmake) ### Make Libs and Exes if(WIN32) -include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLibWin.cmake) + include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLibWin.cmake) else(WIN32) -include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLib.cmake) + include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLib.cmake) endif(WIN32) ### Build the doc diff --git a/Devcpp.bat b/Devcpp.bat new file mode 100644 index 0000000000..5e83004e9f --- /dev/null +++ b/Devcpp.bat @@ -0,0 +1,15 @@ +echo off +set CC=C:\Dev-Cpp\bin\gcc +set CXX=C:\Dev-Cpp\bin\g++ + +set INCLUDE=C:\Dev-Cpp\include;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include +set LIB=C:\Dev-Cpp\lib;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib + +set RC=C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\RC + +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include + +set Path=%Path%;C:\Borland\BCC55 +set Path=%Path%;C:\Dev-Cpp\bin \ No newline at end of file diff --git a/borland.bat b/borland.bat new file mode 100644 index 0000000000..4a032af9c3 --- /dev/null +++ b/borland.bat @@ -0,0 +1,11 @@ +echo off +set CC=C:\Borland\BCC55\Bin\bcc32 +set CXX=C:\Borland\BCC55\Bin\bcc32 +set INCLUDE=C:\Borland\BCC55\Include;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include +set LIB=C:\Borland\BCC55\Lib;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib +set RC=C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\RC +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include +set Path=%Path%;C:\Borland\BCC55 +set Path=%Path%;C:\Borland\BCC55\Bin \ No newline at end of file diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index 4d22b77954..31e0860993 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -246,13 +246,23 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(mcsc_flags "-D_XOPEN_SOURCE") endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(WIN32) + if(__VISUALC__) + set(mcsc_flags "/D_XBT_WIN32 /I${PROJECT_DIRECTORY}/include/xbt /I${PROJECT_DIRECTORY}/src/xbt") + endif(__VISUALC__) + if(__GNUC__) + set(mcsc_flags "-D_XBT_WIN32 -I${PROJECT_DIRECTORY}/include/xbt -I${PROJECT_DIRECTORY}/src/xbt") + endif(__GNUC__) +endif(WIN32) + try_run(RUN_mcsc_VAR COMPILE_mcsc_VAR ${PROJECT_DIRECTORY} ${PROJECT_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c COMPILE_DEFINITIONS "${mcsc_flags}" + OUTPUT_VARIABLE var_compil ) - -if(EXISTS "${simgrid_BINARY_DIR}/conftestval") + +if(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR) file(READ "${simgrid_BINARY_DIR}/conftestval" mcsc) STRING(REPLACE "\n" "" mcsc "${mcsc}") if(mcsc) @@ -260,9 +270,9 @@ if(EXISTS "${simgrid_BINARY_DIR}/conftestval") elseif(mcsc) set(mcsc "no") endif(mcsc) -else(EXISTS "${simgrid_BINARY_DIR}/conftestval") +else(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR) set(mcsc "no") -endif(EXISTS "${simgrid_BINARY_DIR}/conftestval") +endif(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR) if(mcsc MATCHES "no" AND pthread) if(HAVE_WINDOWS_H) @@ -460,9 +470,16 @@ if(HAVE_MAKECONTEXT OR WIN32) set(makecontext_CPPFLAGS_2 "-DOSX") endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") - if(WIN32) - set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 ${INCLUDES}") - endif(WIN32) + if(WIN32) + if(__VISUALC__) + set(makecontext_CPPFLAGS "/DTEST_makecontext") + set(makecontext_CPPFLAGS_2 "/D_XBT_WIN32 /I${PROJECT_DIRECTORY}/include/xbt /I${PROJECT_DIRECTORY}/src/xbt") + endif(__VISUALC__) + if(__GNUC__) + set(makecontext_CPPFLAGS "-DTEST_makecontext") + set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${PROJECT_DIRECTORY}/include/xbt -I${PROJECT_DIRECTORY}/src/xbt") + endif(__GNUC__) + endif(WIN32) try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR ${PROJECT_DIRECTORY} @@ -477,7 +494,6 @@ if(HAVE_MAKECONTEXT OR WIN32) string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}") set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})") set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})") - endif(HAVE_MAKECONTEXT OR WIN32) #-------------------------------------------------------------------------------------------------- @@ -627,8 +643,10 @@ try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR if(NOT COMPILE_RESULT_VAR) SET(need_getline "#define SIMGRID_NEED_GETLINE 1") +SET(SIMGRID_NEED_GETLINE 1) else(NOT COMPILE_RESULT_VAR) SET(need_getline "") +SET(SIMGRID_NEED_GETLINE 0) endif(NOT COMPILE_RESULT_VAR) ### check for a working snprintf @@ -660,15 +678,19 @@ endif(HAVE_SNPRINTF AND HAVE_VSNPRINTF) ### check for asprintf function familly if(HAVE_ASPRINTF) - SET(need_asprintf "") + SET(simgrid_need_asprintf "") + SET(NEED_ASPRINTF 0) else(HAVE_ASPRINTF) - SET(need_asprintf "#define SIMGRID_NEED_ASPRINTF 1") + SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1") + SET(NEED_ASPRINTF 1) endif(HAVE_ASPRINTF) if(HAVE_VASPRINTF) - SET(need_vasprintf "") + SET(simgrid_need_vasprintf "") + SET(NEED_VASPRINTF 0) else(HAVE_VASPRINTF) - SET(need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1") + SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1") + SET(NEED_VASPRINTF 1) endif(HAVE_VASPRINTF) ### check for addr2line diff --git a/buildtools/Cmake/Flags.cmake b/buildtools/Cmake/Flags.cmake index a5a863b1f2..7c9ee10b7f 100644 --- a/buildtools/Cmake/Flags.cmake +++ b/buildtools/Cmake/Flags.cmake @@ -1,9 +1,15 @@ set(warnCFLAGS "") set(optCFLAGS "") -if(NOT WIN32) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-g3 ${custom_flags}") -endif(NOT WIN32) +if(NOT __VISUALC__ AND NOT __BORLANDC__) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-g3") +else(NOT __VISUALC__ AND NOT __BORLANDC__) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}/Zi") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}/Zi") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}/DEBUG") +endif(NOT __VISUALC__ AND NOT __BORLANDC__) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${custom_flags}") if(enable_supernovae) set(warnCFLAGS "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ") diff --git a/buildtools/Cmake/MakeExeLibWin.cmake b/buildtools/Cmake/MakeExeLibWin.cmake index 04a74f820a..56e8e53a6a 100644 --- a/buildtools/Cmake/MakeExeLibWin.cmake +++ b/buildtools/Cmake/MakeExeLibWin.cmake @@ -8,12 +8,26 @@ add_library(gras_static STATIC ${gras_sources}) set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version}) set_target_properties(gras PROPERTIES VERSION ${libgras_version}) -set_target_properties(gras PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT") -set_target_properties(gras_static PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC" - OUTPUT_NAME "gras") -set_target_properties(simgrid PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT") -set_target_properties(simgrid_static PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC" - OUTPUT_NAME "simgrid") + +if(MSVC) + set_target_properties(gras PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT") + set_target_properties(gras_static PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC" + OUTPUT_NAME "gras") + set_target_properties(simgrid PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT") + set_target_properties(simgrid_static PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC" + OUTPUT_NAME "simgrid") +else(MSVC) + if(CMAKE_COMPILER_IS_GNUCC) + set_target_properties(gras PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_EXPORT") + set_target_properties(gras_static PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_STATIC" + OUTPUT_NAME "gras") + set_target_properties(simgrid PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_EXPORT") + set_target_properties(simgrid_static PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_STATIC" + OUTPUT_NAME "simgrid") + else(CMAKE_COMPILER_IS_GNUCC) + message(FATAL_ERROR "Compilateur non connu!!!") + endif(CMAKE_COMPILER_IS_GNUCC) +endif(MSVC) set(GRAS_DEP "wsock32") set(SIMGRID_DEP "wsock32") @@ -28,11 +42,8 @@ target_link_libraries(gras_static ${GRAS_DEP}) #src/testall add_subdirectory(${PROJECT_DIRECTORY}/src) -#tools/gras -add_subdirectory(${PROJECT_DIRECTORY}/tools/gras) - -#tools/tesh -add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh) +#examples +add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/icomms) #testsuite/xbt add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt) @@ -41,55 +52,4 @@ add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt) add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf) #testsuite/simdag -add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag) - -#teshsuite -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms) -add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg) - -#examples -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro) -add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties) - -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace) -add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing) - -if(HAVE_MC) - add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc) -endif(HAVE_MC) - -add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth) -add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate) - -add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag) -add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax) -add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml) -add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties) -add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/scheduling) +add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag) \ No newline at end of file diff --git a/buildtools/Cmake/Option.cmake b/buildtools/Cmake/Option.cmake index 6cbe6d95ca..2a7c638fc9 100644 --- a/buildtools/Cmake/Option.cmake +++ b/buildtools/Cmake/Option.cmake @@ -43,6 +43,11 @@ if(WIN32) #actually not enable with windows message("Mode supernovae and maintainer disable with Windows.") set(enable_supernovae false CACHE TYPE INTERNAL FORCE) set(enable_maintainer_mode false CACHE TYPE INTERNAL FORCE) + set(enable_java false CACHE TYPE INTERNAL FORCE) + set(enable_lua false CACHE TYPE INTERNAL FORCE) + set(enable_ruby false CACHE TYPE INTERNAL FORCE) + set(enable_smpi false CACHE TYPE INTERNAL FORCE) + set(enable_gtnets false CACHE TYPE INTERNAL FORCE) endif(WIN32) if(enable_supernovae AND enable_model-checking) diff --git a/buildtools/Cmake/PrintArgs.cmake b/buildtools/Cmake/PrintArgs.cmake index 37ea0c6114..2507db8351 100644 --- a/buildtools/Cmake/PrintArgs.cmake +++ b/buildtools/Cmake/PrintArgs.cmake @@ -27,8 +27,8 @@ if(enable_print_message) message("SIZEOF_MAX : ${SIZEOF_MAX}") message("PTH_STACKGROWTH ${PTH_STACKGROWTH}") message("need_getline ${need_getline}") - message("need_asprintf ${need_asprintf}") - message("need_vasprintf ${need_vasprintf}") + message("need_asprintf ${simgrid_need_asprintf}") + message("need_vasprintf ${simgrid_need_vasprintf}") message("PREFER_PORTABLE_SNPRINTF ${PREFER_PORTABLE_SNPRINTF}") message("HAVE_VA_COPY ${HAVE_VA_COPY}") message("GRAS_BIGENDIAN ${GRAS_BIGENDIAN}") @@ -56,7 +56,7 @@ if(enable_print_message) message("HAVE_STAT_H ${HAVE_STAT_H}") message("HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}") message("HAVE_WINDOWS_H ${HAVE_WINDOWS_H}") - message("HAVE_WINSOCK_H ${HAVE_WINSOCK_H}") + message("HAVE_WINSOCK_H ${HAVE_WINSOCK_H}") message("HAVE_WINSOCK2_H ${HAVE_WINSOCK2_H}") message("HAVE_ERRNO_H ${HAVE_ERRNO_H}") message("HAVE_UNISTD_H ${HAVE_UNISTD_H}") diff --git a/buildtools/Cmake/gras_config.h.in b/buildtools/Cmake/gras_config.h.in index 15a1e3579b..dec1cd4ba3 100644 --- a/buildtools/Cmake/gras_config.h.in +++ b/buildtools/Cmake/gras_config.h.in @@ -19,12 +19,19 @@ #ifndef _MSC_VER #cmakedefine _MSC_VER @_MSC_VER@ #endif +#ifndef _M_IX86 + #cmakedefine _M_IX86 @_M_IX86@ +#endif #cmakedefine _XBT_WIN32 @_XBT_WIN32@ //this variable is set if it is a windows platform #cmakedefine _WIN32 @_WIN32@ //this variable is set if it is a 32 bits windows platform #cmakedefine _WIN64 @_WIN64@ //this variable is set if it is a 64 bits windows platform #cmakedefine __VISUALC__ @__VISUALC__@ #cmakedefine __BORLANDC__ @__BORLANDC__@ - +#ifdef _XBT_WIN32 + #ifndef __GNUC__ + #cmakedefine __GNUC__ @__GNUC__@ + #endif +#endif /* Set to true if enable_model-checking is true */ #cmakedefine MMALLOC_WANT_OVERIDE_LEGACY @MMALLOC_WANT_OVERIDE_LEGACY@ #cmakedefine HAVE_MC @HAVE_MC@ diff --git a/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c b/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c index a0a73373c8..2fc26ed4ce 100644 --- a/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c +++ b/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c @@ -6,10 +6,12 @@ #include #include + #ifdef _XBT_WIN32 -#include + #include "win32_ucontext.h" + #include "win32_ucontext.c" #else -#include + #include #endif void child(void); diff --git a/buildtools/Cmake/test_prog/prog_stacksetup.c b/buildtools/Cmake/test_prog/prog_stacksetup.c index 55936ed623..8bffd64f21 100644 --- a/buildtools/Cmake/test_prog/prog_stacksetup.c +++ b/buildtools/Cmake/test_prog/prog_stacksetup.c @@ -21,8 +21,14 @@ #include #include #endif + #if defined(TEST_makecontext) -#include +#ifdef _XBT_WIN32 + #include "win32_ucontext.h" +#else + #include +#endif + #endif union alltypes { long l; diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index 6b01102fe0..1735095cf9 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -24,6 +24,11 @@ #cmakedefine _WIN64 @_WIN64@ /*this variable is set if it is a 64 bits windows platform*/ #cmakedefine __VISUALC__ @__VISUALC__@ #cmakedefine __BORLANDC__ @__BORLANDC__@ +#ifdef _XBT_WIN32 + #ifndef __GNUC__ + #cmakedefine __GNUC__ @__GNUC__@ + #endif +#endif #ifndef SIMGRID_PUBLIC_CONFIG_H #define SIMGRID_PUBLIC_CONFIG_H @@ -37,8 +42,8 @@ SG_BEGIN_DECL() #undef SIMGRID_NEED_ASPRINTF #undef SIMGRID_NEED_VASPRINTF @need_getline@ -@need_asprintf@ -@need_vasprintf@ +@simgrid_need_asprintf@ +@simgrid_need_vasprintf@ /* Use that config to declare missing elements */ #ifdef SIMGRID_NEED_GETLINE diff --git a/src/simix/smx_context_sysv.c b/src/simix/smx_context_sysv.c index da3dd53eaa..7f15c641af 100644 --- a/src/simix/smx_context_sysv.c +++ b/src/simix/smx_context_sysv.c @@ -15,6 +15,9 @@ #endif /* HAVE_VALGRIND_VALGRIND_H */ #ifdef _XBT_WIN32 + #include "win32_ucontext.h" + #include "win32_ucontext.c" +#else #include "ucontext.h" #include "ucontext.c" #endif diff --git a/src/simix/smx_context_sysv_private.h b/src/simix/smx_context_sysv_private.h index d98d79a793..5714534721 100644 --- a/src/simix/smx_context_sysv_private.h +++ b/src/simix/smx_context_sysv_private.h @@ -23,8 +23,11 @@ SG_BEGIN_DECL() #endif /*CONTEXT_STACK_SIZE */ #include "context_sysv_config.h" /* loads context system definitions */ +#ifdef _XBT_WIN32 +#include /* context relative declarations */ +#else #include /* context relative declarations */ - +#endif typedef struct s_smx_ctx_sysv { s_smx_ctx_base_t super; /* Fields of super implementation */ ucontext_t uc; /* the thread that execute the code */ diff --git a/src/surf/random_mgr.c b/src/surf/random_mgr.c index 4588aa0ef6..48769c429c 100644 --- a/src/surf/random_mgr.c +++ b/src/surf/random_mgr.c @@ -12,8 +12,10 @@ static unsigned int _seed = 2147483647; +#ifdef __VISUALC__ typedef unsigned __int64 uint64_t; typedef unsigned int uint32_t; +#endif struct drand48_data { unsigned short int __x[3]; /* Current state. */ diff --git a/src/xbt/setset.c b/src/xbt/setset.c index 16986fe2bb..1e0dd05561 100644 --- a/src/xbt/setset.c +++ b/src/xbt/setset.c @@ -7,18 +7,16 @@ /*The function ffs doesn't exist for windows*/ #ifdef _XBT_WIN32 - int XBT_INLINE ffs(int x) - { - int r; - __asm{ - mov ecx, [x] - bsf eax, ecx - jnz ffs1 - mov eax, -1 - ffs1: - mov[r],eax + int ffs(int bits) + { + int i; + if (bits == 0) + return (0); + for (i = 1; ; i++, bits >>= 1) + { + if (bits & 1) break; } - return(r); + return (i); } #endif diff --git a/src/xbt/win32_ucontext.c b/src/xbt/win32_ucontext.c index 3051d05d6a..1d7d453e1b 100644 --- a/src/xbt/win32_ucontext.c +++ b/src/xbt/win32_ucontext.c @@ -20,7 +20,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include "ucontext.h" +#include "win32_ucontext.h" int getcontext(ucontext_t *ucp) { diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index 6f5688ff60..978302147a 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -7,7 +7,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/misc.h" -#include "simgrid_config.h" /*HAVE_MMAP*/ +#include "simgrid_config.h" /*HAVE_MMAP _XBT_WIN32*/ #include "time.h" /* to seed the random generator */ #include "xbt/sysdep.h" @@ -53,6 +53,11 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt_sync_os); */ static void xbt_preinit(void) _XBT_GNUC_CONSTRUCTOR; static void xbt_postexit(void) _XBT_GNUC_DESTRUCTOR; + +#ifdef _XBT_WIN32 + # undef _XBT_NEED_INIT_PRAGMA +#endif + #ifdef _XBT_NEED_INIT_PRAGMA #pragma init (xbt_preinit) #pragma fini (xbt_postexit) diff --git a/vb.bat b/vb.bat new file mode 100644 index 0000000000..fef401a326 --- /dev/null +++ b/vb.bat @@ -0,0 +1,12 @@ +echo off +set CC=C:\MicrosoftVisualStudio10\VC\bin\cl +set CXX=C:\MicrosoftVisualStudio10\VC\bin\cl +set INCLUDE=C:\MicrosoftVisualStudio10\VC\include;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include +set LIB=C:\MicrosoftVisualStudio10\VC\lib;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib +set RC=C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\RC +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib +set Path=%Path%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include +set Path=%Path%;C:\MicrosoftVisualStudio10\VC\ +set Path=%Path%;C:\MicrosoftVisualStudio10\Common7\IDE +set Path=%Path%;C:\MicrosoftVisualStudio10\VC\bin \ No newline at end of file