Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Free MC memory on exit
[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.5")
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_path(GCC_PATH NAMES gcc PATHS NO_DEFAULT_PATHS)
17 find_path(GCOV_PATH NAMES gcov PATHS NO_DEFAULT_PATHS)
18 find_path(VALGRIND_PATH NAMES valgrind  PATHS NO_DEFAULT_PATHS)
19
20 ### SET THE PROJECT_DIRECTORY
21 SET(PROJECT_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
22
23 ### Set some variables for Cmake
24 SET(PROJECT_SOURCE_DIRECTORY "${PROJECT_DIRECTORY}/src")
25 set(EXECUTABLE_OUTPUT_PATH "${PROJECT_DIRECTORY}/bin")
26 set(LIBRARY_OUTPUT_PATH "${PROJECT_DIRECTORY}/src/.libs")
27 set(INCLUDES "-I${PROJECT_DIRECTORY}/include -I${PROJECT_DIRECTORY}/src/include -I${PROJECT_DIRECTORY}/src -I/usr/include/ -L${gtnets_path}/lib")
28 set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIRECTORY})
29
30
31 if(enable_coverage)
32         add_definitions (${INCLUDES} -fprofile-arcs -ftest-coverage)
33 else(enable_coverage)
34         add_definitions (${INCLUDES})
35 endif(enable_coverage)
36
37 ### Setup Options
38 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeOption.txt)
39
40 ### Make the *.h files with *.h.in files
41 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeCompleteInFiles.txt)
42
43 ### Define source packages for Libs 
44 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDefinePackages.txt)
45
46 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMaintainerMode.txt)
47
48 ### Setup gcc flags
49 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeFlags.txt)
50
51 ### Make Libs and Exes
52 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMakeExeLib.txt)
53
54 ### Make Simgrid.jar and Java examples
55 if(HAVE_JAVA)
56         include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeJarAndClass.txt)
57 endif(HAVE_JAVA)
58
59 ### Make tests
60 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeTest.txt)
61 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CTestConfig.cmake)
62
63 ### Setup the distrib
64 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDistrib.txt)
65
66 ### Print ARGS
67 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakePrintArgs.txt)
68
69 INCLUDE(Dart)
70
71 exec_program("ctest -N" OUTPUT_VARIABLE LIST_OF_TEST)
72 string(REPLACE "\n" ";" LIST_OF_TEST ${LIST_OF_TEST})
73 foreach(test ${LIST_OF_TEST})
74         string(REGEX REPLACE "^.*Test.*project.*" " " test ${test})
75         string(REGEX REPLACE "^.*Total.*Tests:.*" " " test ${test})
76         string(REGEX MATCH "^.*Testing.*" test_ok_1 ${test}) #for ctest version 2.6 (xxx/xxx Testing)
77         string(REGEX MATCH "^.*Test.*\\:+" test_ok_2 ${test}) #for ctest version 2.8 (Test #xxx)
78         if(test_ok_1 OR test_ok_2)
79                 string(REGEX REPLACE "^.*Testing" " " test ${test}) #for ctest version 2.6
80                 string(REGEX REPLACE "^.*Test.*\\:+" " " test ${test}) #for ctest version 2.8
81                 string(STRIP ${test} test)
82                 set_tests_properties(${test} PROPERTIES LABELS "rev${SVN_VERSION}")
83         endif(test_ok_1 OR test_ok_2)
84 endforeach(test ${LIST_OF_TEST})