Project

General

Profile

Revision 6c3ea955 regression_tests/modules/Lustre_compile.cmake

View differences:

regression_tests/modules/Lustre_compile.cmake
26 26
# command line option of the lustre compiler
27 27
#
28 28

  
29

  
29 30
if(LUSTRE_PATH_HINT)
30 31
  message(STATUS "FindLustre: using PATH HINT: ${LUSTRE_PATH_HINT}")
31 32
else()
......
116 117
  
117 118
  
118 119
  set(LUSTREC_ARGS ${LUSTREC_ARGS}   -d ${LUSTRE_OUTPUT_DIR} ${LUS_LUS_FILE})
119
  add_custom_command(
120
    OUTPUT ${LUSTRE_GENERATED_FILES}
121
    COMMAND ${LUSTRE_COMPILER} 
122
	ARGS ${LUSTREC_ARGS}    
123
    DEPENDS ${LUS_LUS_FILE}
124
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
125
    COMMENT "${LUSTRE_COMPILER} ${LUSTREC_ARGS}"
126
  )
127
  #set_source_files_properties(${LUSTRE_GENERATED_FILES} PROPERTIES GENERATED TRUE)
128
  #include_directories(${LUSTRE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LUSTRE_OUTPUT_DIR})
120
	execute_process(RESULT_VARIABLE res_var
121
		COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS}  
122
		DEPENDS ${LUS_LUS_FILE}  
123
		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
124
    )
125
	
126
	if(NOT "${res_var}" STREQUAL "0")
127
	  # Lustrec failed
128
	  set(REPORT_PATH  "${CMAKE_CURRENT_BINARY_DIR}/report")
129
	  file(APPEND ${REPORT_PATH}.in  "Lustrec failed with the following command \n ${LUSTRE_COMPILER} ${LUSTREC_ARGS}  \n")
130
	  message("Lustrec failed with the following command \n ${LUSTRE_COMPILER} ${LUSTREC_ARGS}  \n")
131
	  
132
	endif()
133
	set(LUSTRE_OUTPUT_DIR_${L}_${LUS_NODE}_${LUS_OPTS}_RESULT ${res_var} PARENT_SCOPE)
134
  #add_custom_command(
135
  #  OUTPUT ${LUSTRE_GENERATED_FILES}
136
  #  COMMAND ${LUSTRE_COMPILER} 
137
	#ARGS ${LUSTREC_ARGS}    
138
  #  DEPENDS ${LUS_LUS_FILE}
139
  #  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
140
  #  COMMENT "${LUSTRE_COMPILER} ${LUSTREC_ARGS}"
141
  #)
142

  
143
	add_test(NAME LUSTRE_OUTPUT_DIR_${L}_${LUS_NODE}_${LUS_OPTS}
144
			COMMAND ${CMAKE_BINARY_DIR}/modules/read_value "${res_var}" "${LUSTRE_COMPILER} ${LUSTREC_ARGS}"
145
			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
146
	)
147

  
129 148

  
130 149
  set(LUSTRE_GENERATED_FILES_${L}_${LUS_NODE}_${LUS_OPTS} "${LUSTRE_GENERATED_FILES}" PARENT_SCOPE)
131 150
  set(LUSTRE_OUTPUT_DIR_${L}_${LUS_NODE}_${LUS_OPTS} "${LUSTRE_OUTPUT_DIR}" PARENT_SCOPE)
......
142 161
mark_as_advanced(LUSTRE_INCLUDE_DIR)
143 162

  
144 163

  
145

  
146

  
147

  
148

  
164
#helpfull functions and macros
165
MACRO(SUBDIRLIST result curdir REGEX_PREFIX)
166
  FILE(GLOB children RELATIVE ${curdir} ${curdir}/${REGEX_PREFIX}*)
167
  SET(dirlist "")
168
  FOREACH(child ${children})
169
    IF(IS_DIRECTORY ${curdir}/${child})
170
      LIST(APPEND dirlist ${child})
171
    ENDIF()
172
  ENDFOREACH()
173
  SET(${result} ${dirlist})
174
ENDMACRO()
175

  
176
MACRO(LUSTREFILES result dir)
177
  FILE(GLOB children ${dir} ${dir}/*.lus)
178
  SET(lustreFileslist "")
179
  FOREACH(child ${children})
180
    IF(EXISTS ${child} AND NOT IS_DIRECTORY ${child})
181
      LIST(APPEND lustreFileslist ${child})
182
    ENDIF()
183
  ENDFOREACH()
184
  SET(${result} ${lustreFileslist})
185
ENDMACRO()
149 186

  
150 187

  
151 188

  

Also available in: Unified diff