blob: b91d4f2a9c4b558e0661d8c2f94cd3f69a04705c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
# convert given file to promela and run spin
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/contrib/cmake)
include("${CMAKE_MODULE_PATH}/FileInformation.cmake")
get_filename_component(TEST_FILE_NAME ${TESTFILE} NAME)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTDIR})
# message(FATAL_ERROR "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}")
if (${TARGETLANG} STREQUAL "vhdl")
if(NOT GHDL_BIN)
return()
endif()
set(VHDL_TESTBENCH_NAME "tb")
execute_process(COMMAND time -p ${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.vhdl RESULT_VARIABLE CMD_RESULT)
if (CMD_RESULT)
message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}")
endif ()
message(STATUS "time for transforming to VHDL machine")
message(STATUS "GHDL cleaning directory")
execute_process(
COMMAND time -p ${GHDL_BIN} --clean
WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT)
message(STATUS "${GHDL_BIN} -a --std=08 ${OUTDIR}/${TEST_FILE_NAME}.machine.vhdl")
execute_process(
COMMAND time -p ${GHDL_BIN} -a --std=08 ${OUTDIR}/${TEST_FILE_NAME}.machine.vhdl
WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT)
if (CMD_RESULT)
message(FATAL_ERROR "Error running ghdl ${GHDL_BIN}: ${CMD_RESULT}")
endif ()
message(STATUS "time for syntax check")
message(STATUS "${GHDL_BIN} -e --std=08 ${VHDL_TESTBENCH_NAME}")
execute_process(
COMMAND time -p ${GHDL_BIN} -e --std=08 ${VHDL_TESTBENCH_NAME}
WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT)
if (CMD_RESULT)
message(FATAL_ERROR "Error running ghdl ${GHDL_BIN}: ${CMD_RESULT}")
endif ()
message(STATUS "time for transforming to binary")
message(STATUS "${GHDL_BIN} -r ${VHDL_TESTBENCH_NAME}")
execute_process(
COMMAND time -p ${GHDL_BIN} -r ${VHDL_TESTBENCH_NAME}
WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT)
if (CMD_RESULT)
message(FATAL_ERROR "Error running ghdl ${GHDL_BIN}: ${CMD_RESULT}")
endif ()
message(STATUS "time for transforming to binary")
elseif (${TARGETLANG} STREQUAL "c")
message(STATUS "${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c")
execute_process(COMMAND time -p ${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c RESULT_VARIABLE CMD_RESULT)
if (CMD_RESULT)
message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}")
endif ()
message(STATUS "time for transforming to c machine")
# set(COMPILE_CMD_OBJ
# "-c" "${OUTDIR}/${TEST_FILE_NAME}.machine.c"
# "-o" "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o"
# "-Ofast" "-ansi" "-m16")
#
# message(STATUS "${CC_BIN} ${COMPILE_CMD_OBJ}")
# execute_process(
# COMMAND time -p ${CC_BIN} ${COMPILE_CMD_OBJ}
# WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT)
# if(CMD_RESULT)
# message(FATAL_ERROR "Error running gcc ${CC_BIN}: ${CMD_RESULT}")
# endif()
# file (SIZE "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o" BINARY_SIZE)
# message("Size of compiled unit optimized for speed: ${BINARY_SIZE}")
#
# set(COMPILE_CMD_OBJ
# "-c" "${OUTDIR}/${TEST_FILE_NAME}.machine.c"
# "-o" "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o"
# "-Os" "-ansi" "-m16")
#
# message(STATUS "${CC_BIN} ${COMPILE_CMD_OBJ}")
# execute_process(
# COMMAND time -p ${CC_BIN} ${COMPILE_CMD_OBJ}
# WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT)
# if(CMD_RESULT)
# message(FATAL_ERROR "Error running gcc ${CC_BIN}: ${CMD_RESULT}")
# endif()
# file (SIZE "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o" BINARY_SIZE)
# message("Size of compiled unit optimized for size: ${BINARY_SIZE}")
set(COMPILE_CMD_BIN
"-O0"
"-std=c++11"
"-Wl,-search_paths_first"
"-Wl,-headerpad_max_install_names"
"-o" "${OUTDIR}/${TEST_FILE_NAME}"
"-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
"-L${PROJECT_BINARY_DIR}/deps/xerces-c/lib"
"-luscxml"
"-lxerces-c"
"-include" "${OUTDIR}/${TEST_FILE_NAME}.machine.c"
"-I${PROJECT_SOURCE_DIR}/contrib/src"
"-I${PROJECT_SOURCE_DIR}/src"
"-I${PROJECT_BINARY_DIR}"
"-I${XercesC_INCLUDE_DIRS}"
"-I${URIPARSER_INCLUDE_DIR}"
"-I${LIBEVENT_INCLUDE_DIR}"
"-Wl,-rpath,${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
"-DAUTOINCLUDE_TEST=ON"
"${SCAFFOLDING_FOR_GENERATED_C}")
message(STATUS "${CXX_BIN} ${COMPILE_CMD_BIN}")
execute_process(
COMMAND time -p ${CXX_BIN} ${COMPILE_CMD_BIN}
WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT)
if (CMD_RESULT)
message(FATAL_ERROR "Error running g++ ${CXX_BIN}: ${CMD_RESULT}")
endif ()
message(STATUS "time for transforming to binary")
message(STATUS "${OUTDIR}/${TEST_FILE_NAME}")
execute_process(
COMMAND time -p ${OUTDIR}/${TEST_FILE_NAME}
WORKING_DIRECTORY ${OUTDIR}
RESULT_VARIABLE CMD_RESULT)
if (CMD_RESULT)
message(FATAL_ERROR "Error running generated c test: ${CMD_RESULT}")
endif ()
message(STATUS "time for execution")
endif ()
# message(STATUS "${TEST_OUT}")
# file(WRITE ${OUTDIR}/${TEST_FILE_NAME}.pml.out ${TEST_OUT})
|