Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Windows compatibility.
[simgrid.git] / CMakeLists.txt
index eb72ca5..333be68 100644 (file)
@@ -9,8 +9,8 @@ set(libgras_version "${release_version}")
 set(libsmpi_version "${release_version}")
 
 ### Find programs and paths
-find_path(GCOV_PATH NAMES gcov PATHS NO_DEFAULT_PATHS)
-find_path(VALGRIND_PATH        NAMES valgrind  PATHS NO_DEFAULT_PATHS)
+FIND_PROGRAM(GCOV_PATH gcov)
+FIND_PROGRAM(VALGRIND_PATH valgrind)
 
 ### SET THE PROJECT_DIRECTORY
 SET(PROJECT_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
@@ -34,38 +34,60 @@ 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}\n\n")
-    set(__STRICT_ANSI__ 1)
-    set(_MSC_VER 1)
-    set(_XBT_WIN32 1)
+       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_VERSION)   ### MicroSoftVisualC COMPILER
+    
+    if(MSVC)   ### MicroSoftVisualC COMPILER
            set(__VISUALC__ 1)
+           set(BORLAND 0)
+           set(CMAKE_COMPILER_IS_GNUCC 0)
            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)
+        set(MSVC 0)
+           set(BORLAND 0)
+    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)
+    
+    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})
@@ -86,12 +108,16 @@ include(${PROJECT_DIRECTORY}/buildtools/Cmake/MaintainerMode.cmake)
 include(${PROJECT_DIRECTORY}/buildtools/Cmake/Flags.cmake)
 
 ### Make Libs and Exes
-include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLib.cmake)
+if(WIN32)
+    include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLibWin.cmake)
+else(WIN32)
+    include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLib.cmake)
+endif(WIN32)
 
 ### Build the doc
 if(enable_doc)
        ADD_CUSTOM_COMMAND(
-         OUTPUT ${PROJECT_DIRECTORY}/doc/html/index.html
+         OUTPUT ${PROJECT_DIRECTORY}/doc/html
          DEPENDS       ${PROJECT_DIRECTORY}/doc/FAQ.doc 
                                ${PROJECT_DIRECTORY}/buildtools/Cmake/GenerateDoc.cmake 
                                ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeLists.txt
@@ -99,7 +125,7 @@ if(enable_doc)
          COMMENT "Generating the simgrid documentation..."
        )
        ADD_CUSTOM_TARGET(simgrid_documentation ALL
-                         DEPENDS ${PROJECT_DIRECTORY}/doc/html/index.html)
+                         DEPENDS ${PROJECT_DIRECTORY}/doc/html)
 endif(enable_doc)
 
 ### Make Simgrid.jar and Java examples
@@ -108,12 +134,17 @@ 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)
 
+### Pipol compilation
+include(${PROJECT_DIRECTORY}/buildtools/Cmake/Pipol.cmake)
+
 ### Print ARGS
 include(${PROJECT_DIRECTORY}/buildtools/Cmake/PrintArgs.cmake)