From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d561cda996d4dac4 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news1.google.com!postnews.google.com!v25g2000yqk.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Adding a compiler to GPS or a GPR project Date: Fri, 1 Jan 2010 07:51:27 -0800 (PST) Organization: http://groups.google.com Message-ID: <08410924-1081-42ba-911c-e973271a67dd@v25g2000yqk.googlegroups.com> References: <1l5v84b72sizk$.j72gn8d711oq$.dlg@40tude.net> NNTP-Posting-Host: 77.198.58.45 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1262361087 18959 127.0.0.1 (1 Jan 2010 15:51:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 1 Jan 2010 15:51:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v25g2000yqk.googlegroups.com; posting-host=77.198.58.45; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8572 Date: 2010-01-01T07:51:27-08:00 List-Id: Some other comments : When setting up a compiler definition, keep in mind that the name provided for the node is case sensitive, even on none- case-sensitive systems. Probably GPRConfig is doing a scan of all directories and doing so, use the names it gets as-is, with no canonical case conversion, when the system is not case sensitive. Still about this node : although GPRBuild will accept a script or a so called batch file (for Windows users) in the =93for Driver (language) use "..." =94, GPRConfig will not recognize any script there, if it is has an extention. If you provide Test.bat here, as the application, GPRConfig will not find it. At least on Windows, only real executables can be used there. Probably it will work on Unix- like, with script which does not use any file name extension. You have two things : a compiler definition, which seems to be intended to GPRConfig, and a project configuration chunk, which is intended to GPRBuild. Both expects a language name and an application name. These are two definition, which are related and unrelated in the mean time. These are related in the way if you do not provide a compiler definition, then the project configuration chunk will not be handled. But this is unrelated in the way the application you indicate as a compiler in the project configuration chunk, is not required to be same as the one given in the compiler definition. You may prodive "foo" for in the compiler definition for the language L, and provide "bar" in a =93 for Driver ("L") use "bar"; =94 in the project configuration chunk. No check is done here when you do so, and you must care about it. The compiler definition allow you do give an explicit version, or an external reference to a version (via invocation of an application and a regexp expression). This version number may be later used as a filter for the definition of project definition chunk. Always provide a version, even a dummy one : weither or not you use filtering based on version number, if you provide no version number, the compiler definition will be silently ignored by GPRConfig. The element is mandatory as well, even if the application provided is not intended to produce any object file at all (see the exemple of adactl just given in a prior message). Even if you have provided a language definition file for GPS in one of its plug-ins directory, and this language definition file define a file extension for your language, you must explicitly recalls this file name extension in the projection configuration chunk. This is not done automatically. GPS uses its language definition file to know what it will allow you to select as files belonging to a project, but it must no information about what this file extensions are, neither to GPRConfig or GPRBuild. You must do it yourself, and take care to have the same in both place. Exemple : package Naming is for Body_Suffix ("AdaControl") use ".aru"; end Naming; in the adacontrol.xml file which I've put in share/gprconfig, and AdaControl .aru for the zadactl.xml file which is in one of the GPS plug-ins directory. Note : I've noticed GPRBuild seomtimes have troubles when XML comments are used in XML file parts standing for a project configuration chunk. Avoid using XML comments there, and use Ada comments instead. Another example case where it is required to use a different application in the compiler definition and the project configuration chunk : surprisingly to me, GPR configuration files, does not provide a way to build a commande line like some other IDE do. And indeed, I did not found any such things in the standard files which are provided in the gprconfig directory. You will not be able to say, as an example =93 windres -i filename -o basename.o =94. GPRBuold seems to always add the filename as the last option of all the options you may provide in =93 for Required_Switches (language) use ("..."); =94, and will simply expect the application to create basename.[target-object-extension] object file in the object directory, which is the current-working-directory GPRBuild gives to the compiler. There is no way, neither, to build a command line which will tell the compiler what the object output directory is. For these reasons, the wrapper introduced before with the example of the Windows Resources compiler, is still needed. If this wrapper is a script with an extension, you will not be able to specify it as the application in the compiler definition, but you will be able, and have to, use it in the project configuration chunk. This is another example case where the application specified in the compiler definition and the project configuration chunk are not the same. For my first question which was =93 how do I setup a compiler for Windows Resources in GPS and GPR ? =94, here is finally the three file I used : windows-resources-language.xml in one of the GPS plugins directory (for language definition) : Windows Resources C .rc .rc ^(__DATE__|__FILE__|__LINE__|__STDC__|__TIME__| __TIMESTAMP__)\b ^(ACCELERATORS|BITMAP|CURSOR|DIALOG|DIALOGEX|FONT|HTML| ICON|MENU|MENUEX|MESSAGETABLE|POPUP|PLUGPLAY|RCDATA|STRINGTABLE| TEXTINCLUDE|TYPELIB|VERSIONINFO|VXD)\b ^(AUTO3STATE|AUTOCHECKBOX|AUTORADIOBUTTON|CHECKBOX| COMBOBOX|CONTROL|CTEXT|DEFPUSHBUTTON|EDITTEXT|GROUPBOX|ICON|LISTBOX| LTEXT|PUSHBOX|PUSHBUTTON|RADIOBUTTON|RTEXT|SCROLLBAR|STATE3)\b ^(CAPTION|CHARACTERISTICS|CLASS|EXSTYLE|FONT|LANGUAGE| MENU|MENUITEM|STYLE|VERSION)\b ^(RT_CURSOR|RT_BITMAP|RT_ICON|RT_MENU|RT_DIALOG| RT_STRING|RT_FONTDIR|RT_FONT|RT_ACCELERATORS|RT_RCDATA|RT_MESSAGETABLE| RT_GROUP_CURSOR|RT_GROUP_ICON|RT_VERSION|RT_DLGINCLUDE)\b ^(RT_MANIFEST)\b /* */ // " \ ' True True True include ^\s*(#include\s+\S+).* 1 statement ^\s*((\w+|\d+)\s+(\w+)).* 1 windows-resources.xml in the share/gprconfig directory (for compiler and project configuration chunk definitions) : WindRes windres DummyVersion Windows Resources i686-pc-mingw32 package Naming is for Body_Suffix ("Windows Resources") use ".rc"; -- for Casing ("Windows Resources") use "mixedcase"; end Naming; package Compiler is for Driver ("Windows Resources") use "windres-for- gps.bat"; end Compiler; The wrapper batch windres-for-gps.bat file which have to be located in your shell ${PATH} : @echo off rem Compiles a Windows resource file (*.rc). It do so running windres from rem the directory where the resource file belong, just for windres to be rem able to resolve relative path the resource file may contains. rem The object file is produced in this same directory. Later, the object rem file is moved to the object directory, which is the one from where rem gnatmake will invok this batch. rem rem This batch script is to be invoked with the file name to compile as rem its first and unique argument. rem rem The argument is retrieved in %1 rem rem %1 is the full file name rem %~n1 is the base name rem %~dp1 is the parent directory name rem pushd goes to and remember of the actual directory rem popd comes back to the actual directory pushd %~dp1 windres.exe -i %1 -o %~n1.o popd if exist %~n1.o del %~n1.o if exist %~dp1\%~n1.o move %~dp1\%~n1.o . Or simply download the three files here : http://www.les-ziboux.rasama.org/download/windres-in-gpr-gps-on-windows-hos= t.zip