News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to send the compiler options to a .bat file via Tools

Started by edison, September 18, 2014, 07:15:35 PM

Previous topic - Next topic

edison

I have try to create a Tools item like this:
$(CODEBLOCKS)\test.bat [[CompileOptionsBase().GetCompilerOptions();]]

and the content of test.bat is:
@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?

stahta01

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.


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


Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

edison

$(CODEBLOCKS)\test.bat "[[ print(CompileOptionsBase().GetCompilerOptions()); ]]"
This time I got:
Quote"(null : 0x00000000)"

Does CompileOptionsBase().GetCompilerOptions() work in my case ?

stahta01

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

edison

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.

oBFusCATed

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!]

edison

Quote from: 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.

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