This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to deal with Visual-Studio vcvars bat?

Tags: None
(comma "," separated)
Escain
Registered Member
Posts
7
Karma
0
Hello :-)

I am trying to get working a minimum project on KDevelop for Windows with Visual-Studio (cl.exe).

The bad design of VS make it requiring to run a script (vcvars) to set a number of variables which indicate the compiler about includes, libraries, etc.

KDevelop, as a general tool, obviously do not manage this, so I wonder how to achieve the same result.

- The CMakeList files need to be cross-platform, so I do not want to add the step in it.
- Setting all the variables manually is very error prone, especially if Visual Studio decide to change it in the next version. It is usually not good to have such long profile anyway,

Is there a better way to achieve this?

Thanks you in advance for any help
Kind regards,
Adrian M.
User avatar
kfunk
KDE Developer
Posts
53
Karma
0
OS
Heya,

happy to see you using KDevelop on Windows.

Did you already see our instructions page that explain how to use MSVC under Windows? See https://userbase.kde.org/KDevelop4/Manu ... al_C.2B.2B

There should be a dedicated start menu item just for starting KDevelop in a MSVC environment (basically runs vcvarsall.bat & then kdevelop.exe). If this item isn't available, please check out the latest installer here: https://www.kdevelop.org/download
Escain
Registered Member
Posts
7
Karma
0
Thanks for the fast answer kfunk!

Yes, I am using Kdevelop for some time at home (on linux) and really love it. I am trying to make it available at work too (which is windows).

I managed to capture the console on start-up, and it seem not able to find my VS installation :
Code: Select all
C:\Program FIles\KDevelop>if DEFINED VS140COMNTOOLS <SET "base=D:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\"> else <IF DEFINED VS120COMNTOOLS <SET "base=D:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" > else <IF DEFINED VS110COMNTOOLS < SET "base=C:\Program Files <x86>\Microsoft Visual Studio 11.0\Common7\Tools\">> else <IF DEFINED VS100COMNTOOLS <SET "base=C:\Program Files <x86>\Microsoft Visual Studio 10.0\Common7\Tools\"> else <START CMD /C "The Microsoft Visual C++ compiler was not found on your system, you might not be able to compile programs. && PAUSE" > > > >

C:\Program Files\KDevelop>SET script="!base!/../../VC/vcvarsall.bat"

C:\Program Files\KDevelop>CALL "D:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\/../../VC/vcvarsall.bat"
ERROR: The system was unable to find the specified registry key or value.


In any case, that solution seem to miss some possibilities: How to build different versions: 64 vs 32 bits, vc12 or vc14, etc.?
User avatar
kfunk
KDE Developer
Posts
53
Karma
0
OS
C:\Program Files\KDevelop>CALL "D:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\/../../VC/vcvarsall.bat"
ERROR: The system was unable to find the specified registry key or value.

Hmmm... Does "D:\Program Files\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" exist for you?

Regarding targeting different platform toolsets: Indeed, that's not easily possible with KDevelop yet. There's one easy solution to it, though:

Start cmd.exe, then run:
Code: Select all
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" <yourargs>
"C:\Program Files\KDevelop\bin\kdevelop.exe" --ps

=> KDevelop starts with whatever environment you set.
Escain
Registered Member
Posts
7
Karma
0
Ok, that works! Thanks you.

I also had some issues with an env. variable hiding the required one: some missconfiguration not directly related with KDevelop but with my tries.

>>Regarding targeting different platform toolsets: Indeed, that's not easily possible with KDevelop yet.

I understand, KDevelop is still by far my favorite.
Currently we have the possibility to set several "Environment groups". There is also a "Build Sequence" list.
IMO, the missing part is to allows duplicated projects in the build sequence, and having a different configuration for each. This would allows setting different compilers, and build them in any combination.
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
Could be the forward vs. backward slashes issue, which we since fixed. Hopefully 5.0.3 will work without this error.


I'm working on the KDevelop IDE.
User avatar
kfunk
KDE Developer
Posts
53
Karma
0
OS
For the reference, Sven talks about this commit: https://commits.kde.org/kdevelop/ba5c2f ... f6f33c87da


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]