Commit Graph

205 Commits

Author SHA1 Message Date
Brad King
5d12b87b9d cmGeneratorTarget: Improve GetCreateRuleVariable API
Pass the language and configuration to the method so it can return the
complete rule variable name.
2014-05-21 09:38:24 -04:00
Brad King
60d1882a67 Merge topic 'ninja-link-with-compile-flags'
97f2b7f5 Ninja: set correct LANGUAGE_COMPILE_FLAGS when linking
49fcffc6 Ninja: cmake formatting, make code more readable
b735c8cb MinGW: link like on Unix and use compile flags when linking
2014-04-15 10:22:32 -04:00
Peter Kümmel
97f2b7f5ab Ninja: set correct LANGUAGE_COMPILE_FLAGS when linking 2014-04-15 10:17:06 -04:00
Peter Kümmel
49fcffc6cc Ninja: cmake formatting, make code more readable 2014-04-15 10:17:06 -04:00
Peter Kümmel
504bb62d99 Ninja: replace \ in LINK_PATH for MinGW 2014-04-15 10:14:50 -04:00
Jiri Malak
cb9b1e13e4 Watcom: Use single quote for all file/path items in wlink command
Watcom Linker use single quote if necessary for quoting target name,
libraries names and libraries search path.  Object names were already
fixed.
2014-04-08 13:28:54 -04:00
Brad King
5376151aa1 Merge topic 'target-transitive-sources'
9407174b target_sources: New command to add sources to target.
81ad69e0 Make the SOURCES target property writable.
6e636f2e cmTarget: Make the SOURCES origin tracable.
3676fb49 cmTarget: Allow transitive evaluation of SOURCES property.
e6971df6 cmTarget: Make the source files depend on the config.
df753df9 cmGeneratorTarget: Don't add computed sources to the target.
869328aa cmComputeTargetDepends: Use valid config to compute target depends.
2014-04-03 12:51:53 -04: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
Jiri Malak
2b89675256 Ninja: Simplify code for linker commands
Use GetCreateRuleVariable function instead of redundant code for Rule
variable name.  Use temporary variables to improve code.
2014-04-01 10:58:58 -04:00
Brad King
bc993f277e Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the
command lines of a custom command.  Generalize it to get the comment,
working directory, dependencies, and outputs of custom commands.  Update
use in all generators to support this.
2014-03-12 10:44:01 -04:00
Brad King
cb8f87f622 Merge topic 'remove-c_str-calls'
3be265b3 Workaround Sun C++ 5.9 compiler crash
af8a1643 Remove c_str calls when using stream APIs.
21c573f6 Remove some c_str() calls.
2014-03-12 10:42:38 -04: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
Adrien Destugues
6c90f0a693 Ninja: Detect command-line length limit on Haiku 2014-03-10 09:42:38 -04: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
Peter Kümmel
7605e37aab Ninja: job pool support for compiling and linking
Could be tested by setting the environment
variable NINJA_STATUS=[%r]
2013-11-25 22:23:24 +01:00
Stephen Kelly
c34968a9aa Port some of the generator API to cmGeneratorTarget.
Just enough to reach the BuildMacContentDirectory method and the
NeedRelinkBeforeInstall methods.

In the future, those methods can be moved to cmGeneratorTarget.
2013-11-22 15:06:25 +01:00
Stephen Kelly
50d152035d cmTarget: Make custom command accessors API const.
Add specific mutators instead of providing non-const refs.
2013-11-19 20:40:31 +01:00
Peter Kümmel
eeb4aece1c Ninja: use deps = gcc/msvc feature
cmcldeps is now only used for .rc file processing
2013-10-24 19:48:18 +02:00
Clinton Stimpson
603bc5998f OS X: Fix regression handling frameworks for Ninja
Fix a regression created by commit 373faae5 (Refactor how bundles and
frameworks are supported, 2013-05-05).

Since the ninja file isn't aware of how framework symlinks work, we
suppress symlink creation and let cmOSXBundleGenerator handle it.  Also,
use the real name of framework library in build rules as was done
before, instead of the symlink.
2013-07-22 09:40:11 -04:00
Stephen Kelly
0416c94f64 Revert "Use --sysroot when cross compiling."
This reverts commit de4da665d3.

