Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some improvements to the bat code #41

Open
windowsair opened this issue Mar 21, 2022 · 0 comments
Open

some improvements to the bat code #41

windowsair opened this issue Mar 21, 2022 · 0 comments

Comments

@windowsair
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant