Author Topic: How to send the compiler options to a .bat file via Tools  (Read 5676 times)

Offline edison

  • Multiple posting newcomer
  • *
  • Posts: 53
How to send the compiler options to a .bat file via Tools
« on: September 18, 2014, 07:15:35 pm »
I have try to create a Tools item like this:
Code
$(CODEBLOCKS)\test.bat [[CompileOptionsBase().GetCompilerOptions();]]

and the content of test.bat is:
Code
@echo off @echo %1

But the  pop-up window does not show the compiler options but just say "echo is off".

I want the compiler options is because I am trying to create a clang-check item in Tools, clang-check need to know the current compiler options.

So, is there any way to do this?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: How to send the compiler options to a .bat file via Tools
« Reply #1 on: September 18, 2014, 07:40:36 pm »
Could NOT get yours to work; but, this did using the ToolPlus Plugin
Edit: Just got the echo message like you did with your command.

Code
$(CODEBLOCKS)\test.bat [[ print(GetProjectManager().GetActiveProject().GetTitle()); ]]

Tim S.

« Last Edit: September 18, 2014, 07:46:45 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline edison

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: How to send the compiler options to a .bat file via Tools
« Reply #2 on: September 18, 2014, 08:10:52 pm »
Code
$(CODEBLOCKS)\test.bat "[[ print(CompileOptionsBase().GetCompilerOptions()); ]]"
This time I got:
Quote
"(null : 0x00000000)"

Does CompileOptionsBase().GetCompilerOptions() work in my case ?
« Last Edit: September 18, 2014, 08:12:24 pm by edison »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: How to send the compiler options to a .bat file via Tools
« Reply #3 on: September 19, 2014, 12:09:42 am »
Likely you are doing something wrong.
Edit: As in you are using the wrong script command(s); I really have no idea what the right script command would be.
Edit2: I think it is likely you need to use GetStringFromArray  in order to convert the compiler options into a thing usable by print; but, this is just a guess.

Please state what compiler options you wish to have in the output?
Global, Project, or Target?

Tim S.
 
« Last Edit: September 19, 2014, 02:17:17 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline edison

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: How to send the compiler options to a .bat file via Tools
« Reply #4 on: September 19, 2014, 02:38:23 am »
If possible, I think it is better send all options to the .bat.
If the script can grap only one type option, I can use 3 scripts to send 3 type option as 3 parameters to .bat.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to send the compiler options to a .bat file via Tools
« Reply #5 on: September 21, 2014, 09:12:43 pm »
You'll have to probably use some kind of manager, then you'll have to get the current project, target, compiler then ask it to get all the options...

It won't be a single call for sure.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline edison

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: How to send the compiler options to a .bat file via Tools
« Reply #6 on: September 22, 2014, 10:36:40 am »
You'll have to probably use some kind of manager, then you'll have to get the current project, target, compiler then ask it to get all the options...

It won't be a single call for sure.

Thanks for your reply. But the question for now is which script should be used in this case. The [[CompileOptionsBase().GetCompilerOptions();]] does not work .