Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: edison on September 18, 2014, 07:15:35 pm

Title: How to send the compiler options to a .bat file via Tools
Post by: edison 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?
Title: Re: How to send the compiler options to a .bat file via Tools
Post by: stahta01 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.

Title: Re: How to send the compiler options to a .bat file via Tools
Post by: edison 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 ?
Title: Re: How to send the compiler options to a .bat file via Tools
Post by: stahta01 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.
 
Title: Re: How to send the compiler options to a .bat file via Tools
Post by: edison 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.
Title: Re: How to send the compiler options to a .bat file via Tools
Post by: oBFusCATed 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.
Title: Re: How to send the compiler options to a .bat file via Tools
Post by: edison 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 .