Skip to content

some improvements to the bat code #41

@windowsair

Description

@windowsair

Thank you for your excellent work!

Some of the bat code in the project needed to be modified in my environment in order to continue to run. This is mostly my own problem, but I'd like to say what I think anyway.

1. Find cl.exe

if \"%SYSARCH%\"==\"32\" (\n\
set MSVCVARSDIR=\n\
set VSWHERE=\"%ProgramFiles%\\Microsoft Visual Studio\\Installer\\vswhere.exe\"\n\
) else if \"%SYSARCH%\"==\"64\" (\n\
set MSVCVARSDIR=\\amd64\n\
set VSWHERE=\"%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe\"\n\
)\n\
if exist %VSWHERE% (\n\
for /f \"usebackq delims=\" %%i in (`%VSWHERE% -prerelease -latest -property installationPath`) do (set VSINSTDIR=%%i)\n\
if exist \"!VSINSTDIR!\\VC\\Auxiliary\\Build\\vcvars%SYSARCH%.bat\" (\n\
call \"!VSINSTDIR!\\VC\\Auxiliary\\Build\\vcvars%SYSARCH%.bat\" >nul 2>&1\n\
goto MSVCVarsDone\n\
)\n\
if exist \"!VSINSTDIR!\\..\\..\\VC\\bin%MSVCVARSDIR%\\vcvars%SYSARCH%.bat\" (\n\
call \"!VSINSTDIR!\\..\\..\\VC\\bin%MSVCVARSDIR%\\vcvars%SYSARCH%.bat\" >nul 2>&1\n\
goto MSVCVarsDone\n\
)\n\

On my win10 x64 system, the value of %ProgramFiles(x86)% is C:\Program. It is wrong....
So what about %ProgramFiles% (x86) ? Seems to work fine.

On the other hand, users like me prefer to use the "Tools Command Prompt", in which case cl.exe can be found directly, so perhaps we can just determine if cl.exe is ready to run at the start:

call cl.exe && goto MSVCVarsDone

2. Find git

smp_project_get_dependencies file:

REM Check if git is installed and available
IF "%MSVC_VER%"=="" (
    git status >NUL 2>&1
    IF ERRORLEVEL 1 (
        ECHO A working copy of git was not found. To use this script you must first install git for windows.
        GOTO exitOnError
    )
)

Similarly, perhaps it could be changed to check if git.exe can be executed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions