Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Windows compatibility.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Sep 2010 08:23:36 +0000 (08:23 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Sep 2010 08:23:36 +0000 (08:23 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8175 48e7efb5-ca39-0410-a469-dd3cf9ba447f

CMakeLists.txt
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeExeLibWin.cmake
src/CMakeLists.txt
src/simix/smx_context.c
src/win32/config.h
src/xbt/xbt_sg_stubs.c
testsuite/simdag/CMakeLists.txt
testsuite/surf/CMakeLists.txt
testsuite/xbt/CMakeLists.txt
tools/gras/CMakeLists.txt

index a8ac91d..333be68 100644 (file)
@@ -34,32 +34,25 @@ ELSE(SIZEOF_LONG EQUAL 4)
 ENDIF(SIZEOF_LONG EQUAL 4)
 
 if(WIN32)
+
        set(INCLUDES_MORE $ENV{INCLUDE})
        string(REPLACE "\\" "/" INCLUDES_MORE "${INCLUDES_MORE}")
        foreach(include_dir ${INCLUDES_MORE})
                set(INCLUDES "${INCLUDES} -I\"${include_dir}\"")
        endforeach(include_dir ${INCLUDES_MORE})
-       message("Be sure all those variables are correctely set.")
-    message("  -- C_COMPILER                   $ENV{CC}")
-    message("  -- CXX_COMPILER                 $ENV{CXX}")    
-    message("  -- RC_COMPILER                  $ENV{RC}")
-    message("  -- INCLUDE                      $ENV{INCLUDE}")
-    message("  -- LIB                          $ENV{LIB}")
-    message("  -- MAKE_PROGRAM                 ${CMAKE_MAKE_PROGRAM}")
-    message("  -- CMAKE_BUILD_TOOL             ${CMAKE_BUILD_TOOL}")
-    message("  -- LINKER                       ${CMAKE_LINKER}")
-    message("  -- CMAKE_GENERATOR              ${CMAKE_GENERATOR}")
-    message("  -- INCLUDES                     ${INCLUDES}")
-    message("  -- BORLAND                          ${BORLAND}")
-    message("  -- VISUALC                          ${MSVC}")
-    message("  -- GNUC                         ${CMAKE_COMPILER_IS_GNUCC}\n\n")
+       set(INCLUDES "${INCLUDES} -I${PROJECT_DIRECTORY}/include/xbt -I${PROJECT_DIRECTORY}/src/xbt") #for win32_ucontext.[ch]
+
     if(BORLAND)                        ### BORLAND COMPILER
            set(__BORLANDC__ 1)
+           set(CMAKE_COMPILER_IS_GNUCC 0)
+           set(MSVC 0)
            set(_XBT_BORLANDC_COMPILER 1)
     endif(BORLAND)
     
     if(MSVC)   ### MicroSoftVisualC COMPILER
            set(__VISUALC__ 1)
+           set(BORLAND 0)
+           set(CMAKE_COMPILER_IS_GNUCC 0)
            set(_XBT_VISUALC_COMPILER 1)
            set(_MSC_VER 1)
         set(__STRICT_ANSI__ 1)
@@ -68,6 +61,8 @@ if(WIN32)
     
     if(CMAKE_COMPILER_IS_GNUCC)
         set(__GNUC__ 1)
+        set(MSVC 0)
+           set(BORLAND 0)
     endif(CMAKE_COMPILER_IS_GNUCC)
     
     if(ARCH_32_BITS)   ### Arch 32bits
@@ -77,6 +72,22 @@ if(WIN32)
     endif(ARCH_32_BITS)
     
     set(_XBT_WIN32 1)
+    
+    message("Be sure all those variables are correctely set.")
+    message("  -- C_COMPILER                   $ENV{CC}")
+    message("  -- CXX_COMPILER                 $ENV{CXX}")    
+    message("  -- RC_COMPILER                  $ENV{RC}")
+    message("  -- INCLUDE                      $ENV{INCLUDE}")
+    message("  -- LIB                          $ENV{LIB}")
+    message("  -- MAKE_PROGRAM                 ${CMAKE_MAKE_PROGRAM}")
+    message("  -- CMAKE_BUILD_TOOL             ${CMAKE_BUILD_TOOL}")
+    message("  -- LINKER                       ${CMAKE_LINKER}")
+    message("  -- CMAKE_GENERATOR              ${CMAKE_GENERATOR}")
+    message("  -- INCLUDES                     ${INCLUDES}")
+    message("  -- BORLAND                      ${BORLAND}")
+    message("  -- VISUALC                      ${MSVC}")
+    message("  -- GNUC                         ${CMAKE_COMPILER_IS_GNUCC}\n\n")
+    
 endif(WIN32)
 
 add_definitions (${INCLUDES})
@@ -123,8 +134,10 @@ if(HAVE_JAVA)
 endif(HAVE_JAVA)
 
 ### Make tests
+if(NOT WIN32)
 include(${PROJECT_DIRECTORY}/buildtools/Cmake/AddTests.cmake)
 include(${PROJECT_DIRECTORY}/buildtools/Cmake/CTestConfig.cmake)
+endif(NOT WIN32)
 
 ### Setup the distrib
 include(${PROJECT_DIRECTORY}/buildtools/Cmake/Distrib.cmake)
index 1c01327..ed0ef31 100755 (executable)
@@ -445,7 +445,7 @@ src/xbt/xbt_synchro.c
 
 ### depend of some variables setted upper
 # -->CONTEXT_THREADS
-if(${CONTEXT_THREADS} OR WIN32)
+if(${CONTEXT_THREADS}) #pthread
        set(SURF_SRC
                ${SURF_SRC}
                src/xbt/xbt_os_thread.c
@@ -455,17 +455,27 @@ if(${CONTEXT_THREADS} OR WIN32)
                ${EXTRA_DIST}
                src/simix/smx_context_sysv.c
        )
-else(${CONTEXT_THREADS} OR WIN32)
+else(${CONTEXT_THREADS}) #ucontext
        set(SURF_SRC
                ${SURF_SRC}
                src/simix/smx_context_sysv.c
        )
-       set(EXTRA_DIST
-               ${EXTRA_DIST}
-               src/xbt/xbt_os_thread.c
-               src/simix/smx_context_thread.c
-       )
-endif(${CONTEXT_THREADS} OR WIN32)
+
+       if(WIN32)
+       set(SURF_SRC
+               ${SURF_SRC}
+               src/xbt/xbt_os_thread.c
+               src/simix/smx_context_thread.c)
+    else(WIN32)
+       set(EXTRA_DIST
+               ${EXTRA_DIST}
+               src/xbt/xbt_os_thread.c
+               src/simix/smx_context_thread.c)
+    endif(WIN32)
+endif(${CONTEXT_THREADS})
+
+
+
 
 # -->HAVE_GTNETS
 if(HAVE_GTNETS)
index 56e8e53..df0fc05 100644 (file)
@@ -1,28 +1,18 @@
 ### Make Libs\r
-       \r
-add_library(simgrid SHARED ${simgrid_sources})\r
-add_library(simgrid_static STATIC ${simgrid_sources})\r
-add_library(gras SHARED ${gras_sources})\r
-add_library(gras_static STATIC ${gras_sources})\r
-\r
-set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})\r
-set_target_properties(gras PROPERTIES VERSION ${libgras_version})\r
-\r
+#>gcc c:\simgrid-trunk\examples\msg\icomms\peer.c -static -Lc:\simgrid-trunk\lib -lsimgrid -Ic:\simgrid-trunk\include -lwsock32        \r
+add_library(simgrid STATIC ${simgrid_sources})\r
+add_library(gras STATIC ${gras_sources})\r
 \r
 if(MSVC)\r
