From: Erwin Janssen Date: Tue, 3 Jan 2017 12:35:12 +0000 (+0100) Subject: Modify files generated by Bison and Flex, to match the Autotools build. X-Git-Tag: 2.42.0~213^2^2~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=25fc2bcef8cb565f04081660fc60697d1f863b98;p=graphviz Modify files generated by Bison and Flex, to match the Autotools build. - Replace "yy" with "aag" in all three files - Replace "unsigned long int" with "uint64_t" in grammar.h and grammar.c - Replace "unsigned long" with "uint64_t" in grammar.h and grammar.c - Remove declaration of the "isatty()" function from scan.c --- diff --git a/cmake/modify_cgraph_grammar.cmake.in b/cmake/modify_cgraph_grammar.cmake.in new file mode 100644 index 000000000..772fe145c --- /dev/null +++ b/cmake/modify_cgraph_grammar.cmake.in @@ -0,0 +1,11 @@ +file(READ @CMAKE_CURRENT_BINARY_DIR@/grammar.h file_contents) +string(REPLACE "yy" "aag" file_contents "${file_contents}") +string(REPLACE "unsigned long int" "uint_64_t" file_contents "${file_contents}") +string(REPLACE "unsigned long" "uint_64_t" file_contents "${file_contents}") +file(WRITE @CMAKE_CURRENT_BINARY_DIR@/grammar.h "${file_contents}") + +file(READ @CMAKE_CURRENT_BINARY_DIR@/grammar.c file_contents) +string(REPLACE "yy" "aag" file_contents "${file_contents}") +string(REPLACE "unsigned long int" "uint_64_t" file_contents "${file_contents}") +string(REPLACE "unsigned long" "uint_64_t" file_contents "${file_contents}") +file(WRITE @CMAKE_CURRENT_BINARY_DIR@/grammar.c "${file_contents}") diff --git a/cmake/modify_cgraph_scan.cmake.in b/cmake/modify_cgraph_scan.cmake.in new file mode 100644 index 000000000..3fda8f71a --- /dev/null +++ b/cmake/modify_cgraph_scan.cmake.in @@ -0,0 +1,4 @@ +file(READ @CMAKE_CURRENT_BINARY_DIR@/scan.c file_contents) +string(REPLACE "yy" "aag" file_contents "${file_contents}") +string(REPLACE "extern int isatty (int );" "" file_contents "${file_contents}") +file(WRITE @CMAKE_CURRENT_BINARY_DIR@/scan.c "${file_contents}") diff --git a/lib/cgraph/CMakeLists.txt b/lib/cgraph/CMakeLists.txt index b329b552a..3565bc4ea 100644 --- a/lib/cgraph/CMakeLists.txt +++ b/lib/cgraph/CMakeLists.txt @@ -2,6 +2,33 @@ BISON_TARGET(Grammar grammar.y ${CMAKE_CURRENT_BINARY_DIR}/grammar.c) FLEX_TARGET(Scan scan.l ${CMAKE_CURRENT_BINARY_DIR}/scan.c) ADD_FLEX_BISON_DEPENDENCY(Scan Grammar) +# Modify files generated by Bison and Flex, to match the Autotools build. +# - Replace "yy" with "aag" in all three files +# - Replace "unsigned long int" with "uint64_t" in grammar.h and grammar.c +# - Replace "unsigned long" with "uint64_t" in grammar.h and grammar.c +# - Remove declaration of the "isatty()" function from scan.c +configure_file( + "${TOP_SOURCE_DIR}/cmake/modify_cgraph_grammar.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/modify_cgraph_grammar.cmake" + @ONLY +) +configure_file( + "${TOP_SOURCE_DIR}/cmake/modify_cgraph_scan.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/modify_cgraph_scan.cmake" + @ONLY +) +add_custom_command( + OUTPUT ${BISON_Grammar_OUTPUTS} + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/modify_cgraph_grammar.cmake + APPEND +) +add_custom_command( + OUTPUT ${FLEX_Scan_OUTPUTS} + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/modify_cgraph_scan.cmake + APPEND +) + + add_definitions(-DCGRAPH_EXPORTS -DYY_NO_UNISTD_H) include_directories(