This feature is not yet ready for release. It needs to be
merged with the CMAKE_OSX_SYSROOT feature.
2013-07-12 15:44:38 +02:00
Robert Maynard
874e17120d Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non static
To properly track the usage of dependencies that are generated at
compile time as the side effect of other build steps we need
to make the WriteBuild and WritePhonyBuild commands non static
2013-07-01 08:59:38 -04:00
Brad King
b2d70c1a20 Merge topic 'set-sysroot'
de4da66 Use --sysroot when cross compiling.
2013-06-24 08:46:12 -04:00
Stephen Kelly
2331b57bec Add whitespace after colons in error messages. 2013-06-21 16:21:44 +02:00
Stephen Kelly
de4da665d3 Use --sysroot when cross compiling.
As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is
introduced, which is never a list.

The contents of this variable is passed to supporting compilers
as --sysroot. It is also accounted for when processing implicit
link directories reported by the compiler, and when generating
RPATH information.
2013-06-07 13:32:52 +02:00
Brad King
05e47f2122 Merge topic 'cfbundle-location'
483e208 OS X:  Fix getting of CFBundle LOCATION property.
2013-06-04 09:02:46 -04:00
Brad King
b0759da303 Merge topic 'framework-refactor'
373faae Refactor how bundles and frameworks are supported.
2013-06-03 09:56:32 -04:00
Clinton Stimpson
483e208482 OS X: Fix getting of CFBundle LOCATION property.
This fixes bug #13797.
The kinds of changes applied in 373faae5 for frameworks are now
applied to CFBundle.  The prefix and suffix for CFBundles are
now handled in cmTarget::GetFullNameInternal.
2013-06-03 06:29:33 -06:00
Clinton Stimpson
373faae5e1 Refactor how bundles and frameworks are supported.
Make handling of directory separators consistent between
non-bundle and bundle code.

Remove xcode specific flag from cmTarget when getting install_name.

Add (more) consistent convenience functions in cmTarget to get
directories inside of bundles and frameworks to add files to.

This refactor also fixes bug #12263 where frameworks
had the wrong install name when SKIP_BUILD_RPATH.

Also make install_name for frameworks consistent between Makefile
and Xcode generator.
2013-05-23 10:42:49 -04:00
Andreas Mohr
bf019d765d Fix spelling and typos (non-binary) 2013-05-07 08:39:19 -04:00
Patrick Gansterer
a55d5ca481 Ninja: Avoid LNK1170 linker error
link.exe has problems with very very long lines in rsp files too.
Use $in_newline instead of $in variable for rspcontent which
separates the arguments with a newline instead of a simple space
and was specially made for this purpose.
2013-02-04 16:26:39 -05:00
Peter Kümmel
12ab1354fc Ninja: encode LINK_FLAGS to handle bash variables
Bug 13560
2012-11-20 22:00:09 +01:00
Stephen Kelly
bd8bdb6fdd Resolve warnings about unused variables. 2012-11-07 13:45:30 +01:00
Peter Kümmel
1e47ccb554 Ninja: add option to enforce usage of response files
If the cmake or environment variable CMAKE_NINJA_FORCE_RESPONSE_FILE
is set then a response file is used regardless the command line length.
2012-10-01 17:06:38 -04:00
Peter Kümmel
e31df03939 Ninja: move <OBJECTS> in front of the first linker option
In the response file also linker options could be passed,
and because <OBJECTS> is replaced by a response file, it
is necessary that no compiler option follows <OBJECTS>.
2012-10-01 17:06:38 -04:00
Peter Kümmel
8d674e7844 Ninja: move -LIBPATH behind -link option
Don' pass linker option to the compile
2012-10-01 17:06:38 -04:00
Peter Kümmel
f1670ab18a Ninja: don't confuse ninja's rsp files with nmake's
Move response files into CMakeFiles/ which makes them different to nmake's.
2012-09-28 12:33:57 +02:00
Stephen Kelly
f9146f6b90 Port cmLocalGenerator::GetTargetFlags to cmGeneratorTarget. 2012-09-19 15:31:39 +02:00
Stephen Kelly
78bfee35d5 Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget. 2012-09-19 15:31:29 +02:00
Peter Kümmel
4bb4787780 Ninja:split out setting of msvc TARGET_PDB 2012-08-22 12:37:55 +02:00
Peter Kümmel
59cbc28b92 Ninja: prepare msvc pdb cleanup 2012-08-22 12:26:56 +02:00
David Cole
a51e1529e7 Merge topic 'ninja-fix-macosx'
1fc8df9 Add missing this->.
7a3ecf5 Fix memory leak in Makefile generator.
9f7dc83 Ninja: also bootstrap ninja files
5d365b2 Ninja: enable ninja support everywhere
d569f3e Ninja: void function can't return a value
52160bf Ninja: enable ninja on Mac so all Mac CDash-builds are tested, cleanup later
56aeac6 Ninja: fixes for bcc
7a6bc9e Ninja: remove 'this' from member initializer list
44ba4cf Ninja: remove warnings
7751966 Ninja: remove 'friend' in ninja code
c3988ee Re-factor OS X content generator start up.
f8e0a51 Re-factor framework directory computation.
f36c7b0 Re-factor Mac OS X content directory computation.
5d885db Re-factor bundle content copying rules generation.
3b2a01e Ninja: Use same echo message as makefiles.
7bb56c5 Re-factor CFBundle generation.
...
2012-07-24 17:03:46 -04:00
David Cole
0f87f32fe3 Merge topic 'ninja-mingw-TARGET_PDB'
9e30289 Ninja: Cannot pass a reference to an anonymous object.
0a3d6a1 Ninja: make debug symbol suffix configurable by CMAKE_DEBUG_SYMBOL_SUFFIX
75bbffb Ninja: make TARGET_PDB a real .gdb file name
e5a27a4 Ninja: line length
ae8124a Ninja: also mingw needs TARGET_PDB
2012-07-24 17:03:13 -04:00
Nicolas Despres
9e30289176 Ninja: Cannot pass a reference to an anonymous object. 2012-07-18 12:35:10 +02:00
Nicolas Despres
3b2a01e80e Ninja: Use same echo message as makefiles. 2012-07-17 14:03:10 +02:00
Nicolas Despres
7bb56c511e Re-factor CFBundle generation. 2012-07-17 14:03:09 +02:00
Nicolas Despres
54d9713adb Ninja: Add support for CFBundle.
This patch fixes test CFBundleTest on Darwin.
2012-07-17 14:03:08 +02:00
Nicolas Despres
10686a17f4 Ninja: Copy resource files in the bundle.
This patch fixes test BundleTest on Darwin.
2012-07-17 14:03:08 +02:00
Nicolas Despres
a1b803349b Re-factor OS X bundle and framework generation. 2012-07-17 14:03:07 +02:00
Nicolas Despres
a7b4e3a57b Ninja: Add support for OX X library framework.
This patch fixes test ExportImport on Darwin.
2012-07-17 14:03:05 +02:00
Nicolas Despres
21f156c03b Ninja: Add support for OS X app bundles.
This patch fixes test Qt4Deploy on Darwin.

