Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
d4a17f13ea9c593062cf3aadcfb067a230164f48
[simgrid.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 exec_program("rm ${Project_BINARY_DIR}/CTestTestfile.cmake" OUTPUT_VARIABLE rmok)
3 project(Simgrid CXX C)
4 set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE)
5 set(release_version "3.5")
6 set(libsimgrid_version "${release_version}")
7 set(libgras_version "${release_version}")
8 set(libsmpi_version "${release_version}")
9
10 ### Find programs and paths
11 find_program(SED_EXE NAMES sed)
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(PROJECT_SOURCE_DIRECTORY "${PROJECT_DIRECTORY}/src")
20 set(EXECUTABLE_OUTPUT_PATH "${PROJECT_DIRECTORY}/bin")
21 set(LIBRARY_OUTPUT_PATH "${PROJECT_DIRECTORY}/src/.libs")
22 set(INCLUDES "-I${PROJECT_DIRECTORY}/include -I${PROJECT_DIRECTORY}/src/include -I${PROJECT_DIRECTORY}/src")
23 set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIRECTORY})
24
25 if(EXISTS /usr/include/)
26         set(INCLUDES "${INCLUDES} -I/usr/include/")
27 endif(EXISTS /usr/include/)
28
29 if(enable_coverage)
30         add_definitions (${INCLUDES} -fprofile-arcs -ftest-coverage)
31 else(enable_coverage)
32         add_definitions (${INCLUDES})
33 endif(enable_coverage)
34
35 ### Setup Options
36 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeOption.txt)
37
38 ### Make the *.h files with *.h.in files
39 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeCompleteInFiles.txt)
40
41 ### Define source packages for Libs 
42 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDefinePackages.txt)
43
44 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMaintainerMode.txt)
45
46 ### Setup gcc flags
47 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeFlags.txt)
48
49 ### Make Libs and Exes
50 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMakeExeLib.txt)
51
52 ### Make Simgrid.jar and Java examples
53 if(HAVE_JAVA)
54         include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeJarAndClass.txt)
55 endif(HAVE_JAVA)
56
57 ### Make tests
58 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeTest.txt)
59 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CTestConfig.cmake)
60
61 ### Setup the distrib
62 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDistrib.txt)
63
64 ### Print ARGS
65 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakePrintArgs.txt)
66
67 INCLUDE(Dart)
68
69 exec_program("ctest -N" OUTPUT_VARIABLE LIST_OF_TEST)
70 string(REPLACE "\n" ";" LIST_OF_TEST ${LIST_OF_TEST})
71 foreach(test ${LIST_OF_TEST})
72         string(REGEX REPLACE "^.*Test.*project.*" " " test ${test})
73         string(REGEX REPLACE "^.*Total.*Tests:.*" " " test ${test})
74         string(REGEX MATCH "^.*Testing.*" test_ok_1 ${test}) #for ctest version 2.6 (xxx/xxx Testing)
75         string(REGEX MATCH "^.*Test.*\\:+" test_ok_2 ${test}) #for ctest version 2.8 (Test #xxx)
76         if(test_ok_1 OR test_ok_2)
77                 string(REGEX REPLACE "^.*Testing" " " test ${test}) #for ctest version 2.6
78                 string(REGEX REPLACE "^.*Test.*\\:+" " " test ${test}) #for ctest version 2.8
79                 string(STRIP ${test} test)
80                 set_tests_properties(${test} PROPERTIES LABELS "rev${SVN_VERSION}")
81         endif(test_ok_1 OR test_ok_2)
82 endforeach(test ${LIST_OF_TEST})