Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename some variales and cosmetics.
[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") #this one is evil since it speaks to CPack instead
20 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
21 set(INCLUDES "-I${PROJECT_DIRECTORY}/include -I${PROJECT_DIRECTORY}/src/include -I${PROJECT_DIRECTORY}/src -I${CMAKE_CURRENT_BINARY_DIR}/src/")
22 set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIRECTORY})
23
24 if(EXISTS /usr/include/)
25         set(INCLUDES "${INCLUDES} -I/usr/include/")
26 endif(EXISTS /usr/include/)
27
28 if(enable_coverage)
29         add_definitions (${INCLUDES} -fprofile-arcs -ftest-coverage)
30 else(enable_coverage)
31         add_definitions (${INCLUDES})
32 endif(enable_coverage)
33
34 ### Setup Options
35 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeOption.txt)
36
37 ### Make the *.h files with *.h.in files
38 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeCompleteInFiles.txt)
39
40 ### Define source packages for Libs 
41 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDefinePackages.txt)
42
43 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMaintainerMode.txt)
44
45 ### Setup gcc flags
46 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeFlags.txt)
47
48 ### Make Libs and Exes
49 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMakeExeLib.txt)
50
51 ### Make Simgrid.jar and Java examples
52 if(HAVE_JAVA)
53         include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeJarAndClass.txt)
54 endif(HAVE_JAVA)
55
56 ### Make tests
57 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeTest.txt)
58 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CTestConfig.cmake)
59
60 ### Setup the distrib
61 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDistrib.txt)
62
63 ### Print ARGS
64 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakePrintArgs.txt)
65
66 INCLUDE(Dart)
67
68 exec_program("ctest -N" OUTPUT_VARIABLE LIST_OF_TEST)
69 string(REPLACE "\n" ";" LIST_OF_TEST ${LIST_OF_TEST})
70 foreach(test ${LIST_OF_TEST})
71         string(REGEX REPLACE "^.*Test.*project.*" " " test ${test})
72         string(REGEX REPLACE "^.*Total.*Tests:.*" " " test ${test})
73         string(REGEX MATCH "^.*Testing.*" test_ok_1 ${test}) #for ctest version 2.6 (xxx/xxx Testing)
74         string(REGEX MATCH "^.*Test.*\\:+" test_ok_2 ${test}) #for ctest version 2.8 (Test #xxx)
75         if(test_ok_1 OR test_ok_2)
76                 string(REGEX REPLACE "^.*Testing" " " test ${test}) #for ctest version 2.6
77                 string(REGEX REPLACE "^.*Test.*\\:+" " " test ${test}) #for ctest version 2.8
78                 string(STRIP ${test} test)
79                 set_tests_properties(${test} PROPERTIES LABELS "rev${SVN_VERSION}")
80         endif(test_ok_1 OR test_ok_2)
81 endforeach(test ${LIST_OF_TEST})