It should be '-D MAJOR_VERSION=2'. Look at the project build settings - there you can see the complete command line. And under compiler/general you can add preprocessor defines.
To call the compiler you suggestion would work. But i call psoc directly via:
"C:\Program Files (x86)\Cypress\PSoC Creator\3.3\PSoC Creator\bin\cyprjmgr.exe" -wrk "ArgaveSubcontroller.cywrk" -D MAJOR_VERION=2 -build
And im getting the following error.
Error: mgr.M0004: The option -D is invalid (App=cyprjmgr)
Error: mgr.M0027: There is invalid option (App=cyprjmgr)
I think cyprjmgr will look at you the build settings in your workspace. So try to set it there (via Creator).
How should i edit settings via creator in a jenkins build? I may generate a settings.h file an include it in the source but that seems a bit hacky, doesnt it? Does any got a better idea?
Sorry, I missed the Jenkins requirement. (And I think that setting the major version is not a task for the CI system).
I think you cannot do that. Best way is probably to add all generated code to the SCM, and then only run the actual C compiler steps. There you can add the -D parameters.
where do you set versions? We use the jenkins release plugin to set major, minor and patchversion and also the releasetype (nightly, alpha, beta, rc, release). This gives us an defined environment for those builds and all build logs are automatically saved. Builds running on developer-machines are not getting any version. (v0.0.0-dev)
Do you tag your SCM revision and build releases on those? We get our revisions tagged by Jenkins if we trigger an releasebuild.
By changing the build settings, a developer needs to remember to tag the revision with the same version he has set in the build settings. This may lead to mistakes.
Would be nice to hear your opinion about this one. Maybe i can find a better solution with building psoc-project releases.