Commit Graph

78 Commits

Author SHA1 Message Date
Stephen Kelly 4f1c71fdd2 cmTarget: Add all sources traced from custom commands at once.
The AddSource method accepts one file and tries to avoiding adding
it to the sources-list of the target if it already exists.  This
involves creating many cmSourceFileLocation objects for matching
on existing files, which is an expensive operation.

Avoid the searching algorithm by appending the new sources as one
group.  Generate-time processing of source files will ensure
uniqueness.

Add a new AddTracedSources for this purpose.  The existing
AddSources method must process the input for policy CMP0049, but
as these source filenames come from cmSourceFile::GetFullPath(),
we can forego that extra processing.
2014-04-09 10:37:00 +02:00
Stephen Kelly 92e2fbe103 cmGeneratorTarget: Trace cmSourceFile objects instead of strings.
This reverses the decision in commit d38423ec (cmTarget: Add a
method to obtain list of filenames for sources., 2014-03-17).  The
cmSourceFile based API is preferred because that avoids creation of
many cmSourceFileLocation objects for matching strings, and the
result is cached by cmTarget.
2014-04-06 10:02:34 +02:00
Stephen Kelly c5b26f3bec cmTarget: Cache the cmSourceFiles in GetSourceFiles.
Avoid calling GetSourceFiles with the same result container multiple
times when tracing target dependencies.  The result from the previous
configuration is cached and used later otherwise.
2014-04-06 10:02:34 +02:00
Stephen Kelly e6971df6ab cmTarget: Make the source files depend on the config.
Disallow the use of config-specific source files with
the Visual Studio and Xcode generators. They don't have
any way to represent the condition currently.

Use the same common-config API in cmQtAutoGenerators. While
it accepts config-specific files, it doesn't have to support
multiple configurations yet.

Loop over the configs in cmTargetTraceDependencies
and cmGlobalGenerator::WriteSummary and consume all source
files.

Loop over the configs in cmComputeTargetDepends and compute the
object library dependencies for each config.
2014-04-02 23:14:02 +02:00
Stephen Kelly df753df94b cmGeneratorTarget: Don't add computed sources to the target.
When config-specifig generator expressions are supported, a target
may have SOURCES:

 src1.cpp $<$<CONFIG:Debug>:src2.cpp> $<$<CONFIG:Release>:src3.cpp>

and computation in cmTargetTraceDependencies would add each of the
src2.cpp and src3.cpp sources back to the target without a
config-guard.  That would make the sources be used later when
generating the buildsystem, regardless of the configuration.

Avoid calling AddSource on the target with the result of the
GetSourceFiles call.
2014-04-02 23:14:02 +02:00
Stephen Kelly aa0a3562dd cmGeneratorTarget: Compute target objects on demand
Add a ComputeObjectMapping method to compute the object
names.  It takes mapping to populate as an out-parameter so
that it can be extended in the future with parameters
relevant to generator expression evaluation.

Remove the supporting cmGeneratorTarget::AddObject method. It is
no longer needed as the container member is populated directly.

The ComputeObjectMapping method is called whenever objects are
requested from the cmGeneratorTarget.  Because the Xcode generator
makes no such request, explicitly invoke the method from that
generator so that the logic of checking for bad sources in object
libraries is executed.

In a follow-up, the UseObjectLibraries usage may be replaced by a
true generator expression evaluator for TARGET_OBJECTS. That
will require generators to use cmGeneratorTarget::GetExternalObjects
which is not currently the case for Xcode and VS generators.
2014-04-02 23:12:57 +02:00
Stephen Kelly fdcefe3c42 cmGeneratorTarget: Compute consumed object libraries on demand.
Remove up-front object library computation from cmGlobalGenerator.

Adjust tests for message coming from the generator expression
evaluation.
2014-04-02 23:12:56 +02:00
Stephen Kelly c355d10865 cmComputeTargetDepends: Track object library depends.
Relieve cmGeneratorTarget of that responsibility.
2014-04-02 23:12:56 +02:00
Stephen Kelly d38423ecc4 cmTarget: Add a method to obtain list of filenames for sources. 2014-03-31 23:18:43 +02:00
Stephen Kelly bbffccca42 add_custom_command: Evaluate generator expressions in DEPENDS
Rely on evaluation in cmCustomCommandGenerator for the generators.

