diff options
author | glx <glx@openttd.org> | 2020-05-26 21:38:07 +0200 |
---|---|---|
committer | glx22 <glx22@users.noreply.github.com> | 2020-05-26 22:44:18 +0200 |
commit | 2b2f60caf5f4b7db182940e3b9fbb5d2e8129032 (patch) | |
tree | 8369fdd69b1864da79e01d4efafdffb77956cb62 | |
parent | 800ade77021b34adf8daa5ca5de0efaa8df24152 (diff) | |
download | openttd-2b2f60caf5f4b7db182940e3b9fbb5d2e8129032.tar.xz |
Fix: VS 2019 16.6 doesn't like newlines in <SettingsCommandLine>
-rwxr-xr-x | projects/generate | 9 | ||||
-rw-r--r-- | projects/generate.vbs | 11 | ||||
-rw-r--r-- | projects/settings_vs140.vcxproj | 4 | ||||
-rw-r--r-- | projects/settings_vs140.vcxproj.in | 4 | ||||
-rw-r--r-- | projects/settings_vs141.vcxproj | 4 | ||||
-rw-r--r-- | projects/settings_vs141.vcxproj.in | 4 | ||||
-rw-r--r-- | projects/settings_vs142.vcxproj | 4 | ||||
-rw-r--r-- | projects/settings_vs142.vcxproj.in | 4 |
8 files changed, 20 insertions, 24 deletions
diff --git a/projects/generate b/projects/generate index 2078809c8..d1316a232 100755 --- a/projects/generate +++ b/projects/generate @@ -263,19 +263,22 @@ generate() { echo "Generating $2..." # Everything above the !!FILTERS!! marker cat "$ROOT_DIR/projects/$2".in | ${AWK} -v BINMODE=1 -v FILTERS="$3" -v FILES="$1" ' - { CR = (match($0, "\\r$") > 0 ? "\r" : "") } /^$/ { next } /!!FILTERS!!/ { split(FILTERS, filters, "\n"); for (i = 1; filters[i] != ""; i++) { - print filters[i] CR; + line = $0 + gsub(/!!FILTERS!!/, filters[i], line); + print line; } next; } /!!FILES!!/ { split(FILES, files, "\n"); for (i = 1; files[i] != ""; i++) { - print files[i] CR; + line = $0 + gsub(/!!FILES!!/, files[i], line); + print line; } next; } diff --git a/projects/generate.vbs b/projects/generate.vbs index 169f8b689..daeb32b03 100644 --- a/projects/generate.vbs +++ b/projects/generate.vbs @@ -321,21 +321,26 @@ Sub load_baseset_data(dir, langdir, ByRef vcxproj, ByRef files, ByRef langs) End Sub Sub generate(data, dest, data2) - Dim srcfile, destfile, line + Dim srcfile, destfile, line, regexp WScript.Echo "Generating " & FSO.GetFileName(dest) & "..." Set srcfile = FSO.OpenTextFile(dest & ".in", 1, 0, 0) Set destfile = FSO.CreateTextFile(dest, -1, 0) If Not IsNull(data2) Then ' Everything above the !!FILTERS!! marker + Set regexp = New RegExp + regexp.Pattern = "!!FILTERS!!" + regexp.Global = True + line = srcfile.ReadLine() - While line <> "!!FILTERS!!" + While Not regexp.Test(line) If len(line) > 0 Then destfile.WriteLine(line) line = srcfile.ReadLine() Wend ' Our generated content - destfile.WriteLine(data2) + line = regexp.Replace(line, data2) + destfile.WriteLine(line) End If ' Everything above the !!FILES!! marker diff --git a/projects/settings_vs140.vcxproj b/projects/settings_vs140.vcxproj index 9952df47b..b5f515182 100644 --- a/projects/settings_vs140.vcxproj +++ b/projects/settings_vs140.vcxproj @@ -23,9 +23,7 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros"> - <SettingsCommandLine> -..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini - </SettingsCommandLine> + <SettingsCommandLine>..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini</SettingsCommandLine> </PropertyGroup> <PropertyGroup> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\settings\table\</OutDir> diff --git a/projects/settings_vs140.vcxproj.in b/projects/settings_vs140.vcxproj.in index 9bb0cc7f0..dcbbfbd35 100644 --- a/projects/settings_vs140.vcxproj.in +++ b/projects/settings_vs140.vcxproj.in @@ -23,9 +23,7 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros"> - <SettingsCommandLine> -!!FILTERS!! - </SettingsCommandLine> + <SettingsCommandLine>!!FILTERS!!</SettingsCommandLine> </PropertyGroup> <PropertyGroup> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\settings\table\</OutDir> diff --git a/projects/settings_vs141.vcxproj b/projects/settings_vs141.vcxproj index 9c20f1407..b3f687194 100644 --- a/projects/settings_vs141.vcxproj +++ b/projects/settings_vs141.vcxproj @@ -23,9 +23,7 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros"> - <SettingsCommandLine> -..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini - </SettingsCommandLine> + <SettingsCommandLine>..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini</SettingsCommandLine> </PropertyGroup> <PropertyGroup> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\settings\table\</OutDir> diff --git a/projects/settings_vs141.vcxproj.in b/projects/settings_vs141.vcxproj.in index 23e044cc1..1701c99f5 100644 --- a/projects/settings_vs141.vcxproj.in +++ b/projects/settings_vs141.vcxproj.in @@ -23,9 +23,7 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros"> - <SettingsCommandLine> -!!FILTERS!! - </SettingsCommandLine> + <SettingsCommandLine>!!FILTERS!!</SettingsCommandLine> </PropertyGroup> <PropertyGroup> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\settings\table\</OutDir> diff --git a/projects/settings_vs142.vcxproj b/projects/settings_vs142.vcxproj index a2dda134b..e0ed93309 100644 --- a/projects/settings_vs142.vcxproj +++ b/projects/settings_vs142.vcxproj @@ -23,9 +23,7 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros"> - <SettingsCommandLine> -..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini - </SettingsCommandLine> + <SettingsCommandLine>..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini</SettingsCommandLine> </PropertyGroup> <PropertyGroup> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\settings\table\</OutDir> diff --git a/projects/settings_vs142.vcxproj.in b/projects/settings_vs142.vcxproj.in index 3e49b7ca0..4463c573d 100644 --- a/projects/settings_vs142.vcxproj.in +++ b/projects/settings_vs142.vcxproj.in @@ -23,9 +23,7 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros"> - <SettingsCommandLine> -!!FILTERS!! - </SettingsCommandLine> + <SettingsCommandLine>!!FILTERS!!</SettingsCommandLine> </PropertyGroup> <PropertyGroup> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\settings\table\</OutDir> |