Pass compiler's custom constant to tool?

Working on new editor enhancements?
PeDe
Enthusiast
Enthusiast
Posts: 284
Joined: Sun Nov 26, 2017 3:13 pm

Pass compiler's custom constant to tool?

Post by PeDe »

Is there a way to pass the value of a constant from the compiler options to a tool as an argument?
Before and after compiling I run a CMD batch file, and would like to use a constant from the compiler options.

I have made a screen shot so it is easier to understand what I mean.
https://www.dreisiebner.at/temp/PB_CustomConstants.png

Peter
PeDe
Enthusiast
Enthusiast
Posts: 284
Joined: Sun Nov 26, 2017 3:13 pm

Re: Pass compiler's custom constant to tool?

Post by PeDe »

Or is there a way to determine the name of the compilation target, e.g. "Release 64" as in the screenshot above?
Then I could use a tool to search the project file myself. I have not found an entry in the environment variables either.

Peter
PeDe
Enthusiast
Enthusiast
Posts: 284
Joined: Sun Nov 26, 2017 3:13 pm

Re: Pass compiler's custom constant to tool?

Post by PeDe »

I changed the code from the IDE and compiled it, now I also get the name of the compile target.

In the file 'AddTools.pb' and procedure 'AddTools_ExecuteCurrent()' at line 207 I copied the if-block and instead of '%PROJECT' I used '%TARGET'.
The name of the target should not contain any spaces.

Peter

Code: Select all

      If FindString(Test$, "%PROJECT", 1)
        If IsProject
          ToolArguments$ = ReplaceString(ToolArguments$, "%PROJECT", GetPathPart(ProjectFile$), 1)
        Else
          ToolArguments$ = ReplaceString(ToolArguments$, "%PROJECT", "", 1)
        EndIf
      EndIf

      If FindString(Test$, "%TARGET", 1)
        If IsProject
          ToolArguments$ = ReplaceString(ToolArguments$, "%TARGET", *Target\Name$, 1)
        Else
          ToolArguments$ = ReplaceString(ToolArguments$, "%TARGET", "", 1)
        EndIf
      EndIf
Post Reply