Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make gras compil with Visual C++.
[simgrid.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 project(simgrid CXX C)
3 set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE)
4 set(CMAKE_CXX_FLAGS "" CACHE TYPE INTERNAL FORCE)
5 set(CMAKE_EXE_LINKER_FLAGS "" CACHE TYPE INTERNAL FORCE)
6 set(release_version "3.5")
7 set(libsimgrid_version "${release_version}")
8 set(libgras_version "${release_version}")
9 set(libsmpi_version "${release_version}")
10
11 ### Find programs and paths
12 find_path(GCOV_PATH NAMES gcov PATHS NO_DEFAULT_PATHS)
13 find_path(VALGRIND_PATH NAMES valgrind  PATHS NO_DEFAULT_PATHS)
14
15 ### SET THE PROJECT_DIRECTORY
16 SET(PROJECT_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
17
18 ### Set some variables for Cmake
19 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
20 set(INCLUDES "-I${PROJECT_DIRECTORY}/include -I${PROJECT_DIRECTORY}/src/include -I${PROJECT_DIRECTORY}/src -I${CMAKE_CURRENT_BINARY_DIR}/src/")
21 set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIRECTORY})
22
23 if(EXISTS /usr/include/)
24         set(INCLUDES "${INCLUDES} -I/usr/include/")
25 endif(EXISTS /usr/include/)
26
27 if(WIN32)
28         set(INCLUDES_MORE $ENV{INCLUDE})
29         string(REPLACE "\\" "/" INCLUDES_MORE "${INCLUDES_MORE}")
30         foreach(include_dir ${INCLUDES_MORE})
31                 set(INCLUDES "${INCLUDES} -I\"${include_dir}\"")
32         endforeach(include_dir ${INCLUDES_MORE})
33 endif(WIN32)
34
35 if(WIN32)
36         message("       Be sure all those variables are correctely set.")
37     message("           -- C_COMPILER                   $ENV{CC}")
38     message("           -- CXX_COMPILER                 $ENV{CXX}")    
39     message("           -- RC_COMPILER                  $ENV{RC}")
40     message("           -- INCLUDE                      $ENV{INCLUDE}")
41     message("           -- LIB                          $ENV{LIB}")
42     message("           -- MAKE_PROGRAM                 ${CMAKE_MAKE_PROGRAM}")
43     message("           -- CMAKE_BUILD_TOOL             ${CMAKE_BUILD_TOOL}")
44     message("           -- LINKER                       ${CMAKE_LINKER}")
45     message("           -- CMAKE_GENERATOR              ${CMAKE_GENERATOR}\n\n")
46     message("           -- INCLUDES                     ${INCLUDES}")
47     set(__STRICT_ANSI__ 1)
48     set(_MSC_VER 1)
49     set(_WIN32 1)
50 endif(WIN32)
51
52 if(enable_coverage)
53         add_definitions (${INCLUDES} -fprofile-arcs -ftest-coverage)
54 else(enable_coverage)
55         add_definitions (${INCLUDES})
56 endif(enable_coverage)
57
58 ### Setup Options
59 include(${PROJECT_DIRECTORY}/buildtools/Cmake/Option.cmake)
60
61 ### Make the *.h files with *.h.in files
62 include(${PROJECT_DIRECTORY}/buildtools/Cmake/CompleteInFiles.cmake)
63
64 ### Define source packages for Libs 
65 include(${PROJECT_DIRECTORY}/buildtools/Cmake/DefinePackages.cmake)
66
67 include(${PROJECT_DIRECTORY}/buildtools/Cmake/MaintainerMode.cmake)
68
69 ### Setup gcc flags
70 include(${PROJECT_DIRECTORY}/buildtools/Cmake/Flags.cmake)
71
72 ### Make Libs and Exes
73 include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeExeLib.cmake)
74
75 ### Make Simgrid.jar and Java examples
76 if(HAVE_JAVA)
77         include(${PROJECT_DIRECTORY}/buildtools/Cmake/MakeJava.cmake)
78 endif(HAVE_JAVA)
79
80 ### Make tests
81 include(${PROJECT_DIRECTORY}/buildtools/Cmake/AddTests.cmake)
82 include(${PROJECT_DIRECTORY}/buildtools/Cmake/CTestConfig.cmake)
83
84 ### Setup the distrib
85 include(${PROJECT_DIRECTORY}/buildtools/Cmake/Distrib.cmake)
86
87 ### Print ARGS
88 include(${PROJECT_DIRECTORY}/buildtools/Cmake/PrintArgs.cmake)
89
90 INCLUDE(Dart)