Skip to content

Commit 6a8c7f9

Browse files
committed
Some fixes
1 parent a3587e5 commit 6a8c7f9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cmake/preprocess_vu1.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ elseif(STEP STREQUAL "pp2")
1616
if(NOT DEFINED GASP_TOOL)
1717
message(FATAL_ERROR "GASP_TOOL not defined")
1818
endif()
19+
# Use wrapper script for better error handling
1920
execute_process(
20-
COMMAND ${GASP_TOOL} -c ";" -I${SOURCE_DIR}/vu1 -o ${OUTPUT} ${INPUT}
21+
COMMAND ${SOURCE_DIR}/cmake/run_masp.sh ${GASP_TOOL} ${SOURCE_DIR}/vu1 ${OUTPUT} ${INPUT}
2122
RESULT_VARIABLE result
23+
OUTPUT_VARIABLE output
24+
ERROR_VARIABLE error
2225
)
2326
if(NOT result EQUAL 0)
24-
message(FATAL_ERROR "Step 2 preprocessing (${GASP_TOOL}) failed")
27+
message(FATAL_ERROR "Step 2 preprocessing (${GASP_TOOL}) failed\nOutput: ${output}\nError: ${error}\nInput: ${INPUT}\nOutput: ${OUTPUT}")
2528
endif()
2629

2730
elseif(STEP STREQUAL "pp3")
@@ -36,8 +39,11 @@ elseif(STEP STREQUAL "pp3")
3639

3740
elseif(STEP STREQUAL "pp4")
3841
# Step 4: C preprocessor with memory layout
42+
# Use -w to suppress warnings about unmatched quotes in assembly comments
43+
# Escape backslashes before preprocessing, then restore them after
44+
# This preserves masp/gasp local labels like \xformed_vert while allowing normal C preprocessing
3945
execute_process(
40-
COMMAND /bin/bash -c "cat ${INPUT} | ${COMPILER} -E -P -I${SOURCE_DIR}/vu1 -imacros ${MEM_HEADER} -o ${OUTPUT} -"
46+
COMMAND /bin/bash -c "sed 's/\\\\/\\\\\\\\/g' ${INPUT} | ${COMPILER} -E -P -w -I${SOURCE_DIR}/vu1 -imacros ${MEM_HEADER} - | sed 's/\\\\\\\\/\\\\/g' > ${OUTPUT}"
4147
RESULT_VARIABLE result
4248
)
4349
if(NOT result EQUAL 0)

0 commit comments

Comments
 (0)