Thanks to Jamie Kirkpatrick <jkp@kirkconsulting.co.uk>
2012-07-17 14:03:04 +02:00
Peter Kümmel
0a3d6a19b7 Ninja: make debug symbol suffix configurable by CMAKE_DEBUG_SYMBOL_SUFFIX 2012-07-17 11:45:19 +02:00
Peter Kümmel
75bbffbe1b Ninja: make TARGET_PDB a real .gdb file name 2012-07-17 11:21:03 +02:00
Peter Kümmel
e5a27a44a7 Ninja: line length 2012-07-16 18:16:01 +02:00
Peter Kümmel
ae8124a04c Ninja: also mingw needs TARGET_PDB 2012-07-16 15:03:38 +02:00
Peter Kümmel
42592966c5 Ninja: fix sytle 2012-07-13 15:22:03 +02:00
Peter Kümmel
3799848836 Ninja: fix GCC 4.7 warning -Wconversion 2012-07-13 08:58:37 +02:00
Peter Kümmel
4bb94c9fbd Ninja: sysconf() is declared in unistd.h 2012-07-11 10:20:46 +02:00
Peter Kümmel
bb3675999f Ninja: enable response file support on Mac (length 262144) 2012-07-11 10:11:01 +02:00
Peter Kümmel
3a2c8e8e66 Ninja: disable work around when linking with mingw
The work around is only needed by older GCCs (only testet 4.4/4.7)
Ninja is very new so chances are high that there is also a new mingw.

