From: Matthew Fernandez Date: Thu, 14 Apr 2022 00:37:36 +0000 (-0700) Subject: gml2gv: control Flex unistd.h suppression by whether we are on Windows X-Git-Tag: 4.0.0~69^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0381ef3367aa0354a4933256dfaa1067b1342a08;p=graphviz gml2gv: control Flex unistd.h suppression by whether we are on Windows This aligns more closely with the idiom used in lib/cgraph, and Windows is the only non-unistd.h-having platform we support. Gitlab: #2204 --- diff --git a/cmd/tools/CMakeLists.txt b/cmd/tools/CMakeLists.txt index 7726e67af..4e04aade5 100644 --- a/cmd/tools/CMakeLists.txt +++ b/cmd/tools/CMakeLists.txt @@ -124,6 +124,10 @@ add_executable(gml2gv ${FLEX_Gmlscan_OUTPUTS} ) +if(WIN32 AND NOT MINGW) + target_compile_definitions(gml2gv PRIVATE -DYY_NO_UNISTD_H) +endif() + target_include_directories(gml2gv PRIVATE ../../lib ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/cmd/tools/gml2gv.vcxproj b/cmd/tools/gml2gv.vcxproj index 2128fc9d1..69326a94e 100644 --- a/cmd/tools/gml2gv.vcxproj +++ b/cmd/tools/gml2gv.vcxproj @@ -54,7 +54,7 @@ Disabled $(ProjectDir);$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\vcpkg\installed\x86-windows\include;$(SolutionDir);$(SolutionDir)lib;$(SolutionDir)lib\cdt;$(SolutionDir)lib\cgraph;$(SolutionDir)lib\common;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;GVDLL;%(PreprocessorDefinitions) + _DEBUG;_WINDOWS;GVDLL;YY_NO_UNISTD_H;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL @@ -81,7 +81,7 @@ win_bison -dy -Wno-yacc gmlparse.y -o gmlparse.c $(ProjectDir);$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\vcpkg\installed\x86-windows\include;$(SolutionDir);$(SolutionDir)lib;$(SolutionDir)lib\cdt;$(SolutionDir)lib\cgraph;$(SolutionDir)lib\common;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;GVDLL;%(PreprocessorDefinitions) + NDEBUG;_WINDOWS;GVDLL;YY_NO_UNISTD_H;%(PreprocessorDefinitions) Level4 true diff --git a/cmd/tools/gmlscan.l b/cmd/tools/gmlscan.l index e149275d8..4002a3ba7 100644 --- a/cmd/tools/gmlscan.l +++ b/cmd/tools/gmlscan.l @@ -15,10 +15,6 @@ #include #include "config.h" -#ifndef HAVE_UNISTD_H -#define YY_NO_UNISTD_H -#endif - #define GRAPH_EOF_TOKEN '@' /* lex class must be defined below */ static int line_num = 1;