Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Restructuration of file CompleteInFiles.
[simgrid.git] / buildtools / Cmake / UnitTesting.cmake
1 # To add a new tested file, simply add the original file in
2 # TEST_CFILES and generated file in TEST_UNITS. The rest is automatic.
3
4 set(TEST_CFILES
5         src/xbt/cunit.c
6         src/xbt/ex.c
7         src/xbt/dynar.c
8         src/xbt/dict.c
9         src/xbt/set.c
10         src/xbt/swag.c
11         src/xbt/xbt_str.c
12         src/xbt/xbt_strbuff.c
13         src/xbt/xbt_sha.c
14         src/xbt/config.c
15         src/xbt/xbt_synchro.c
16 )
17 set(TEST_UNITS
18         ${CMAKE_CURRENT_BINARY_DIR}/src/cunit_unit.c
19         ${CMAKE_CURRENT_BINARY_DIR}/src/ex_unit.c
20         ${CMAKE_CURRENT_BINARY_DIR}/src/dynar_unit.c
21         ${CMAKE_CURRENT_BINARY_DIR}/src/dict_unit.c
22         ${CMAKE_CURRENT_BINARY_DIR}/src/set_unit.c
23         ${CMAKE_CURRENT_BINARY_DIR}/src/swag_unit.c
24         ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_str_unit.c
25         ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_strbuff_unit.c
26         ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_sha_unit.c
27         ${CMAKE_CURRENT_BINARY_DIR}/src/config_unit.c
28         ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_synchro_unit.c
29         
30         ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_units_main.c
31 )
32
33
34
35 ADD_CUSTOM_COMMAND(
36         OUTPUT  ${TEST_UNITS}
37                 
38         DEPENDS ${CMAKE_HOME_DIRECTORY}/tools/sg_unit_extractor.pl
39                 ${TEST_CFILES}
40
41         COMMAND ${CMAKE_COMMAND} -E remove -f ${TEST_UNITS}
42
43         COMMAND chmod +x ${CMAKE_HOME_DIRECTORY}/tools/sg_unit_extractor.pl
44
45         COMMAND ${CMAKE_HOME_DIRECTORY}/tools/sg_unit_extractor.pl --root=src/ --outdir=${CMAKE_CURRENT_BINARY_DIR}/src/ ${TEST_CFILES}
46
47         WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
48
49         COMMENT "Generating *_units files for testall..."
50 )
51
52
53 ### Ensure the build of testall
54
55 set_source_files_properties(${TEST_UNITS} PROPERTIES GENERATED true)
56
57 set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/src/")
58 add_executable(testall ${TEST_UNITS})
59
60 ### Add definitions for compile
61 if(NOT WIN32)
62     target_link_libraries(testall gras m)
63 else(NOT WIN32)
64     target_link_libraries(testall gras)
65 endif(NOT WIN32)
66         
67 add_dependencies(testall $(TEST_UNITS))