When tracing target dependencies, depend on the union of dependencies
for all configurations.
2014-03-20 09:21:56 -04:00
Stephen Kelly c481fadc07 cmGeneratorTarget: Don't store ObjectSources for object libraries.
Compute them on demand instead.
2014-03-15 09:29:44 +01:00
Stephen Kelly 9ad804ac7b cmGeneratorTarget: Constify cmSourceFile* in containers.
Some of them will be used with other APIs which require value_type
to be cmSourceFile const*.
2014-03-13 15:27:23 +01:00
Stephen Kelly dcfcd23ed5 cmGeneratorTarget: Make GetSourceDepends const. 2014-03-13 15:27:23 +01:00
Stephen Kelly 6132d979d9 cmGeneratorTarget: Constify the AddExplicitObjectName API.
The storage is already const.
2014-03-13 15:27:23 +01:00
Stephen Kelly bc51221164 cmGeneratorTarget: Constify the AddObject API.
The storage is already const.
2014-03-13 15:27:23 +01:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Ben Boeckel 84fdc9921c stringapi: Pass configuration names as strings 2014-03-08 13:05:36 -05:00
Brad King f154475b65 cmTarget: Refactor GetLocation API
When given a non-NULL configuration the GetLocation returned the
location for the given configuration.  When given a NULL configuration
the GetLocation method returned a location with the build-system
placeholder for the configuration name.  Split the latter use case out
into a separate GetLocationForBuild method and update call sites
accordingly.
2014-03-08 13:05:36 -05:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Ben Boeckel fabf1fbabb stringapi: Use strings in target name 2014-03-08 13:05:31 -05:00
Ben Boeckel ce5114354c stringapi: Use strings for the languages 2014-03-08 13:05:30 -05:00
Ben Boeckel ec97ed7d0c stringapi: Use strings for property names
Property names are always generated by CMake and should never be NULL.
2014-03-08 13:05:28 -05:00
Stephen Kelly f9d5b1fd0f Handle Mac OSX source flags for individual files lazily.
The actual list of files will become config dependent in a follow-up
commit.
2014-02-24 16:45:25 +01:00
Stephen Kelly 64d398416a cmGeneratorTarget: Classify sources on demand, not up front.
Implement a Visitor to hold the sequence of source file tests
for populating outputs.  Use VS 6 and 7 workaround from Brad
King for lack of partial template specialization and function
template specialization capabilities.

This will make it possible to use context dependent generator
expressions to determine the sources of a target.
2014-02-24 16:44:51 +01:00
Stephen Kelly d3682d8647 cmGeneratorTarget: Use a method to access the definition file. 2014-02-24 16:43:25 +01:00
Stephen Kelly 21e91350b0 cmTarget: Change GetTransitivePropertyLinkLibraries to output targets.
The callers already skip non-targets, so unify the target search.

Change supporting functions to accept a container of targets instead
of strings where possible.
2014-02-24 16:43:23 +01:00
Stephen Kelly 84e5f5a004 cmTarget: Move SourceFileFlags to cmGeneratorTarget. 2014-02-24 16:43:23 +01:00
Stephen Kelly 9db9c1fc8b cmTarget: Don't try to get sources of an INTERFACE_LIBRARY.
An an assert to ensure this.
2014-02-14 13:53:14 +01:00
Rolf Eike Beer c768e398f9 cmMakefile: make some methods take const std::string& instead of const char*
Most callers already have a std::string, on which they called c_str() to pass it
into these methods, which internally converted it back to std::string. Pass a
std::string directly to these methods now, avoiding all these conversions.
Those methods that only pass in a const char* will get the conversion to
std::string now only once.
2014-01-16 09:28:29 -05:00
Stephen Kelly 8fd0f2a718 cmGeneratorTarget: Hold a const global generator. 2014-01-12 20:18:11 +01:00
Stephen Kelly 531e40b95e cmTarget: Make GetSourceFiles populate an out-vector parameter.
In a future patch, this will also be populated with extra
sources from the linked dependencies.
2014-01-09 19:38:08 +01:00
Stephen Kelly 38de54cf6f cmGeneratorTarget: Add methods to access source file groups.
These methods and others will be able to get a config parameter
later to implement the INTERFACE_SOURCES feature.
2014-01-09 19:38:07 +01:00
Stephen Kelly 590d238914 cmTarget: Handle NO_SYSTEM_FROM_IMPORTED.
This handling was lost in commit faedd2be (cmTarget: Fix system include
annotation propagation., 2014-01-01).
2014-01-08 16:06:41 +01:00
Stephen Kelly faedd2bea9 cmTarget: Fix system include annotation propagation.
Direct users of IMPORTED targets treat INTERFACE_INCLUDE_DIRECTORIES
as SYSTEM, after commit a63fcbcb (Always consider includes from IMPORTED
targets to be SYSTEM., 2013-08-29).  It was intended that transitive
use of an IMPORTED target would have the same behavior, but that
did not work.  The implementation processed only direct dependencies
in cmTarget::FinalizeSystemIncludeDirectories.

