Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (2.91 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
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
31
	get_filename_component(L ${lus_file} NAME_WE)
32
	set(LUSTRE_NODE_OPT  "${L}")
33
	
34
	# First command generate C files from Lustre file
35
	Lustre_Compile(LUS_FILE ${lus_file}
36
					NODE ${LUSTRE_NODE_OPT}
37
					OPTS ${LUSTRE_OPTIONS_OPT})
38
					
39
	set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
40
	add_test(NAME Simulink_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
41
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
42
			#REQUIRED_FILES ${lus_file}
43
	)
44

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

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

    
82