6 Replies Latest reply on Oct 14, 2016 1:00 AM by userc_39587

    commandline build

      Hey everyone,

         

      i figered out how to build a psoc 3.3 project from the commandline. But now i wonder how to inject macros from the commandline. eg. -DMAJOR_VERSION=2

         

      Do you have any idea how to do this. It is quit important for setting up nightly builds and release builds with jenkins.

         

      Best regards

        • 1. Re: commandline build
          HeLi_263931

          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.

          • 2. Re: commandline build

            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)

            • 3. Re: commandline build
              HeLi_263931

              I think cyprjmgr will look at you the build settings in your workspace. So try to set it there (via Creator).

              • 4. Re: commandline build

                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?

                • 5. Re: commandline build
                  HeLi_263931

                  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.

                  • 6. Re: commandline build

                    Hi hli,

                       

                    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.

                       

                     

                       

                    Best regards,

                       

                    noppel