Use slashes in link rsp file, because ar.exe can't handle \.
2012-07-11 08:55:00 +02:00
Peter Kümmel
7f647cf5eb Ninja: also write link libraries to rsp file
and enable rspfile support on Linux, needed for commands longer than e.g. 2096152 characters on Ubuntu.
2012-07-10 10:53:24 +02:00
Peter Kuemmel
6b31d39551 Ninja: don't shadow 'outputs' variable 2012-07-09 14:15:08 -04:00
Nicolas Despres
e3b1be24a8 Ninja: Clean all symlink created for libraries.
'ninja -t clean' only cleans built output and dep files so all file
created as a side effect and not mentioned in the 'build' statement
would be omitted.
2012-07-09 14:15:08 -04:00
Peter Kuemmel
6332ba5a58 Ninja: also consider rule command length for rsp file 2012-07-02 10:30:29 +02:00
David Cole
565744bd3d Merge topic 'ninja-cldeps'
eb410e8 Ninja: disable cldeps for bcc32, it's too old, and ninja would also not build
5ead31d Ninja: try work around for bcc32 bug
1333b57 Ninja: build server fixes
9081e3a remove warning about unused parameter
f430bea Ninja: maybe this fixes the bcc32 build
f2c1288 Ninja: msvc6 for-scoping
44b9bbc Ninja: build with old msvc versions
57156a5 Ninja: build server fixes
f1abdce Ninja: some bytes of the rc files couldn't be piped correctly
2de963d Ninja: don't remove space between command and parameters
50b6f33 Ninja: build cmcldeps with mingw
c05653e Ninja: try to make GetProcessId visible
ab245ff Ninja: but cl supports /nologo ...
bf58e9a Ninja: no /nologo option in old rc.exe
2fb07fc Ninja: Eclipse and KDevelop fixes for ninja
518c065 Ninja: don't pollute build dir with preprocessed rc files
...
2012-06-19 14:42:41 -04:00
Peter Kuemmel
41c28dc35b Ninja: be more accurate when estimating the command line length 2012-06-15 02:00:15 +02:00
Peter Kuemmel
f13a6a087e Ninja: undo all the NOSHELL patches 2012-06-15 01:43:08 +02:00
David Cole
555bda4e43 Ninja: Restructure code to work with the Borland compilers
Should fix the Borland dashboard errors.
2012-06-14 13:39:39 -04:00
Peter Kuemmel
eda3075478 Ninja: sh needs something befor and after && 2012-06-14 17:26:01 +02:00
Peter Kuemmel
1d55ea557d Ninja: fix Linux build 2012-06-14 16:01:35 +02:00
Peter Kuemmel
6546086004 Ninja: don't use shell when cmake is called directly
When linking with cmake and vs_link_* the command line
could be too long for cmd.exe, which needs not to be
called in this case. (was not cached by a test)

Introduce rules which don't use the shell and use this
rule when there are no pre or post step.

For free we get a small speedup, because cmd is then
not called.

Also be more accurate when estimating the
command line length.
2012-06-14 14:22:56 +02:00
Peter Kuemmel
43200c145d Ninja: work with ninja/master, don't compile rc files with cl
Ninja generates for paths with spaces wrong results for $out.d,
using the new DEP_FILE variable instead.
2012-06-13 00:52:46 +02:00
Brad King
32313fd0d4 Merge branch 'ninja-rspfile' into no-std-stringstream
Conflicts:
	Source/cmGlobalNinjaGenerator.cxx
	Source/cmLocalNinjaGenerator.cxx
	Source/cmNinjaNormalTargetGenerator.cxx
