2016-12-27 11:30:07 +03:00
|
|
|
@echo on
|
|
|
|
|
2016-12-27 15:38:30 +03:00
|
|
|
:: This script invokes the Visual Studio linker to construct a static library file that can be used outside of Mingw.
|
|
|
|
:: The unicorn.def file that it references below is produced by the Mingw compiler via a linker flag.
|
2016-12-27 11:30:07 +03:00
|
|
|
:: The arch (x86 or x64) we are working on should be passed via the first argument to this script.
|
|
|
|
|
|
|
|
:: Look up the Visual Studio install path via the registry
|
|
|
|
:: http://stackoverflow.com/questions/445167/how-can-i-get-the-value-of-a-registry-key-from-within-a-batch-script
|
2016-12-27 15:38:30 +03:00
|
|
|
:: If anyone ever tells you that Windows is a reasonable operating system, they are wrong
|
2016-12-27 11:30:07 +03:00
|
|
|
FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0" /v InstallDir`) DO (
|
|
|
|
set appdir=%%A %%B
|
|
|
|
)
|
|
|
|
|
2016-12-27 15:38:30 +03:00
|
|
|
:: Add the Visual Studio binaries to our path and run the linker
|
2016-12-27 11:30:07 +03:00
|
|
|
call "%appdir%..\..\VC\vcvarsall.bat" %1
|
|
|
|
call lib /machine:%1 /def:unicorn.def
|