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

Target fragment combination filtering #215

Open
sammyfreg opened this issue Sep 4, 2022 · 0 comments
Open

Target fragment combination filtering #215

sammyfreg opened this issue Sep 4, 2022 · 0 comments

Comments

@sammyfreg
Copy link

sammyfreg commented Sep 4, 2022

The fragment feature to generate multiple build target combination at the same times works really well.

I have a local improvement in my generations files (without modifying Sharpmake) that I think could be beneficial to be supported natively. It is the ability to filter out certain fragments combination, before adding the target.

Example:
I request the support of...

  • DevEnv: VS2022, Makefile
  • Platform: Win64, Linux
    But I do not want Linux to generate a VS2022 solution...

Now, I could just create 2 differents Targets to accommodate this, but in more complex case, it ends up having to specify individually each supported Target combination.

My suggestion is to have a virtual method that Sharpmake queries just before internally adding each target combination (or could use the tagging method similar to [configure]). Here's an example of what it could look like:

public class CustomTarget : Target
{
	public override bool IsValidTarget()
	{
		if(  (Platform& Platform.Linux) != 0 && DevEnv.IsVisualStudio() ){
			return false;
		}	

		return base.IsValidTarget();
	}
}

public class SomeBase : Project
{
	public ProjectBase()
	: base(typeof(CustomTarget))
	{
		Name = "SomeProject";		
		outTargets.Add(new CustomTarget(
							DevEnv.vs2022 | DevEnv.make, 
							Platform.win64|Platform.linux, 
							Optimization.Debug | Optimization.Release | Optimization.Retail));
	}
}

This would allow user to easily defines their own conditions and also handle their custom fragments.

@sammyfreg sammyfreg changed the title Per fragment combination target generation Target fragment combination filtering Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@sammyfreg and others