-    set_target_properties(gras            PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT")\r
-    set_target_properties(gras_static     PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC"\r
+    set_target_properties(gras     PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC"\r
                                                      OUTPUT_NAME   "gras")\r
-    set_target_properties(simgrid         PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT")\r
-    set_target_properties(simgrid_static  PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC"\r
+    set_target_properties(simgrid  PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_STATIC"\r
                                                      OUTPUT_NAME   "simgrid")\r
 else(MSVC)\r
     if(CMAKE_COMPILER_IS_GNUCC)\r
-        set_target_properties(gras            PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_EXPORT")\r
-        set_target_properties(gras_static     PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_STATIC"\r
+        set_target_properties(gras     PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_STATIC"\r
                                                          OUTPUT_NAME   "gras")\r
-        set_target_properties(simgrid         PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_EXPORT")\r
-        set_target_properties(simgrid_static  PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_STATIC"\r
+        set_target_properties(simgrid  PROPERTIES COMPILE_FLAGS "-D _XBT_DLL_STATIC"\r
                                                          OUTPUT_NAME   "simgrid")\r
     else(CMAKE_COMPILER_IS_GNUCC)\r
         message(FATAL_ERROR "Compilateur non connu!!!")\r
@@ -33,9 +23,7 @@ set(GRAS_DEP "wsock32")
 set(SIMGRID_DEP "wsock32")\r
 \r
 target_link_libraries(simgrid  ${SIMGRID_DEP})\r
-target_link_libraries(simgrid_static   ${SIMGRID_DEP})\r
 target_link_libraries(gras     ${GRAS_DEP})\r
-target_link_libraries(gras_static      ${GRAS_DEP})\r
 \r
 ### Make EXEs\r
 \r
@@ -48,8 +36,5 @@ add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/icomms)
 #testsuite/xbt\r
 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)\r
 \r
-#testsuite/surf\r
-add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)\r
-\r
 #testsuite/simdag\r
 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
\ No newline at end of file
index 876654b..9554134 100644 (file)
@@ -13,6 +13,10 @@ PROPERTIES GENERATED true)
 add_executable(testall ${USE_TEST_UNITS})
 
 ### Add definitions for compile
-target_link_libraries(testall gras m)
+if(NOT WIN32)
+    target_link_libraries(testall gras m)
+else(NOT WIN32)
+    target_link_libraries(testall gras)
+endif(NOT WIN32)
 
 add_dependencies(testall units_files)
\ No newline at end of file
index 09c75b0..77efb14 100644 (file)
@@ -18,7 +18,7 @@
 #ifdef HAVE_RUBY
  void SIMIX_ctx_ruby_factory_init(smx_context_factory_t *factory);
 #endif 
+
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix, "Context switching mecanism");
 
 const char *xbt_ctx_factory_to_use = NULL;
@@ -37,9 +37,11 @@ void SIMIX_context_mod_init(void)
 #ifdef CONTEXT_THREADS
     /* context switch based os thread */
     SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
-#elif !defined(_XBT_WIN32)
+#elif defined(CONTEXT_UCONTEXT)
     /* context switch based ucontext */
     SIMIX_ctx_sysv_factory_init(&simix_global->context_factory);
+#elif defined(_XBT_WIN32)
+    /* context switch based windows */
 #else
     /* context switch is not allowed on Windows */
 #error ERROR [__FILE__, line __LINE__]: no context based implementation specified.
index fa25dbc..c276c69 100644 (file)
 
 
 #if defined(_XBT_BORLAND_COMPILER)
-# include <win32/compiler/borland.h>
-
+       # include <win32/compiler/borland.h>
 #elif defined(__GNUC__)
-  /* data comes from autoconf when using gnuc (cross-compiling?) */
-# include "gras_config.h"
-typedef unsigned int uint32_t;
-
+       /* data comes from autoconf when using gnuc (cross-compiling?) */
+       # include "gras_config.h"
+       #ifndef _XBT_WIN32
+               typedef unsigned int uint32_t;
+       #endif
 #elif defined(_XBT_VISUALC_COMPILER)
-# include <win32/compiler/visualc.h>
+       # include <win32/compiler/visualc.h>
 # else
-# error "Unknown compiler - please report the problems to the main simgrid mailing list (http://gforge.inria.fr/mail/?group_id=12)"
+       # error "Unknown compiler - please report the problems to the main simgrid mailing list (http://gforge.inria.fr/mail/?group_id=12)"
 #endif
 
 typedef int socklen_t;
index b609c10..56a9bbe 100644 (file)
@@ -21,6 +21,7 @@
 #include "portable.h"           /* CONTEXT_THREADS */
 
 #ifndef CONTEXT_THREADS
+#ifndef WIN32
 
 /* xbt_threads is loaded in libsimgrid when they are used to implement the xbt_context.
  * The decision (and the loading) is made in xbt/context.c.
@@ -141,3 +142,4 @@ void xbt_os_cond_destroy(xbt_os_cond_t cond)
     ("No pthread in SG when compiled against the ucontext (xbt_os_cond_destroy)");
 }
 #endif
+#endif
index 72c2393..972e780 100644 (file)
@@ -5,4 +5,8 @@ set(EXECUTABLE_OUTPUT_PATH "${PROJECT_DIRECTORY}/testsuite/simdag/")
 add_executable(sd_test sd_test.c)
 
 ### Add definitions for compile
+if(NOT WIN32)
 target_link_libraries(sd_test simgrid m ) 
+else(NOT WIN32)
+target_link_libraries(sd_test simgrid ) 
+endif(NOT WIN32)
index 8b617d9..a6ec710 100644 (file)
@@ -9,8 +9,16 @@ add_executable(surf_usage2 "surf_usage2.c")
 add_executable(trace_usage "trace_usage.c")
 
 ### Add definitions for compile
+if(NOT WIN32)
 target_link_libraries(lmm_usage simgrid m ) 
 target_link_libraries(maxmin_bench simgrid m ) 
 target_link_libraries(surf_usage simgrid m ) 
 target_link_libraries(surf_usage2 simgrid m ) 
-target_link_libraries(trace_usage simgrid m ) 
+target_link_libraries(trace_usage simgrid m )
+else(NOT WIN32)
+target_link_libraries(lmm_usage simgrid ) 
+target_link_libraries(maxmin_bench simgrid ) 
+target_link_libraries(surf_usage simgrid ) 
+target_link_libraries(surf_usage2 simgrid ) 
+target_link_libraries(trace_usage simgrid )
+endif(NOT WIN32)
\ No newline at end of file
index f6593ec..69a1cda 100644 (file)
@@ -7,6 +7,12 @@ add_executable(graphxml_usage "graphxml_usage.c")
 add_executable(heap_bench "heap_bench.c")
 
 ### Add definitions for compile
+if(NOT WIN32)
 target_link_libraries(log_usage gras m )
 target_link_libraries(graphxml_usage simgrid m )
 target_link_libraries(heap_bench gras m )
+else(NOT WIN32)
+target_link_libraries(log_usage gras )
+target_link_libraries(graphxml_usage simgrid )
+target_link_libraries(heap_bench gras )
+endif(NOT WIN32)
\ No newline at end of file
index cb25013..7897ee2 100644 (file)
@@ -5,4 +5,8 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
 add_executable(gras_stub_generator stub_generator.c unix_stub_generator.c windows_stub_generator.c)
 
 ### Add definitions for compile
-target_link_libraries(gras_stub_generator simgrid pthread m)
\ No newline at end of file
+if(NOT WIN32)
+    target_link_libraries(gras_stub_generator gras simgrid pthread m)
+else(NOT WIN32)
+    target_link_libraries(gras_stub_generator gras simgrid)
+endif(NOT WIN32)
\ No newline at end of file