comp.lang.ada
 help / color / mirror / Atom feed
* Question about C++ files with GPRBUILD
@ 2016-03-08  5:02 Zack Boll
  2016-03-08  7:08 ` Egil H H
  0 siblings, 1 reply; 3+ messages in thread
From: Zack Boll @ 2016-03-08  5:02 UTC (permalink / raw)


I have a directory with several C++ test driver.  For a test, my project file only includes one of the test drivers.  

for Languages use ("C++");
for Main use ("test_driver_1.cpp");
for Source_Dirs use (".");

when I go to compile the test driver from GPS, gprbuild tries to compile all C++ files in the directory.  Does anyone have an idea on why it does that and how I can fix it to only compile the relevant C++ file?

gprbuild -v -d -P/test_scripts/test_scripts.gpr -XADA_DIALECT=Ada_2012 -XARCHITECTURE=x86_64_Linux -XBUILD_FLAGS=Optimize -XELABORATION_CHECKS=Static -XCOMPILER_MULTIPROCESS=8 -XDEBUG_TARGET=local test_driver_1.cpp -s -j8



Thanks,
Zack


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about C++ files with GPRBUILD
  2016-03-08  5:02 Question about C++ files with GPRBUILD Zack Boll
@ 2016-03-08  7:08 ` Egil H H
  2016-03-08  8:35   ` briot.emmanuel
  0 siblings, 1 reply; 3+ messages in thread
From: Egil H H @ 2016-03-08  7:08 UTC (permalink / raw)


On Tuesday, March 8, 2016 at 6:02:08 AM UTC+1, Zack Boll wrote:
> I have a directory with several C++ test driver.  For a test, my project file only includes one of the test drivers.  
> 
> for Languages use ("C++");
> for Main use ("test_driver_1.cpp");
> for Source_Dirs use (".");
 
for Source_Files use ("test_driver_1.cpp");

The default is all files in all Source_Dirs.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about C++ files with GPRBUILD
  2016-03-08  7:08 ` Egil H H
@ 2016-03-08  8:35   ` briot.emmanuel
  0 siblings, 0 replies; 3+ messages in thread
From: briot.emmanuel @ 2016-03-08  8:35 UTC (permalink / raw)


> The default is all files in all Source_Dirs.

Right, this is unfortunately needed for C and C++, since there is no clear way to compute the closure for a main (you could be using extern declarations for all subprograms, without ever using #include for instance). So gprbuild will build all project sources (either found automatically via Source_Dirs, or explicitly via Source_Files), build a library with these, and finally link the main unit using that library.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-08  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-08  5:02 Question about C++ files with GPRBUILD Zack Boll
2016-03-08  7:08 ` Egil H H
2016-03-08  8:35   ` briot.emmanuel

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