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

Makefile: add YOSYS_VER and friends to CXXFLAGS for plugin compat che… #4757

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

widlarizer
Copy link
Collaborator

As Yosys interfaces change, plugin developers may decide to stay compatible with a broad spectrum of versions. We will provide per-interface feature defines of some sort, but as a fallback in case we don't, I'm adding Makefile variable YOSYS_VER to CXXFLAGS so that yosys-config reports reports it to the plugin sources when building them. It also splits YOSYS_VER to YOSYS_MAJOR, YOSYS_MINOR, YOSYS_COMMIT which don't need quoting and can be used as integers. For example:

$ cat a.cpp
#include <stdio.h>
#include <string.h>

int main() {
	if (!strcmp(YOSYS_VER, "0.47+86"))
		printf("Yay %d\n", YOSYS_MINOR);
	else
		printf("Nay\n");

	printf(YOSYS_VER "\n");
	return 0;
}
$ yosys-config --exec --cxx --cxxflags --ldflags a.cpp
$ ./a.out
Yay 47
0.47+86

This could also be the base for requiring plugins to report the version they were built against.

@widlarizer widlarizer requested a review from jix November 19, 2024 18:40
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

Successfully merging this pull request may close these issues.

1 participant