2012-06-12 15:43:32 -04:00
Brad King
94de982902 Avoid direct use of std::(o|)stringstream (#13272)
Older C++ compilers do not provide a standard std::stringstream.
Use our compatibility interfaces instead.

Also avoid std::stringstream(openmode) signature.  Our approximate
stringstream implementation provided when the standard one is not
available does not support the openmode argument.
2012-06-12 15:40:24 -04:00
Peter Kuemmel
38aa9e97f2 Ninja: complete MinGW support 2012-06-12 04:17:55 +02:00
Peter Kuemmel
ba8d0db217 Ninja: don't pollute the rules file with useless comments 2012-06-10 20:20:29 +02:00
Peter Kuemmel
128fe5d504 Ninja: also create rspfile rules 2012-06-05 23:40:42 +02:00
Peter Kuemmel
5aab7f90f1 Ninja: 30000 is too long for windows cmd 2012-06-05 23:21:01 +02:00
Peter Kuemmel
ad4a768d59 Ninja: add response file support on Windows
When MinGW is used slashes are used for dependencies
because ar.exe can't read rsp files with backslashes.

Many thx to Claus Klein for starting working on this.
2012-06-05 22:39:42 +02:00
Peter Collingbourne
d807aab28f Ninja: apply CMAKE_<LANG>_FLAGS_<TYPE> to executable targets (#13069)
Based on a patch by Zaheer Chothia!
2012-05-16 22:56:42 +01:00
David Cole
8df7aa54f0 Merge topic 'module-no-soname'
fdb3f87 Test NO_SONAME property (#13155)
e1409ac Support building shared libraries or modules without soname (#13155)
2012-05-01 14:09:59 -04:00
Modestas Vainius
e1409ac59b Support building shared libraries or modules without soname (#13155)
Add a boolean target property NO_SONAME which may be used to disable
soname for the specified shared library or module even if the platform
supports it.  This property should be useful for private shared
libraries or various plugins which live in private directories and have
not been designed to be found or loaded globally.

Replace references to <CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG> and
hard-coded -install_name flags with a conditional <SONAME_FLAG> which is
expanded to the value of the CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG
definition as long as soname supports is enabled for the target in
question.  Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in
rules in case third party projects still use it.  Such projects would
not yet use NO_SONAME so the adjacent <TARGET_SONAME> will always be
expanded.  Make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well.  Since
-install_name is soname on OS X, this should not be a problem if this
variable is expanded only if soname is enabled.

The Ninja generator performs rule variable substitution only once
globally per rule to put its own placeholders.  Final substitution is
performed by ninja at build time.  Therefore we cannot conditionally
replace the soname placeholders on a per-target basis.  Rather than
omitting $SONAME from rules.ninja, simply do not write its contents for
targets which have NO_SONAME.  Since 3 variables are affected by
NO_SONAME ($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if
soname is enabled.
2012-04-30 11:50:27 -04:00
Peter Kuemmel
11bd9b5588 Ninja: remove GCC -Wshadow warning 2012-04-07 21:41:41 +02:00
Peter Kuemmel
73426ac774 Ninja: no 16:9 screens for the cmake team ;) 2012-04-06 21:07:32 +02:00
Peter Kuemmel
8217c26813 Ninja: ensure output directories exist 2012-04-06 19:31:18 +02:00
David Cole
d69c2c5825 Merge topic 'ninja-generator'
c337c7e Ninja: Fix <OBJECT_DIR> substitution
2012-03-20 09:34:56 -04:00
Peter Kuemmel
c337c7e205 Ninja: Fix <OBJECT_DIR> substitution
Don't forget the subdirectories.
2012-03-19 10:09:40 -04:00
Brad King
61124de4c0 Build object library targets in Ninja
Treat OBJECT libraries as STATIC libraries but leave out the archive
step.  The object files will be left behind for reference by other
targets later.
2012-03-16 10:18:36 -04:00
Brad King
48eb7fc7d7 Ninja: Avoid using 'this' in member initializers
VS complains

 warning C4355: 'this' : used in base member initializer list

so initialize the member in the constructor body instead.
2012-03-16 10:16:55 -04:00
Bill Hoffman
bba37dd517 Ninja: Fix for PDB files with spaces in the path.
This calls ConvertToOutputFormat on the PDB paths for pdb file paths
used in both library creation and the building of object files.
2012-03-16 10:16:45 -04:00
Peter Kuemmel
9a0d5a828a Ninja: add /DEF: flag to linker call 2012-03-13 11:20:29 -04:00
Peter Kuemmel
dbe3dce546 Ninja: add .def file support 2012-03-07 16:24:34 -05:00
Peter Kuemmel
f1bb08f55b Ninja: ensure the output dir exists at compile time 2012-03-07 16:24:33 -05:00
Peter Collingbourne
7a6b5f4651 Ninja: Remove an unnecessary variable 2012-02-28 02:55:32 +00:00
Peter Collingbourne
80ff2102a4 Ninja: Use cmSystemTools::ExpandListArgument to split compile/link commands 2012-02-27 04:05:38 +00:00
Peter Kuemmel
54bd175eea Ninja: windows msvc: create for each target a .pdb file 2012-02-21 21:18:05 +01:00
Peter Collingbourne
a1a30340a2 Ninja: Import library support for Windows 2012-02-19 23:20:03 +00:00
Peter Kuemmel
21997cea4d Ninja: mark the Windows specific hacks with a comment only 2012-02-19 19:21:05 +01:00
Peter Kuemmel
adb54f3dbf Ninja: add some hacks for Windows 2012-02-19 11:30:07 +01:00
Peter Collingbourne
0643fee2fe Ninja: Shell encode various CMake invocations 2012-02-19 05:57:22 +00:00
Peter Collingbourne
43b1d8bad0 Ninja: Shell encode paths used in "cd" commands 2012-02-19 05:43:47 +00:00
Peter Kuemmel
7fb2bb3e8b Ninja: win fixes: escape back slash/colon, use cd. as cmd.exe nop 2012-02-18 08:15:23 +01:00
Peter Collingbourne
5d19e8aa6a Ninja: Appease various compilers 2012-02-05 01:48:08 +00:00
Peter Collingbourne
6dd410c2b9 Ninja: Add the Ninja generator 2012-02-02 23:40:21 +00:00