Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correct path for install ruby. New version.
[simgrid.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 exec_program("rm ${Project_BINARY_DIR}/CTestTestfile.cmake" OUTPUT_VARIABLE rmok)
3 SET(CMAKE_LANGUAGE "Cxx")
4 SET(PROJECT_NAME "Simgrid")
5 SET(PROJECT_LABEL "Simgrid")
6 set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE)
7 set(release_version "3.4.1")
8 set(libsimgrid_version "${release_version}")
9 set(libgras_version "${release_version}")
10 set(libsmpi_version "${release_version}")
11
12 ### Find programs and paths
13 find_program(SH_EXE NAMES sh)
14 find_program(SED_EXE NAMES sed)
15 find_program(PWD_EXE NAMES pwd)
16 find_program(UNAME NAMES uname)
17 find_program(HOSTNAME_CMD NAMES hostname)
18 find_program(CAT NAMES cat)
19 find_path(GCC_PATH NAMES gcc PATHS NO_DEFAULT_PATHS)
20 find_path(GCOV_PATH NAMES gcov PATHS NO_DEFAULT_PATHS)
21 find_path(VALGRIND_PATH NAMES valgrind  PATHS NO_DEFAULT_PATHS)
22
23 ### SET THE PROJECT_DIRECTORY
24 SET(PROJECT_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
25
26 ### Set some variables for Cmake
27 SET(PROJECT_SOURCE_DIRECTORY "${PROJECT_DIRECTORY}/src")
28 set(EXECUTABLE_OUTPUT_PATH "${PROJECT_DIRECTORY}/bin")
29 set(LIBRARY_OUTPUT_PATH "${PROJECT_DIRECTORY}/src/.libs")
30 set(INCLUDES "-I${PROJECT_DIRECTORY}/include -I${PROJECT_DIRECTORY}/src/include -I${PROJECT_DIRECTORY}/src -I/usr/include/ -L${gtnets_path}/lib")
31 set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIRECTORY})
32
33
34 if(enable_coverage)
35         add_definitions (${INCLUDES} -fprofile-arcs -ftest-coverage)
36 else(enable_coverage)
37         add_definitions (${INCLUDES})
38 endif(enable_coverage)
39
40 ### Setup Options
41 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeOption.txt)
42
43 ### Make the *.h files with *.h.in files
44 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeCompleteInFiles.txt)
45
46 ### Define source packages for Libs 
47 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDefinePackages.txt)
48
49 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMaintainerMode.txt)
50
51 ### Setup gcc flags
52 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeFlags.txt)
53
54 ### Make Libs and Exes
55 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMakeExeLib.txt)
56
57 ### Make Simgrid.jar and Java examples
58 if(HAVE_JAVA)
59         include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeJarAndClass.txt)
60 endif(HAVE_JAVA)
61
62 ### Make tests
63 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeTest.txt)
64 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CTestConfig.cmake)
65
66 ### Setup the distrib
67 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDistrib.txt)
68
69 ### Print ARGS
70 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakePrintArgs.txt)
71
72 INCLUDE(Dart)
73
74 exec_program("ctest -N" OUTPUT_VARIABLE LIST_OF_TEST)
75 string(REPLACE "\n" ";" LIST_OF_TEST ${LIST_OF_TEST})
76 foreach(test ${LIST_OF_TEST})
77         string(REGEX REPLACE "^.*Test.*project.*" " " test ${test})
78         string(REGEX REPLACE "^.*Total.*Tests:.*" " " test ${test})
79         string(REGEX MATCH "^.*Testing.*" test_ok_1 ${test}) #for ctest version 2.6 (xxx/xxx Testing)
80         string(REGEX MATCH "^.*Test.*\\:+" test_ok_2 ${test}) #for ctest version 2.8 (Test #xxx)
81         if(test_ok_1 OR test_ok_2)
82                 string(REGEX REPLACE "^.*Testing" " " test ${test}) #for ctest version 2.6
83                 string(REGEX REPLACE "^.*Test.*\\:+" " " test ${test}) #for ctest version 2.8
84                 string(STRIP ${test} test)
85                 set_tests_properties(${test} PROPERTIES LABELS "rev${SVN_VERSION}")
86         endif(test_ok_1 OR test_ok_2)
87 endforeach(test ${LIST_OF_TEST})