How to change/add command line arguments sent to compiler

CodeLite installation/troubleshooting forum
hbr_in
CodeLite Expert
Posts: 113
Joined: Fri Jul 11, 2008 9:12 am
Contact:

How to change/add command line arguments sent to compiler

Post by hbr_in »

Hi,

I am trying to eliminate the IDE that came along with the custom compiler. Now the compiler uses a diferent command line argument, (like no i.e., -o option & few others). So now is there to way to handle these situations. i tried Custom Build but i couldnt find the variables that codelite provides/supports like. Like $(OutputFile), $(IntermediateDirectory). is their any macro name through which i can get filename that is being compiled.

TIA

Regards
Gururaja
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to change/add command line arguments sent to compiler

Post by eranif »

In the next release(already in SVN), there is a new dialog 'macros' which lists all available macros and their description.

For now,
You can use one of:

Code: Select all

AddMacro(wxT("$(ProjectPath)"), wxT("Expands to project's path"));
	AddMacro(wxT("$(WorkspacePath)"), wxT("Expands to workspace's path"));
	AddMacro(wxT("$(ProjectName)"), wxT("Expands to the current project name as appears in the 'File View'"));
	AddMacro(wxT("$(IntermediateDirectory)"), wxT("Expands to the current project intermediate directory path, as set in the project settings"));
	AddMacro(wxT("$(ConfigurationName)"), wxT("Expands to the current project selected configuration"));
	AddMacro(wxT("$(OutDir)"), wxT("An alias to $(IntermediateDirectory)"));
	AddMacro(wxT("$(CurrentFileName)"), wxT("Expands to current file name (without extension and path)"));
	AddMacro(wxT("$(CurrentFilePath)"), wxT("Expands to current file path"));
	AddMacro(wxT("$(CurrentFileFullPath)"), wxT("Expands to current file full path (path and full name)"));
	AddMacro(wxT("$(User)"), wxT("Expands to logged-in user as defined by the OS"));
	AddMacro(wxT("$(Date)"), wxT("Expands to current date"));
	AddMacro(wxT("$(CodeLitePath)"), wxT("Expands to CodeLite's startup directory on (e.g. on Unix it exapnds to ~/.codelite/"));
	AddMacro(wxT("`expression`"), wxT("backticks: evaluates the expression inside the backticks into a string"));
	
Note, that when using custum build, some of them wont be available.

But, what are you trying to achieve exactly ?

Eran
Make sure you have read the HOW TO POST thread
hbr_in
CodeLite Expert
Posts: 113
Joined: Fri Jul 11, 2008 9:12 am
Contact:

Re: How to change/add command line arguments sent to compiler

Post by hbr_in »

eranif wrote:Note, that when using custum build, some of them wont be available.
But, what are you trying to achieve exactly ?
Eran
I have a custom compiler which doesnt support standard gcc compiler arguments. I want to completely shift to codelite eliminating custome IDE provided along with compiler. so i am trying to fill up build settings in cl.

I want to add a custom make file & a CUSTOM Make command. I couldnt find how to do this.

Also how to clean a single file object. Now we have option to use clean th eproject & not a file.

How to change the switch options in build settings. i need to add/change/remove few settings

TIA

Regards
Gururaja
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to change/add command line arguments sent to compiler

Post by eranif »

Can u please write here in details how do you invoke that compiler from the command line?

Eran
Make sure you have read the HOW TO POST thread
hbr_in
CodeLite Expert
Posts: 113
Joined: Fri Jul 11, 2008 9:12 am
Contact:

Re: How to change/add command line arguments sent to compiler

Post by hbr_in »

eranif wrote:Can u please write here in details how do you invoke that compiler from the command line?
1st. shall i continue discussion in this thread or shall we merge this with in http://codelite.org/forum/viewtopic.php?f=3&t=115

2nd. Since CL Doesnt execute the compiler command inside working directory, i tried setting the "Intermediate Directory" same as my working directory i.e., both of them point to "C:/prj/sd_fat/testing/bootloader/prj/Release". But, when i select compile from project context menu, i get error as below

Code: Select all

Building: "C:/cygwin/bin/make.EXE"  -j 2 -f "prj_bootloader.mk" type=Release C:/prj/common.o
----------Building project:[ prj_bootloader - Release ] (Single File Build)----------
prj_bootloader.mk:60: *** target pattern contains no `%'.  Stop.
----------Build Ended----------
I checked the file prj_bootloader.mk & @ 60 line. The error is in $(IntermediateDirectory). This is because $(IntermediateDirectory) point to a fullpath of aa directory. If i set $(IntermediateDirectory) to just a single word like Release/Debug/dummy then it works correctly. (This also needs that a directory with this name exists. Actually the $(IntermediateDirectory) directory should be pre-created by the make comamnd but it isnt. I had to manually create this directory)

And one more, I have set the Project type to release mode. Since file build points correctly to type=release as seen above, but Project build points to debug

Code: Select all

Building: "C:/cygwin/bin/make.EXE"  -j 1 -f "codelite_wrkspc_wsp.mk" type=Debug
----------Building project:[ prj_bootloader - Release ]----------
make[1]: Nothing to be done for `all'.
----------Build Ended----------
Edit: Interestingly Inside the .mk file its still type=release.

Also i can compile the files individually, when i try Build project, it just says "Nothing to be done for `all'." Dont know why.

CTRL+C Doesnt work inside Output View->Build Window. Should i create a bug/feature request for this.

TIA

Regards
Gururaja
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to change/add command line arguments sent to compiler

Post by eranif »

hbr_in wrote:1st. shall i continue discussion in this thread or shall we merge this with in http://codelite.org/forum/viewtopic.php?f=3&t=115
yes please, lets continue this discussion there
hbr_in wrote:2nd. Since CL Doesnt execute the compiler command inside working directory,
This is not true. When setting a *valid* working directory, CL sets it properly. If the directory does not exist, it will not create it (since this is a working directory and not an IntermediateDirectory)

I fail to see the logic of creating the working directory (unlike IntermediateDirectory, which is created by CL)
Creating the output directory should be created by your script build (similar to what codelite does when using its built-in build system)
hbr_in wrote:And one more, I have set the Project type to release mode. Since file build points correctly to type=release as seen above, but Project build points to debug
You are mixing here between the Workspace & Project
from the build log, it seems that you selected the project to use the 'Debug' configuration, but the workspace configuration remained 'Debug'.

What you should have done, is to create a new Workspace configuration and name it 'Release', and then select project 'Release' and associate it with it.
hbr_in wrote:CTRL+C Doesnt work inside Output View->Build Window. Should i create a bug/feature request for this.
I know, don't bother reporting it, since I will not be fixig this (it was opened before and I closed it as 'wont fix') since the Ctrl-C is a global accelerator, it will copy data from the editor and not from output window

Eran
Make sure you have read the HOW TO POST thread
hbr_in
CodeLite Expert
Posts: 113
Joined: Fri Jul 11, 2008 9:12 am
Contact:

Re: How to change/add command line arguments sent to compiler

Post by hbr_in »

Hi,

I have explained my issue in detail in the other thread. We will continue our discussion there.

Regards
Gururaja
Post Reply