-
-
Notifications
You must be signed in to change notification settings - Fork 780
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
vsxmake generator: Add a BuildAll target #2969
Comments
Great, but I also don't know how better to implement it, perhaps you could refer to the cmake generator. |
It's should be easy to implement, it's like a regular target which will trigger xmake, but instead of triggering My only difficulty is to generate this file with the current .vcxproj generation. |
maybe you just need add a phony target and disable it by default. rule("plugin.vsxmake.buildall")
on_buildcmd(function(batchcmds)
-- add build all command
end)
target("BuildAll")
set_kind("phony")
set_default(false)
add_rules("plugin.vsxmake.buildall") and UpdateVS too. we can add |
I though of that, but that won't prevent visual studio from starting two xmake process per targets when "build solution" is triggered. I think it would be best to have it as a part of the vsxmake generator, as it's a common need. |
no, use rule/batchcmds will generate only one xmake process when you click BuildAll. It just add custom command in vcproj. |
Yes, but with that the "build solution" button won't have a correct behavior, which means the shortcut control+shift+B visual studio users are used to will rebuild a lot of files multiple times. This is the main issue which cannot be fixed by a user project. |
? if we use BuildAll target + rule/batchcmds, and add |
oh, got it. |
I will try to implement this. I was also thinking of reworking vsxmake projects to use "Makefile" type which allows to override Visual Studio behavior when compiling, for example: <PropertyGroup>
<NMakeBuildCommandLine>$(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) && $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(_XmakeTarget)</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>$(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) && $(_XmakeExecutable) build -r $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(_XmakeTarget)</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>$(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) && $(_XmakeExecutable) clean $(_XmakeCommonFlags) $(_XmakeCleanFlags) $(_XmakeTarget)</NMakeCleanCommandLine>
<NMakeOutput>$(OutDir)$(TargetName)$(TargetExt)</NMakeOutput>
</PropertyGroup> This is similar to what Unreal Engine does (since it uses a custom build tool), what do you think? |
NMakeBuildCommandLine will override whole vs build command? |
Yes, when the project has type "Makefile" it expects you to give build commands and bypasses normal VS behavior. It means all projects use the "Makefile" configuration type instead of binary/shared/static but those are not used anyway since xmake handles compilation. https://learn.microsoft.com/en-us/cpp/build/reference/nmake-property-page?view=msvc-170 |
This seems to be a nice feature. you can try it. |
One simple solution is: set all other projects to non-default target, only BuildAll project is the default target. Then build solution will build the BuildAll project only. But I cannot call xmake again inside on_buildcmd, no matter what I used: os.run, task.run, process.open, all failed.
|
Is your feature request related to a problem? Please describe.
Hello,
When using a visual studio project generated by the vsxmake generator, clicking "Solution => Build all" (or worse "Solution => Rebuild all") will trigger
xmake build
/xmake build -r
on every target.This is an issue when you have several projects (targets), as multiple xmake instance will be spawned and will try to rebuild the project from scratch sequentially, meaning a lot of files will be rebuilt multiple times.
This isn't great as one of the benefit we have from using vsxmake is that xmake compiles faster than msbuild.
Describe the solution you'd like
It's possible to tell Visual Studio to not build a project when building the whole solution, by removing the
{#target_id#}.#mode#|#arch#.Build.0 = #mode#|#vsarch#
association in the .sln file (this still allows to build a target but won't select it when building the solution).It would be nice to have a solution similar to what cmake does: adding a phony target which builds everything (and will be the only one target with a Build.0 association), and use it to simply run
xmake build
orxmake build -r
on the whole project.Example:
I began working on this as I wanted to make a pull request for this: 36a8591
however I wasn't sure of the best way to generate the BuildAll.vcxproj using the vsxmake generator.
Also, it would be really cool to have a .xmake/UpdateVS.vcxproj which would trigger the
xmake project -k vsxmake
manually, a bit likeplugin.vsxmake.autoupdate
rule but in a way we could trigger manually.Describe alternatives you've considered
There's no other solution than changing the way xmake generates project, we can use vs to tell it to not build projects when building the whole solution but xmake overrides this when it regenerates the .sln
Additional context
I'm using last xmake version
The text was updated successfully, but these errors were encountered: