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

Update the build scripts on Windows to use a compiler that compiles without errors #253

Open
mrmixer opened this issue May 15, 2020 · 2 comments
Labels
feature-request The issue has to be solved with some kind of new feature, minor or major.

Comments

@mrmixer
Copy link

mrmixer commented May 15, 2020

The build script on Windows will try to call vcvarsall.bat, but it first tries to use older versions of visual studio that aren't able to compile 4coder out of the box. For example I have Visual Studio 2012 and Visual Studio 2017 installed, and the script uses VS2012 since it's the first version available in the list in setup_cl_generic.bat. But VS2012 doesn't compile 4coder out of the box.

So maybe put the versions that don't compile out of the box last in the list ? For reference VS2012 is Visual Studio 11.

Another change would be to add some quotes around 2 lines to allow the script to work if there is a space in folder path.

On line 27

if "%target%" == "" set target="%custom_root%\4coder_default_bindings.cpp"

On line 39

set opts=%opts% -I"%custom_root%"

The script will still fail if there is a space and it needs to call setup_cl_x64.bat though. Similarly if the path contains ( or ), the call to setup_cl_x64.bat will fail. But I can't seem to figure those one out.

@mrmixer mrmixer added the feature-request The issue has to be solved with some kind of new feature, minor or major. label May 15, 2020
@mrmixer
Copy link
Author

mrmixer commented May 21, 2020

I was wondering why the space and parenthesis in setup_cl_generic.bat didn't cause any problems. It turns out we just need to add an extra set of parenthesis in the line that calls setup_cl_x64.bat.

if NOT "%Platform%" == "X64" ( IF NOT "%Platform%" == "x64" (call "%custom_bin%\setup_cl_x64.bat"))

And add quotes in setup_cl_x64.bat.

"%SCRIPTS_PATH%"\setup_cl_generic.bat amd64

And the same thing in the 32bit versions.

@mrmixer
Copy link
Author

mrmixer commented May 24, 2020

There is yet another issue. If setup_cl_x64.bat calls vcvarsall.bat from Visual Studio 2017 (and newer I suppose), the working directory will be set to C:\users\user_name\source. That means that if you want to specify a filename to compile to the build script, you would need to specify an absolute path. And that the build will happen in the wrong location (maybe ?).

This can be fix by "calling" the drive letter after calling setup_cl_x64.bat. Calling cd %location% doesn't work since on Windows you can't use cd to change directory between drives.

set drive=%cd:~0,2%
set location=%cd%
set me="%~dp0"
cd %me%
cd ..
set custom_root=%cd%
set custom_bin=%custom_root%\bin
cd %location%

if NOT "%Platform%" == "X64" ( IF NOT "%Platform%" == "x64" (call "%custom_bin%\setup_cl_x64.bat"))

%drive%
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request The issue has to be solved with some kind of new feature, minor or major.
Projects
None yet
Development

No branches or pull requests

1 participant