Implement transitive evaluation of dependencies by traversing the
link interface of each target in the link implementation.
2014-01-06 17:25:10 +01:00
Stephen Kelly 259bf0918c Make the cmStrictTargetComparison operate on const cmTarget*. 2013-12-04 13:43:30 +01:00
Stephen Kelly a60cd3d3c6 cmGeneratorTarget: Use the output directory to order cmTargets.
The output directory must be unique, but the source directory
of an add_subdirectory call may be re-used.
2013-11-25 21:13:10 +01:00
Stephen Kelly abb13ea565 Order cmGeneratorTargetsType elements deterministically.
Define a custom ordering functor to deterministically and strictly
order the cmTarget* key. Otherwise the order would be dependent on
runtime pointer values, which breaks assumptions of some generators.

The functor orders first by target name, and then by directory. Multiple
global targets may have the same name, such as edit_cache, but their
directory differentiates them.
2013-11-22 15:06:25 +01:00
Stephen Kelly 0f876439e9 cmGeneratorTarget: Make GetIncludeDirectories const. 2013-11-19 18:07:04 +01:00
Stephen Kelly af4c1096f6 cmGeneratorTarget: Make some accessors const. 2013-11-03 22:27:28 +01:00
Brad King 7a616e75b8 Merge topic 'use-generator-target'
07f5788 Move TraceDependencies to cmGeneratorTarget.
fa03777 Do not populate SourceEntries in AddSourceFile.
2013-10-31 09:40:13 -04:00
Stephen Kelly 07f5788385 Move TraceDependencies to cmGeneratorTarget. 2013-10-30 21:29:45 +01:00
Brad King 8a6e82724c Merge topic 'use-generator-target'
638843a Remove the Location member from cmTarget.
90ef1cf Move GenerateTargetManifest to cmGeneratorTarget.
25f1df3 Split CreateGeneratorTargets into two methods.
2013-10-30 14:55:35 -04:00
Nils Gladitz f037b9b726 Generators: don't append sources from utility targets to objectSources 2013-10-28 14:25:28 +01:00
Stephen Kelly 90ef1cfe48 Move GenerateTargetManifest to cmGeneratorTarget. 2013-10-27 20:29:45 +01:00
Stephen Kelly 25f1df3e81 Split CreateGeneratorTargets into two methods.
As the generate-time-related API is moving to cmGeneratorTarget, almost
all of generation code needs to be able to access instances of it.
2013-10-27 20:29:34 +01:00
Stephen Kelly 5e15f39886 Normalize system directories from the interface target property
The input dir being tested is normalized, so ensure that the entries
in the vector are normalized too (eg no trailing slash).
2013-08-29 10:28:52 +02:00
Stephen Kelly 9cf3547e1c Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
Unlike other target properties, this does not have a corresponding
non-INTERFACE variant.

This allows propagation of system attribute on include directories
from link dependents.
2013-07-16 13:44:57 -04:00
Stephen Kelly 83498d4135 Store system include directories in the cmTarget.
Entries from the cmMakefile are processed and maintained similarly
to other include directories. The include_directories(SYSTEM)
signature affects all following targets, and all prior targets
in the same makefile.
2013-07-02 16:40:02 +02:00
Stephen Kelly f1fcbe3fde Add Target API to determine if an include is a system include.
The implementation can be modified later so that system includes
can be determined on a per-target basis.
2013-07-02 16:40:02 +02:00
John Farrier 79ec7868d0 VS: Add Windows Forms Support
Add support to maintain designer functionality for Visual Studio C++
Windows Forms projects.  Also add a test project showing how to use
the CMakeLists.txt file and, when successfully configured, will allow
use of the designer for the included form.
2013-05-16 13:06:44 -04:00