Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (1.63 KB)

1
cmake_minimum_required(VERSION 2.8.4)
2

    
3
#helpfull functions and macros
4
MACRO(SUBDIRLIST result curdir)
5
  FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
6
  SET(dirlist "")
7
  FOREACH(child ${children})
8
    IF(IS_DIRECTORY ${curdir}/${child})
9
      LIST(APPEND dirlist ${child})
10
    ENDIF()
11
  ENDFOREACH()
12
  SET(${result} ${dirlist})
13
ENDMACRO()
14

    
15
MACRO(LUSTREFILES result dir)
16
  FILE(GLOB children ${dir} ${dir}/*.lus)
17
  SET(lustreFileslist "")
18
  FOREACH(child ${children})
19
    IF(EXISTS ${child} AND NOT IS_DIRECTORY ${child})
20
      LIST(APPEND lustreFileslist ${child})
21
    ENDIF()
22
  ENDFOREACH()
23
  SET(${result} ${lustreFileslist})
24
ENDMACRO()
25

    
26
find_package(Lustre)
27

    
28
if(LUSTRE_COMPILER)
29
  message(STATUS "Found lustrec: ${LUSTRE_COMPILER} ")
30
else(LUSTRE_COMPILER)
31
  message(FATAL_ERROR "lustrec not found")
32
endif(LUSTRE_COMPILER)
33

    
34
#proceed all subdirectories
35
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
36

    
37
#take all lustre files
38
set(GLOBAL_LUSTRE_FILES "")
39
FOREACH(subdir ${SUBDIRS})
40
  LUSTREFILES(LFILE ${subdir} )
41
  list(APPEND GLOBAL_LUSTRE_FILES ${LFILE})
42
  #message("directory ${subdir} is proceeded with file ${LFILE}")
43
ENDFOREACH()
44

    
45
#first combination :no option
46
set(LUSTRE_OPTIONS_OPT "")
47
set(GENERATION_RESULTS "")
48
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
49
	get_filename_component(L ${lus_file} NAME_WE)
50
	set(LUSTRE_NODE_OPT  "${L}")
51
	Lustre_Compile(LUS_FILE ${lus_file}
52
					NODE ${LUSTRE_NODE_OPT}
53
					OPTS ${LUSTRE_OPTIONS_OPT})
54
	set(GENERATION_RESULTS ${GENERATION_RESULTS} ${LUSTRE_GENERATED_FILES_${lus_file}})
55
	#message("GENERATION_RESULTS : ${GENERATION_RESULTS}")
56
ENDFOREACH()
57
add_custom_target (GENERATE_FILES ALL
58
	DEPENDS ${GENERATION_RESULTS})