xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.22k stars 791 forks source link

repeated checks for compiler and SDK slow down the progress. #4073

Open 1821746019 opened 1 year ago

1821746019 commented 1 year ago

Is your feature request related to a problem? Please describe.

I use xmake in Visual Studio and I enable the plugin.vsxmake.autoupdate. Every time I change xmake.lua to modify the structure of the project or add files for the target, it consumes much time (5~6s) during update vsxmake project -k vsxmake. I found that there are some repeated checks for the compiler and SDK. Is it possible to check only once for better startup speed?

Build started...
1>------ Build started: Project: my_injector_cmd, Configuration: debug x64 ------
1>$xmake config -y  -P . -p windows -m debug -a x64 -o "build"
1>checking for Microsoft Visual Studio (x64) version ... 2022
1>checking for Microsoft C/C++ Compiler (x64) version ... 19.36.32537
1>checking for Qt SDK directory ... D:/Qt/Qt5/Qt5.15.10-Windows-x86_64-VS2022-17.6.2
1>checking for Qt SDK version ... 5.15.10
1>EXEC : warning : .\xmake.lua:48: cannot match add_files("src\my_injector_cmd\*.ixx") in target(my_injector_cmd)
1>$xmake build -y  -P . -w "my_injector_cmd"
1>[  0%]: generating.module.deps ..\..\..\repository\useful_library\c++\by_myself\braveLib.cpp
1>[ 35%]: archiving.debug hooker.lib
1>[ 72%]: linking.debug my_injector.dll
1>[ 94%]: linking.debug my_injector_cmd.exe
1>update vsxmake project -k vsxmake . ..
1>checking for debug.x64 ...
1>checking for Microsoft Visual Studio (x64) version ... 2022
1>checking for Microsoft C/C++ Compiler (x64) version ... 19.36.32537
1>checking for Qt SDK directory ... D:/Qt/Qt5/Qt5.15.10-Windows-x86_64-VS2022-17.6.2
1>checking for Qt SDK version ... 5.15.10
1>checking for debug.x86 ...
1>checking for Microsoft Visual Studio (x86) version ... 2022
1>checking for Microsoft C/C++ Compiler (x86) version ... 19.36.32537
1>checking for Microsoft Visual Studio (x64) version ... 2022
1>checking for Microsoft C/C++ Compiler (x64) version ... 19.36.32537
1>checking for Qt SDK directory ... D:/Qt/Qt5/Qt5.15.10-Windows-x86_64-VS2022-17.6.2
1>checking for Qt SDK version ... 5.15.10
1>checking for release.x64 ...
1>checking for Microsoft Visual Studio (x64) version ... 2022
1>checking for Microsoft C/C++ Compiler (x64) version ... 19.36.32537
1>checking for Qt SDK directory ... D:/Qt/Qt5/Qt5.15.10-Windows-x86_64-VS2022-17.6.2
1>checking for Qt SDK version ... 5.15.10
1>checking for release.x86 ...
1>checking for Microsoft Visual Studio (x86) version ... 2022
1>checking for Microsoft C/C++ Compiler (x86) version ... 19.36.32537
1>checking for Microsoft Visual Studio (x64) version ... 2022
1>checking for Microsoft C/C++ Compiler (x64) version ... 19.36.32537
1>checking for Qt SDK directory ... D:/Qt/Qt5/Qt5.15.10-Windows-x86_64-VS2022-17.6.2
1>checking for Qt SDK version ... 5.15.10
1>create ok!
1>update vsxmake project ok
1>[100%]: build ok, spent 0.828s
1>EXEC : warning : .\xmake.lua:48: cannot match add_files("src\my_injector_cmd\*.ixx") in target(my_injector_cmd)
1>Done building project "my_injector_cmd.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 10:18 PM and took 06.582 seconds ==========

Describe the solution you'd like

better startup speed.

Describe alternatives you've considered

No response

Additional context

No response

waruqi commented 1 year ago

The vs probe has a global cache and won't take much time. It is possible that the detection of qt directories is causing more time, but there is no way to optimise this at the moment. You can try to remove some unneeded configurations.

xmake project -k vsxmake -m debug -a x64

only generate for debug/x64

SirLynix commented 1 year ago

I have a large project using a lot of packages and project generation takes 20-25s because of it. I think it could be improved because most packages are the same between my modes, and could be fetched only once.