Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » TheIDE support for Visual Studio Build Tools 2022?
TheIDE support for Visual Studio Build Tools 2022? [message #57777] |
Mon, 13 December 2021 10:04  |
Tom1
Messages: 1301 Registered: March 2007
|
Ultimate Contributor |
|
|
Hi,
I just set up a new computer with Windows 11 and Visual Studio Build Tools 2022. It seems that TheIDE is not yet capable of detecting the compilers and tools (2017, 2019 and 2022) that come with this release.
Could these be added to the automatic setup of build methods?
Best regards,
Tom
|
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57824 is a reply to message #57822] |
Sun, 19 December 2021 15:44   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
I tried, somehow I could not figure it out.
void InstantSetup()
{
bool dirty = false;
String default_method;
String bin = GetExeDirFile("bin");
if(DirectoryExists(bin + "/clang"))
for(int x64 = 0; x64 < 2; x64++) {
String method = x64 ? "CLANGx64" : "CLANG";
#ifdef INSTANT_TESTING
method << "Test";
#endif
VectorMap<String, String> bm = GetMethodVars(method);
Vector<String> bins = Split(bm.Get("PATH", ""), ';');
Vector<String> incs = Split(bm.Get("INCLUDE", ""), ';');
Vector<String> libs = Split(bm.Get("LIB", ""), ';');
#ifdef INSTANT_TESTING
if(CheckDirs(bins, 3) && CheckDirs(incs, 2) && CheckDirs(libs, 2)) {
if(!x64)
default_method = Nvl(default_method, method);
continue;
}
#endif
bmSet(bm, "BUILDER", "CLANG");
bmSet(bm, "COMPILER", x64 ? "" : "i686-w64-mingw32-c++");
bmSet(bm, "COMMON_OPTIONS", "");
bmSet(bm, "COMMON_CPP_OPTIONS", "");
bmSet(bm, "COMMON_C_OPTIONS", "");
bmSet(bm, "COMMON_LINK", "");
bmSet(bm, "COMMON_FLAGS", "");
bmSet(bm, "DEBUG_INFO", "2");
bmSet(bm, "DEBUG_BLITZ", "1");
bmSet(bm, "DEBUG_LINKMODE", "0");
bmSet(bm, "DEBUG_OPTIONS", "");
bmSet(bm, "DEBUG_FLAGS", "");
bmSet(bm, "DEBUG_LINK", "-Wl,--stack,20000000");
bmSet(bm, "RELEASE_BLITZ", "1");
bmSet(bm, "RELEASE_LINKMODE", "0");
bmSet(bm, "RELEASE_OPTIONS", "-O3 ");
bmSet(bm, "RELEASE_FLAGS", "");
bmSet(bm, "RELEASE_LINK", "-Wl,--stack,20000000");
bmSet(bm, "DEBUGGER", "gdb");
bmSet(bm, "ALLOW_PRECOMPILED_HEADERS", "1");
bmSet(bm, "DISABLE_BLITZ", "");
// bmSet(bm, "LINKMODE_LOCK", "0");
String clang = bin + "/clang";
bins.At(0) = clang + "/bin";
bins.At(1) = clang + (x64 ? "/x86_64-w64-mingw32/bin" : "/i686-w64-mingw32/bin");
bins.At(2) = GetExeDirFile(x64 ? "bin/SDL2/lib/x64" : "bin/SDL2/lib/x86");
bins.At(3) = GetExeDirFile(x64 ? "bin/pgsql/x64/bin" : "bin/pgsql/x86/bin");
bins.At(4) = GetExeDirFile(x64 ? "bin/mysql/lib64" : "bin/mysql/lib32");
incs.At(0) = GetExeDirFile("bin/SDL2/include");
incs.At(1) = GetExeDirFile(x64 ? "bin/pgsql/x64/include" : "bin/pgsql/x86/include");
incs.At(2) = GetExeDirFile(x64 ? "bin/mysql/include" : "bin/mysql/include");
libs.At(0) = GetExeDirFile(x64 ? "bin/SDL2/lib/x64" : "bin/SDL2/lib/x86");
libs.At(1) = GetExeDirFile(x64 ? "bin/pgsql/x64/lib" : "bin/pgsql/x86/lib");
libs.At(2) = GetExeDirFile(x64 ? "bin/mysql/lib64" : "bin/mysql/lib32");
bm.GetAdd("PATH") = Join(bins, ";");
bm.GetAdd("INCLUDE") = Join(incs, ";");
bm.GetAdd("LIB") = Join(libs, ";");
SaveVarFile(ConfigFile(method + ".bm"), bm);
dirty = true;
if(x64)
default_method = Nvl(default_method, method);
}
enum { VS_2015, VS_2017, BT_2017, VS_2019, VSP_2019, BT_2019, VS_2022 };
DirFinder df;
for(int version = /*VS_2012*/VS_2022; version <= VS_2022; version++)
for(int x64 = 0; x64 < 2; x64++) {
// String x86method = decode(version, VS_2015, "MSVS15",
// VS_2017, "MSVS17", BT_2017, "MSBT17",
// VS_2019, "MSVS19", VSP_2019, "MSVC19P", BT_2019, "MSBT19",
// "MSBT");
String x86method = decode(version, VS_2015, "MSVS15",
VS_2017, "MSVS17", BT_2017, "MSBT17",
VS_2019, "MSVS19", VSP_2019, "MSVC19P", BT_2019, "MSBT19",
VS_2022, "MSVS22", "MSVS22");
String x64s = x64 ? "x64" : "";
String method = x86method + x64s;
// String builder = decode(version, VS_2015, "MSC15",
// VS_2017, "MSC17", BT_2017, "MSC17",
// VS_2019, "MSC19", VSP_2019, "MSC19", BT_2019, "MSC19",
// "MSC19"
String builder = decode(version, VS_2015, "MSC15",
VS_2017, "MSC17", BT_2017, "MSC17",
VS_2019, "MSC19", VSP_2019, "MSC19", BT_2019, "MSC19",
VS_2022, "MSC22", "MSC22"
) + ToUpper(x64s);
#ifdef INSTANT_TESTING
method << "Test";
#endif
String vc, bin, inc, lib, kit81;
VectorMap<String, String> bm = GetMethodVars(method);
Vector<String> bins = Split(bm.Get("PATH", ""), ';');
Vector<String> incs = Split(bm.Get("INCLUDE", ""), ';');
Vector<String> libs = Split(bm.Get("LIB", ""), ';');
#ifdef INSTANT_TESTING
if(CheckDirs(bins, 2) && CheckDirs(incs, 4) && CheckDirs(libs, 3)) {
if(x64)
default_method = Nvl(default_method, x86method);
continue;
}
#endif
if(version == VS_2015)
vc = df.Get("/microsoft visual studio 14.0/vc", "bin/cl.exe;bin/lib.exe;bin/link.exe;bin/mspdb140.dll");
else
// vc = df.Get(decode(version, BT_2017, "/microsoft visual studio/2017/buildtools/vc/tools/msvc",
// VS_2017, "/microsoft visual studio/2017/community/vc/tools/msvc",
// BT_2019, "/microsoft visual studio/2019/buildtools/vc/tools/msvc",
// VS_2019, "/microsoft visual studio/2019/community/vc/tools/msvc",
// VSP_2019, "/microsoft visual studio/2019/professional/vc/tools/msvc",
// ""),
vc = df.Get(decode(version, BT_2017, "/microsoft visual studio/2017/buildtools/vc/tools/msvc",
VS_2017, "/microsoft visual studio/2017/community/vc/tools/msvc",
BT_2019, "/microsoft visual studio/2019/buildtools/vc/tools/msvc",
VS_2019, "/microsoft visual studio/2019/community/vc/tools/msvc",
VSP_2019, "/microsoft visual studio/2019/professional/vc/tools/msvc",
VS_2022, "/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC",
//VS_2022, "/microsoft visual studio/2022/community/vc/tools/msvc",
""),
x64 ? "bin/hostx64/x64/cl.exe;bin/hostx64/x64/mspdb140.dll"
: "bin/hostx86/x86/cl.exe;bin/hostx86/x86/mspdb140.dll");
bin = df.Get("/windows kits/10/bin", "x86/makecat.exe;x86/accevent.exe");
inc = df.Get("/windows kits/10", "um/adhoc.h");
lib = df.Get("/windows kits/10", "um/x86/kernel32.lib");
for unknown reason, vc is empty even when I am sure I have vs community 2022 installed in default location.
Also, can we make it smarter? the directory structure is quite stable across versions: they seems to differ by the year number. Ideally we can assume future version will not break the tradition until it does. That way we don't need to modify source code every time VS has a new version.
|
|
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57831 is a reply to message #57825] |
Mon, 20 December 2021 09:26   |
Tom1
Messages: 1301 Registered: March 2007
|
Ultimate Contributor |
|
|
Lance wrote on Sun, 19 December 2021 16:54Pasted code is a bit messy. here is screenshots of changes I made. Not that I think what I have done will be helpful, I am just curious why it doesn't work.
Lance,
I had to tamper with the builder too to add MSC22 and MSC22X64 build methods. Please merge the files I posted above, add your VS_2022 code just ahead of BT_2022 and see if it works for VS.
Best regards,
Tom
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57832 is a reply to message #57830] |
Mon, 20 December 2021 09:40   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Mon, 20 December 2021 09:08mirek wrote on Sun, 19 December 2021 16:16Sure. Why do not you try yourself? I would gladly merged a patch...
It should be really easy, it might even be as easy as adding single line around ide/InstantSetup.cpp:237 (with new enum constant for 2022)
Mirek
Hi,
Yes, why not... now that you pointed out the correct spot within 400k lines of code.
Best regards,
Tom
Most appreciated. Applying.
Is there a reason to exclude BT_2019 here:
ide/InstantSetup.cpp:357
bmSet(bm, "DEBUGGER", findarg(version, BT_2017, BT_2019, BT_2022) >= 0 ? String()
?
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57833 is a reply to message #57832] |
Mon, 20 December 2021 10:17   |
Tom1
Messages: 1301 Registered: March 2007
|
Ultimate Contributor |
|
|
mirek wrote on Mon, 20 December 2021 10:40Tom1 wrote on Mon, 20 December 2021 09:08mirek wrote on Sun, 19 December 2021 16:16Sure. Why do not you try yourself? I would gladly merged a patch...
It should be really easy, it might even be as easy as adding single line around ide/InstantSetup.cpp:237 (with new enum constant for 2022)
Mirek
Hi,
Yes, why not... now that you pointed out the correct spot within 400k lines of code.
Best regards,
Tom
Most appreciated. Applying.
Is there a reason to exclude BT_2019 here:
ide/InstantSetup.cpp:357
bmSet(bm, "DEBUGGER", findarg(version, BT_2017, BT_2019, BT_2022) >= 0 ? String()
?
No reason. I have just misunderstood the findarg. Please fix my mistakes...
Best regards,
Tom
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57834 is a reply to message #57831] |
Mon, 20 December 2021 13:35   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Hi Tom:
I could not get it work. But it's good to notice that MscBuilder.cpp also need to be revised.
Following is the lines that I have changed.
enum { VS_2015, VS_2017, BT_2017, VS_2019, VSP_2019, BT_2019, VS_2022, BT_2022 };
DirFinder df;
for(int version = VS_2015; version <= BT_2022; version++)
for(int x64 = 0; x64 < 2; x64++) {
String x86method = decode(version, VS_2015, "MSVS15",
VS_2017, "MSVS17", BT_2017, "MSBT17",
VS_2019, "MSVS19", VSP_2019, "MSVC19P",
BT_2019, "MSBT19",
VS_2022, "MSVS22",
BT_2022, "MSBT22",
"MSBT");
String x64s = x64 ? "x64" : "";
String method = x86method + x64s;
String builder = decode(version, VS_2015, "MSC15",
VS_2017, "MSC17", BT_2017, "MSC17",
VS_2019, "MSC19", VSP_2019, "MSC19", BT_2019, "MSC19",
VS_2022, "MSC22",
BT_2022, "MSC22",
"MSC22"
) + ToUpper(x64s);
......
if(version == VS_2015)
vc = df.Get("/microsoft visual studio 14.0/vc", "bin/cl.exe;bin/lib.exe;bin/link.exe;bin/mspdb140.dll");
else
vc = df.Get(decode(version, BT_2017, "/microsoft visual studio/2017/buildtools/vc/tools/msvc",
VS_2017, "/microsoft visual studio/2017/community/vc/tools/msvc",
BT_2019, "/microsoft visual studio/2019/buildtools/vc/tools/msvc",
VS_2019, "/microsoft visual studio/2019/community/vc/tools/msvc",
VSP_2019, "/microsoft visual studio/2019/professional/vc/tools/msvc",
VS_2022, "/microsoft visual studio/2022/community/vc/tools/msvc",
BT_2022, "/microsoft visual studio/2022/buildtools/vc/tools/msvc",
""),
x64 ? "bin/hostx64/x64/cl.exe;bin/hostx64/x64/mspdb140.dll"
: "bin/hostx86/x86/cl.exe;bin/hostx86/x86/mspdb140.dll");
Not sure what I have missed.
BTW, how do you develop IDE? I have to build it and overwrite my current \upp\theide.exe with newly generated one.
I installed VS Build Tools 2022, and could not get it work either. One interesting thing I noticed is that VS community is installed under "program files" while VS build tools 2022 is installed "program files (x86)". Not that it has anything to do with the problem I am having.
[Updated on: Mon, 20 December 2021 13:58] Report message to a moderator
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57836 is a reply to message #57834] |
Mon, 20 December 2021 14:17   |
Tom1
Messages: 1301 Registered: March 2007
|
Ultimate Contributor |
|
|
Hi Lance,
I might use a parallel upp installation in e.g. c:\upp2 for tinkering with theide. (However, I felt lucky enough to do it directly on my live copy...)
Did you remember to run menu "Setup > Automatic build methods setup" after restarting theide? Nothing else really comes to mind...
Best regards,
Tom
|
|
|
|
|
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57850 is a reply to message #57847] |
Tue, 21 December 2021 12:56   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello Tom,
Could you add support for Visual Studio Professional? The only difference is the path (professional):
VSP_2022, "/microsoft visual studio/2022/professional/vc/tools/msvc",
It should be placed after VS_2022:
VS_2019, "MSC19", VSP_2019, "MSC19", BT_2019, "MSC19",
VS_2022, "MSC22", VSP_2022, "MSC22", BT_2022, "MSC22",
Klugier
U++ - one framework to rule them all.
[Updated on: Tue, 21 December 2021 12:56] Report message to a moderator
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57851 is a reply to message #57850] |
Tue, 21 December 2021 13:15   |
Tom1
Messages: 1301 Registered: March 2007
|
Ultimate Contributor |
|
|
Klugier wrote on Tue, 21 December 2021 13:56Hello Tom,
Could you add support for Visual Studio Professional? The only difference is the path (professional):
VSP_2022, "/microsoft visual studio/2022/professional/vc/tools/msvc",
It should be placed after VS_2022:
VS_2019, "MSC19", VSP_2019, "MSC19", BT_2019, "MSC19",
VS_2022, "MSC22", VSP_2022, "MSC22", BT_2022, "MSC22",
Klugier
Hi Klugier,
I'm afraid there is not much I can do in this case... I don't have the VS 2022 professional. Nor do I have commit rights, so it's probably best you add the lines, test it and either commit it yourself, if you have the rights or give it to Mirek to deal with, if you don't.
Best regards,
Tom
|
|
|
Re: TheIDE support for Visual Studio Build Tools 2022? [message #57863 is a reply to message #57850] |
Thu, 23 December 2021 08:25   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Klugier wrote on Tue, 21 December 2021 12:56Hello Tom,
Could you add support for Visual Studio Professional? The only difference is the path (professional):
VSP_2022, "/microsoft visual studio/2022/professional/vc/tools/msvc",
It should be placed after VS_2022:
VS_2019, "MSC19", VSP_2019, "MSC19", BT_2019, "MSC19",
VS_2022, "MSC22", VSP_2022, "MSC22", BT_2022, "MSC22",
Klugier
If you have it tested, why not PR?
|
|
|
|
|
Goto Forum:
Current Time: Thu Apr 24 18:32:20 CEST 2025
Total time taken to generate the page: 0.02414 seconds
|