Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlateralusX <lateralusx.github@gmail.com>2019-02-01 15:17:28 +0300
committerlateralusX <lateralusx.github@gmail.com>2019-02-05 20:34:20 +0300
commitdfa2fe6d2b0988bcf66c707dd41c809def4bace0 (patch)
tree5c39c98a1025f58846728e1eb7128301a7b8d409 /msvc/winsetup.bat
parentc39e3e1200121563100fb174ee62166fb46298ed (diff)
Add better support to dynamically setup content of config.h in Windows MSVC builds.
When running tests on CI the runtime is configured from autogen.sh script. When running fullaot there are a couple of features not supported so they are disabled. The problem is that the MSVC Windows builds have its own winconfig.h template, losing all the disabled features from configures config.h. This commit adds support to detect the disable defines from configures config.h if one exists. Since the complexity of this step increases the work previously done in winsetup.bat has been moved into a msbuild target that is used from both within VS build as well as winsetup.bat (there are a couple of other builds using that bat file, so won't remove it). The winconfig.h template we had is quite outdated compared to what’s generated by configure. This commit also updates the winconfig.h to closer match what generated for corresponding mingw build but keep all the Windows specific configurations included in current version.
Diffstat (limited to 'msvc/winsetup.bat')
-rwxr-xr-xmsvc/winsetup.bat96
1 files changed, 4 insertions, 92 deletions
diff --git a/msvc/winsetup.bat b/msvc/winsetup.bat
index 44442f06d8c..2d45fc765c8 100755
--- a/msvc/winsetup.bat
+++ b/msvc/winsetup.bat
@@ -1,94 +1,6 @@
-@ECHO off
-SetLocal
+@echo off
+setlocal
-SET CONFIG_H="%~dp0..\config.h"
-SET CYG_CONFIG_H="%~dp0..\cygconfig.h"
-SET WIN_CONFIG_H="%~dp0..\winconfig.h"
-SET CONFIGURE_AC="%~dp0..\configure.ac"
-SET VERSION_H="%~dp0..\mono\mini\version.h"
-SET OPTIONAL_DEFINES=%~1
+call "msbuild.exe" /t:RunWinConfigSetup mono.winconfig.targets
-ECHO Setting up Mono configuration headers...
-
-:: generate unique temp file path
-uuidgen > nul 2>&1 || goto no_uuidgen
-for /f %%a in ('uuidgen') do set CONFIG_H_TEMP=%%a
-goto :got_temp
-
-:no_uuidgen
-:: Random isn't very random or unique. %time% and %date% is not random but fairly unique.
-set CONFIG_H_TEMP=%~n0%random%%time%%date%
-
-:got_temp
-:: Remove special characters.
-set CONFIG_H_TEMP=%CONFIG_H_TEMP:-=%
-set CONFIG_H_TEMP=%CONFIG_H_TEMP:\=%
-set CONFIG_H_TEMP=%CONFIG_H_TEMP:/=%
-set CONFIG_H_TEMP=%CONFIG_H_TEMP::=%
-set CONFIG_H_TEMP=%CONFIG_H_TEMP: =%
-set CONFIG_H_TEMP=%CONFIG_H_TEMP:.=%
-set CONFIG_H_TEMP=%temp%\CONFIG_H_TEMP%CONFIG_H_TEMP%
-mkdir "%CONFIG_H_TEMP%\.." 2>nul
-set CONFIG_H_TEMP="%CONFIG_H_TEMP%"
-
-REM Backup existing config.h into cygconfig.h if its not already replaced.
-if exist %CONFIG_H% (
- findstr /i /r /c:"#include *\"cygconfig.h\"" %CONFIG_H% >nul || copy /y %CONFIG_h% %CYG_CONFIG_H%
-)
-
-:: Extract MONO_VERSION from configure.ac.
-for /f "delims=[] tokens=2" %%a in ('findstr /b /c:"AC_INIT(mono, [" %CONFIGURE_AC%') do (
- set MONO_VERSION=%%a
-)
-
-:: Split MONO_VERSION into three parts.
-for /f "delims=. tokens=1-3" %%a in ('echo %MONO_VERSION%') do (
- set MONO_VERSION_MAJOR=%%a
- set MONO_VERSION_MINOR=%%b
- set MONO_VERSION_PATCH=%%c
-)
-:: configure.ac hardcodes this.
-set MONO_VERSION_PATCH=00
-
-:: Extract MONO_CORLIB_VERSION from configure.ac.
-for /f "tokens=*" %%a in ('findstr /b /c:MONO_CORLIB_VERSION= %CONFIGURE_AC%') do set %%a
-
-:: Pad out version pieces to 2 characters with zeros on left.
-if "%MONO_VERSION_MAJOR:~1%" == "" set MONO_VERSION_MAJOR=0%MONO_VERSION_MAJOR%
-if "%MONO_VERSION_MINOR:~1%" == "" set MONO_VERSION_MINOR=0%MONO_VERSION_MINOR%
-
-:: Remove every define VERSION from winconfig.h and add what we want.
-findstr /v /b /i /c:"#define PACKAGE_VERSION " /c:"#define VERSION " /c:"#define MONO_CORLIB_VERSION " %WIN_CONFIG_H% > %CONFIG_H_TEMP%
-
-: Setup dynamic section of config.h
-echo #ifdef _MSC_VER >> %CONFIG_H_TEMP%
-echo #define PACKAGE_VERSION "%MONO_VERSION%" >> %CONFIG_H_TEMP%
-echo #define VERSION "%MONO_VERSION%" >> %CONFIG_H_TEMP%
-echo #define MONO_CORLIB_VERSION "%MONO_CORLIB_VERSION%" >> %CONFIG_H_TEMP%
-
-:: Add dynamic configuration parameters affecting msvc build.
-for %%a in (%OPTIONAL_DEFINES%) do (
- echo #ifndef %%a >> %CONFIG_H_TEMP%
- echo #define %%a 1 >> %CONFIG_H_TEMP%
- echo #endif >> %CONFIG_H_TEMP%
-)
-
-echo #endif >> %CONFIG_H_TEMP%
-
-echo #if defined(ENABLE_LLVM) ^&^& defined(HOST_WIN32) ^&^& defined(TARGET_WIN32) ^&^& (!defined(TARGET_AMD64) ^|^| !defined(_MSC_VER)) >> %CONFIG_H_TEMP%
-echo #error LLVM for host=Windows and target=Windows is only supported on x64 MSVC build. >> %CONFIG_H_TEMP%
-echo #endif >> %CONFIG_H_TEMP%
-
-:: If the file is different, replace it.
-fc %CONFIG_H_TEMP% %CONFIG_H% >nul 2>&1 || move /y %CONFIG_H_TEMP% %CONFIG_H%
-del %CONFIG_H_TEMP% 2>nul
-
-echo #define FULL_VERSION "Visual Studio built mono" > %CONFIG_H_TEMP%
-fc %CONFIG_H_TEMP% %VERSION_H% >nul 2>&1 || move /y %CONFIG_H_TEMP% %VERSION_H%
-del %CONFIG_H_TEMP% 2>nul
-
-:: Log environment variables that start "mono".
-set MONO
-
-ECHO Successfully setup Mono configuration headers.
-EXIT /b 0
+exit /b 0