comp.lang.ada
 help / color / mirror / Atom feed
From: "Hibou57 (Yannick Duchêne)" <yannick_duchene@yahoo.fr>
Subject: Re: Adding a compiler to GPS or a GPR project
Date: Wed, 30 Dec 2009 09:46:52 -0800 (PST)
Date: 2009-12-30T09:46:52-08:00	[thread overview]
Message-ID: <233e1eb3-5aed-4ef1-a805-e1ee741e6175@c3g2000yqd.googlegroups.com> (raw)
In-Reply-To: 1l5v84b72sizk$.j72gn8d711oq$.dlg@40tude.net

On 30 déc, 15:31, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> What about:
>
> http://www.adacore.com/wp-content/files/auto_update/gprbuild-docs/htm...
>
> which defines the compiler for the given language. (The compilation command
> line is determined by a combination of various project setting, obviously.)
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

This is a nice link, worth to read.

I've tried to do with this.

I've noticed two rather stange things :
+ The suffix provided in the language definition (the xml file) does
not seems to be reused by the GPR builder.
+ The substition given in the latter doc (%f, %u, and so on) does not
seems to work at all.

Note: things must be done with manual edition of the *.gpr file, as
some properties are not accessible with GUI project manager (notably
the Driver attribute).

Tips: the “ tool ” is launched with the object directory as the
current working directory. This must be properly handled if the file
to compile use relative paths to link to various stuff.

For people who wants to know more, here is how I could set up the GPR
project so that is automatically (re)compiles any Windows resource
files included in the project.


First of all, the language definition for the RC language, which must
be a valid XML moved to one of the GPS plug-ins directory :

<?xml version="1.0"?>
<!--  Adds syntax highlighting for RC resource files. -->
<GPS>
  <Language>
    <Name>Windows Resources</Name>
    <Extension>.rc</Extension>
    <Context>
      <New_Line_Comment_Start>//</New_Line_Comment_Start>
      <Comment_Start>/*</Comment_Start>
      <Comment_End>*/</Comment_End>
      <String_Delimiter>&quot;</String_Delimiter>
      <Can_Indent>True</Can_Indent>
      <Syntax_Highlighting>True</Syntax_Highlighting>
      <Case_Sensitive>True</Case_Sensitive>
    </Context>
  </Language>
</GPS>

Then, the line added in the Compiler nested package of the GPR project
file :

      for Driver ("windows resources") use "windres.bat";

(assuming Windows). This must be manually edited, as the GUI project
manager does not provide access to this.

The other option, can be edited from GPS. Open the project properties
sheet and select the tab named “ Naming convention ” and set the
implementation suffix of Windows Resource to .rc. Alternatively, you
may manually edit the GPR file, to add this line in a Naming nested
package :

   package Naming is

      for Implementation_Suffix ("windows resources") use ".rc";

   end Naming;

The last step, is the windres.bat which is as follow :

@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 file name
rem %~dp1 is the parent directory name of the file
rem pushd <dir> goes to <dir> 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 .


These tips may be reused for any other similar needs.



  reply	other threads:[~2009-12-30 17:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-30 14:05 Adding a compiler to GPS or a GPR project Hibou57 (Yannick Duchêne)
2009-12-30 14:31 ` Dmitry A. Kazakov
2009-12-30 17:46   ` Hibou57 (Yannick Duchêne) [this message]
2009-12-31  7:03   ` Stephen Leake
2009-12-31 12:39     ` Hibou57 (Yannick Duchêne)
2010-01-01 14:58       ` Hibou57 (Yannick Duchêne)
2010-01-01 15:51         ` Hibou57 (Yannick Duchêne)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox