]> granicus.if.org Git - graphviz/commitdiff
Modify files generated by Bison and Flex, to match the Autotools build.
authorErwin Janssen <erwinjanssen@outlook.com>
Tue, 3 Jan 2017 12:35:12 +0000 (13:35 +0100)
committerErwin Janssen <erwinjanssen@outlook.com>
Thu, 19 Jan 2017 11:53:49 +0000 (12:53 +0100)
- 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

cmake/modify_cgraph_grammar.cmake.in [new file with mode: 0644]
cmake/modify_cgraph_scan.cmake.in [new file with mode: 0644]
lib/cgraph/CMakeLists.txt

diff --git a/cmake/modify_cgraph_grammar.cmake.in b/cmake/modify_cgraph_grammar.cmake.in
new file mode 100644 (file)
index 0000000..772fe14
--- /dev/null
@@ -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 (file)
index 0000000..3fda8f7
--- /dev/null
@@ -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}")
index b329b552ac60144202c14a36e4118f3673b8c5f1..3565bc4ea19593f040bce89b7b8e4ca16c107a2a 100644 (file)
@@ -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(