Project

General

Profile

Revision fa9e78e5 regression_tests/modules/Lustre_compile.cmake

View differences:

regression_tests/modules/Lustre_compile.cmake
33 33
  set(LUSTRE_PATH_HINT)
34 34
endif()
35 35

  
36
#One can add his/her own builtin PATH.
37
#FILE(TO_CMAKE_PATH "/DATA/ERIC/Lustre/lustre-x.y" MYPATH)
38
#list(APPEND LUSTRE_PATH_HINT ${MYPATH})
39 36

  
40 37
# FIND_PROGRAM twice using NO_DEFAULT_PATH on first shot
41 38
find_program(LUSTRE_COMPILER
......
93 90
  if(LUS_OPTS)
94 91
    string(REPLACE "-" "" LUS_OPTS_CUT ${LUS_OPTS})
95 92
    string(REPLACE " " "_" LUS_OPTS_CUT ${LUS_OPTS_CUT})
96
    set(LUSTRE_OUTPUT_DIR "${LUSTRE_OUTPUT_DIR}/${LUS_OPTS_CUT}")
93
    if(LUS_NODE)
94
		set(LUSTRE_OUTPUT_DIR "${LUSTRE_OUTPUT_DIR}_${LUS_OPTS_CUT}")
95
    else()
96
		set(LUSTRE_OUTPUT_DIR "${LUSTRE_OUTPUT_DIR}/${LUS_OPTS_CUT}")
97
	endif()
97 98
	set(LUSTREC_ARGS ${LUSTREC_ARGS} ${LUS_OPTS} )
98 99
  endif()
99 100

  
......
111 112
	if (LUS_NODE)
112 113
		set(LUSTRE_GENERATED_FILES ${LUSTRE_GENERATED_FILES} ${LUSTRE_OUTPUT_DIR}/${L}.c ${LUSTRE_OUTPUT_DIR}/${L}_alloc.h ${LUSTRE_OUTPUT_DIR}/${L}_main.c ${LUSTRE_OUTPUT_DIR}/${L}.makefile)
113 114
	endif(LUS_NODE)
115
	if(LUS_OPTS MATCHES "horn")
116
		set(LUSTRE_GENERATED_FILES ${LUSTRE_GENERATED_FILES} ${LUSTRE_OUTPUT_DIR}/${L}.smt2)
117
	endif(LUS_OPTS MATCHES "horn")
114 118
  elseif("${E}" STREQUAL ".lusi")
115 119
	set(LUSTRE_GENERATED_FILES ${LUSTRE_OUTPUT_DIR}/${L}.h)
116 120
  endif()
117 121
  
118 122
  
119
  set(LUSTREC_ARGS ${LUSTREC_ARGS}   -d ${LUSTRE_OUTPUT_DIR} ${LUS_LUS_FILE})
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
    )
123
  set(LUSTREC_ARGS ${LUSTREC_ARGS} -d ${LUSTRE_OUTPUT_DIR} ${LUS_LUS_FILE})
125 124
	
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

  
148

  
149
  set(LUSTRE_GENERATED_FILES_${L}_${LUS_NODE}_${LUS_OPTS} "${LUSTRE_GENERATED_FILES}" PARENT_SCOPE)
150
  set(LUSTRE_OUTPUT_DIR_${L}_${LUS_NODE}_${LUS_OPTS} "${LUSTRE_OUTPUT_DIR}" PARENT_SCOPE)
151
  message(STATUS "Lustre: Added rule for compiling lustre source: ${LUSTRE_COMPILER} ${LUSTREC_ARGS}")
125
  set(LUSTRE_OPTS_POSTFIX_${L} "${LUS_OPTS_CUT}" PARENT_SCOPE)
126
  set(LUSTREC_ARGS_${L}_${LUS_NODE}_${LUS_OPTS_CUT} "${LUSTREC_ARGS}" PARENT_SCOPE)
127
  set(LUSTRE_GENERATED_FILES_${L}_${LUS_NODE}_${LUS_OPTS_CUT} "${LUSTRE_GENERATED_FILES}" PARENT_SCOPE)
128
  set(LUSTRE_OUTPUT_DIR_${L}_${LUS_NODE}_${LUS_OPTS_CUT} "${LUSTRE_OUTPUT_DIR}" PARENT_SCOPE)
152 129
endfunction(Lustre_Compile)
153 130

  
154 131
# handle the QUIETLY and REQUIRED arguments and set LUSTRE_FOUND to TRUE if

Also available in: Unified diff