This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler: Include path option in Cl6x compiler option and -- cmd file

Other Parts Discussed in Thread: CCSTUDIO

Tool/software: TI C/C++ Compiler

Hello,

I want my CCS project to be portable, so all my include path begin with ${install_dir}\.....

My Cl6x command works well when I used the --include_path option.

But I would libe to put all my include_path in a cmd file and used the --cmd file option , but then  it does'nt work, the compilation failed.

It looks like the ${install_dir} is not interpreted when it is situated in a cmd file.

My use case is that I want to share a list of include path between x project and don't want to fill x times the project properties, include only one file will help me ! and I want my include path to be relative that is the problem.

Maybe someone could help me ? thank you very much in advance for your help.

regards.

Pat

  • lavenu patrick1 said:
    But I would libe to put all my include_path in a cmd file and used the --cmd file option , but then  it does'nt work, the compilation failed.

    Unfortunately, the files read by the compiler/linker (like compiler options file, linker command file) cannot interpret CCS variables. The include_path option in CCS can directly refer to the variable, but the variable cannot be used within a file passed to the compiler shell. 

    It appears that you may be able to use Eclipse environment variables to achieve this (under CCS menu Window->Preferences->CCS->Environment). Basically create a environment variable with a list of semi-colon separated paths and use the environment variable in the project's compiler include path option. Then only the environment variable needs to be shared with the different projects (and if set at the workspace level, all projects in the workspace should know about it). I haven't tested this extensively and am still looking at whether there are other ways to do this using CCS variables. I will let you know if I can think of other suggestions.

  • Thank you very much Aartig for your fast and precise answer, I will try what you advice me .

    Thank in advance to send me others suggestions if you find some.

    Best regards.

    Patrick.
  • Sorry, I would just add that I already tried it but it doesn't answer to my problem that is sharing a list of relative include_path between x projects without the need to type them manually one by one in all project properties.

    Best regards.

    Pat.
  • My suggestion was to do something like the following.

    - Create an Eclipse environment variable with the list of include paths (the paths here can reference CCS variables).  This does mean that all users need to have the same CCS variables also defined in their setup but that can be easily shared using a variables file. All of your compiler include paths can be added here under one environment variable.

    - Add the environment variable to the project's compiler include path option, rather than the list of multiple paths.

    - During build, each of the paths listed for the environment variable should be passed to the –include_path option.

    Also, I believe environment variables can be shared among multiple users using the File->Export->Preferences and File->Import->Preferences menus.

    I admit this is not as direct as adding a list of options to a file and passing it to the compiler, however since the options file does not support the use of variables, this is one alternative I can think of. 

  • Thank you very much aArtig for your help, I suppose that you are using CCSv6, I'm using CCSv5 , it is a little different but I succeed to implement your suggestion on this old version.

    However I have another question, I have a lot of project file and need to compile them automatically , for this need, I'm using com.ti.ccstudio.apps.projectImport and com.ti.ccstudio.apps.projectBuild command.

    The problem is that now, all my project are depending of eclipse environment variable , if i do nothing the project could not compile .

    My question is, in my use case, How can I add automatically the eclipse environment variable in my workspace to make the compilation succeed ?

    Thank you very much in advance for your help.

    Best regards,

    Patrick.
  • lavenu patrick1 said:
    My question is, in my use case, How can I add automatically the eclipse environment variable in my workspace to make the compilation succeed ?

    I see a couple of options:

    1) Set the environment variable at the project level instead of workspace level (under Project properties->Build->Environment tab). Then the variable will get carried over with the project when you import it into a new workspace using the command line projectImport. The downside is that you would have to set the environment variable within each project, but at least it would only have to be done once.

    2) If variable is set at workspace level, it can be exported and imported into a new workspace prior to running command line projectImport and projectBuild. However, I have not found a way to do the export/import by command line. It can be done via CCS GUI using menu File->Export->Preferences, then provide a name for the preferences file, and then import it into the new workspace using menu File->Import->Preferences. Unfortunately this can get tedious if your process ends up creating new workspaces for each new import/build.

  • Thank you very much aArtiG for your fast answer.

    Some remarks about your first suggestion :

    With the 1 ) option, the problem is that i have a very long include path and have to write it x times.

    I found a solution that is using an unique macros. ini file and copy it in each project directory. When I open the project the include path appear in the build variables of the project.

    The problem is, that in my macros.ini file , I wrote :

    INC_PATH_LIST= PATH1;PATH2; PATH3

    But when CCS import my macro file in the build variable of the project , it convert INC_PATH_LIST as a Directory and not as a list path and so my compilation failed.

    My question is how I have to write my INC_PATH_LIST variable in the macros.ini file to make CCS convert it as a List path in the build variable of the project and not as a Directory ?

    Thank you in advance for your help.

    regards.

    Pat.
  • lavenu patrick1 said:
    But when CCS import my macro file in the build variable of the project , it convert INC_PATH_LIST as a Directory and not as a list path and so my compilation failed.

    My question is how I have to write my INC_PATH_LIST variable in the macros.ini file to make CCS convert it as a List path in the build variable of the project and not as a Directory ?

    Unfortunately, list-type variables are currently not supported in macros.ini file. There is an enhancement request we are tracking to add this support in a future release of CCS, but the support is currently not available.

  • Thank you very much again for your answer.

    So , if i understand, there is no solution with CCS to manage in a completly automatically way, include path variable common to a lot of project ?

    Best regards.

    Pat.
  • That is correct. When we add support for list-type variables in macros.ini variables, then it will be possible to do this in a much easier way.
  • Thank you very much for this precision.

    Finally I answered to my need by updating the org.eclipse.cdt.core.prefs file created after the importation of the project in the new workspace (by copying a specific one with a dos command ). With this bypassing that seems to work , I can continue to manage automatically my process and use workspace environment variable for all my imported project;

    regards.

    Pat.
  • Thank you very much for this precision and your help for resolving the issue.

    Finally I answered to my need by updating the org.eclipse.cdt.core.prefs file after the import project in the new workspace (replacing by using a copy dos command) , with this bypassing I can continue to manage my automatic process by using workspace environment variable for all my project.

    Pat.