Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / regression_tests / lustre_files / success / Stateflow / CMakeLists.txt @ fa9e78e5

History | View | Annotate | Download (2.92 KB)

1
cmake_minimum_required(VERSION 2.8.4)
2
include(FindUnixCommands)
3

    
4

    
5

    
6
#find_package(Lustre)
7

    
8
if(LUSTRE_COMPILER)
9
  message(STATUS "Found lustrec: ${LUSTRE_COMPILER} ")
10
else(LUSTRE_COMPILER)
11
  message(FATAL_ERROR "lustrec not found")
12
endif(LUSTRE_COMPILER)
13

    
14
#proceed all subdirectories
15
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}  "src_")
16

    
17
#take all lustre files
18
set(GLOBAL_LUSTRE_FILES "")
19
FOREACH(subdir ${SUBDIRS})
20
  #message("${subdir}")
21
  LUSTREFILES(LFILE ${subdir} )
22
  list(APPEND GLOBAL_LUSTRE_FILES ${LFILE})
23
  get_filename_component(L ${LFILE} NAME_WE)
24
  set(LUSTRE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${L}")
25
  file(COPY ${LFILE} "${subdir}/input_values" "${subdir}/outputs_values"   DESTINATION  ${LUSTRE_OUTPUT_DIR})
26
ENDFOREACH()
27

    
28
#first combination :no option
29
set(LUSTRE_OPTIONS_OPT "")
30

    
31
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
32
	get_filename_component(L ${lus_file} NAME_WE)
33
	set(LUSTRE_NODE_OPT  "${L}")
34
	
35
	# First command generate C files from Lustre file
36
	Lustre_Compile(LUS_FILE ${lus_file}
37
					NODE ${LUSTRE_NODE_OPT}
38
					OPTS ${LUSTRE_OPTIONS_OPT})
39
					
40
	set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
41
	add_test(NAME Stateflow_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
42
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
43
			#REQUIRED_FILES ${lus_file}
44
	)
45

    
46
	 #********************* make -f ${L}.makefile ***************************
47
	 add_test(NAME Stateflow_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
48
			COMMAND  make -f ${L}.makefile
49
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
50
	)
51
	SET_TESTS_PROPERTIES ( Stateflow_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
52
	 PROPERTIES DEPENDS Stateflow_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
53
				REQUIRED_FILES ${L}.makefile
54
				)
55
	 
56
	 #************** execute C binary **********************************
57
	
58
	if (BASH)
59
		add_test(
60
			NAME Stateflow_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} 
61
			COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < ../input_values > ${L}_${LUSTRE_NODE_OPT}_outputs"
62
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
63
		)
64
		SET_TESTS_PROPERTIES ( Stateflow_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
65
			PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}
66
				DEPENDS Stateflow_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT})
67
	else()
68
		message(FATAL_ERROR "Unknown shell command for ${CMAKE_HOST_SYSTEM_NAME}")
69
	endif()
70

    
71
	 #************** execute C binary **********************************
72
	 add_test(NAME Stateflow_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
73
			COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values 
74
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
75
	)
76
	SET_TESTS_PROPERTIES ( Stateflow_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
77
	 PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}_outputs
78
				DEPENDS Stateflow_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} )
79
				
80
	
81
ENDFOREACH()
82

    
83