Commit Graph

219 Commits

Author SHA1 Message Date
Gusts Kaksis
9e1e7dc7db Xcode: Add embedded plugins option 2021-11-10 09:57:07 -05:00
Brad King
46e9ff5729 Restore honoring CMAKE_GENERATOR_INSTANCE in toolchain file
Revert the changes from commit d5b5c19278 (cmGlobalGenerator:
FindMakeProgram() before CMakeDetermineSystem, 2020-06-15,
v3.19.0-rc1~619^2~3) and commit ef91fb02f3 (cmGlobalGenerator:
FindMakeProgram() at a generator-specific time, 2020-11-23,
v3.19.1~2^2).  We must delay selecting the location of MSBuild until
after an instance of Visual Studio has been selected.

It is now safe to revert the ordering because the motivating use
case (sysroot detection in Platform/Android-Determine) has been
implemented another way.

Fixes: #22782
2021-10-20 13:00:26 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marc Chevrier
dffa3f485c cmGlobalGenerator::PrintCompilerAdvice: use cmProp as augment 2021-09-19 19:11:07 +02:00
Brad King
f69079577a cmGlobalXCodeGenerator: Simplify relative path conversion under project root 2021-05-12 15:43:58 -04:00
Brad King
395e1d458e Merge topic 'xcode_app_extensions'
eb5e33ba47 Xcode: Add support for embedding app extensions
f62a2bf44f Tests: Factor out XcodeProject-Embed check function findAttribute()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5934
2021-04-26 11:34:38 -04:00
Alexander Akhundzhanov
eb5e33ba47 Xcode: Add support for embedding app extensions
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2021-04-22 15:17:02 +10:00
Marc Chevrier
253aff6c94 Xcode: Add support of DEPFILE for add_custom_command, part 2
This MR extend the support of 'DEPFILE' to buildsystem version 1.

Issue: #20286
2021-04-17 11:05:26 +02:00
Marc Chevrier
d67cc4882d Xcode: Add support of DEPFILE for add_custom_command
Issue: #20286
2021-04-15 12:17:31 -04:00
Brad King
38335f275f Merge topic 'xcode-object-ids'
b8b6573db8 Xcode: Use deterministic object ids for script build phases
2892228dc9 cmGlobalXCodeGenerator: Add infrastructure for deterministic object ids
d250b67722 cmGlobalXCodeGenerator: Adopt pbxproj object id generation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5671
2021-01-08 09:07:18 -05:00
Brad King
b8b6573db8 Xcode: Use deterministic object ids for script build phases
The Xcode "new build system" only considers a script build phase up to
date if it has run before, even if outputs are newer than inputs.  Use a
deterministic object id for script build phases associated with custom
commands so that they do not need to re-run after CMake re-generates the
project.

Fixes: #21669
2021-01-06 18:46:30 -05:00
Brad King
2892228dc9 cmGlobalXCodeGenerator: Add infrastructure for deterministic object ids 2021-01-06 16:24:12 -05:00
Brad King
d250b67722 cmGlobalXCodeGenerator: Adopt pbxproj object id generation 2021-01-06 16:21:53 -05:00
Brad King
5115e8b2b6 Xcode: Generalize inheritance of project-level search paths
Generalize the change from commit bffb17be3d (Xcode: Inherit target
library and framework search paths from project, 2020-11-04,
v3.19.0-rc3~4^2) to apply to framework and other kinds of search paths
added either for include directories or for linking.

Issue: #21617
2020-12-22 08:56:26 -05:00
Brad King
6b6230b23b cmGlobalXCodeGenerator: Factor out helper to append attribute 2020-12-21 10:19:45 -05:00
Gusts Kaksis
5651901c54 Xcode: add support for embedding frameworks
This commit also prepares for embedding things other than
frameworks. In the future, we may want to embed resources and
other types supported by Xcode, so the target properties have
been documented in a way that clearly signals the future intent.
2020-11-28 15:36:24 +11:00
Kyle Edwards
ef91fb02f3 cmGlobalGenerator: FindMakeProgram() at a generator-specific time
d5b5c192 moved FindMakeProgram() to an earlier time, which resulted
in CMAKE_MAKE_PROGRAM not being read from the toolchain file. Change
it to only call FindMakeProgram() early in the specific cases of
Visual Studio and Xcode, and restore the old behavior for all other
generators.

Fixes: #21486
2020-11-23 14:20:08 -05:00
Brad King
c6c7f6fbeb Xcode: Remove remnants of ancient XCODE_DEPEND_HELPER utility target
The target has not been generated since commit d92d51429e (BUG: fix for bug
6193, fix xcode depend helper, 2008-01-10, v2.6.0~553).  Remove it from
the list of special targets.
2020-09-24 14:53:22 -04:00
Brad King
8d5f4c4db9 Xcode: Switch to the "new build system" for Xcode 12 and above
Provide an option to switch back to the original build system via
`-T buildsystem=1`.

Fixes: #18088
2020-09-18 13:02:14 -04:00
Brad King
2db623f554 Xcode: Add option to specify build system variant
Extend the `-T <toolset>` option to support a `buildsystem=` field with
the Xcode generator.  Add a `CMAKE_XCODE_BUILD_SYSTEM` variable to
inform project code about the selected build system variant.
2020-09-18 12:49:17 -04:00
Brad King
0d03717996 Xcode: Clarify name of legacy run script build phase helper 2020-09-18 12:49:17 -04:00
Brad King
c4e296a609 cmGlobalGenerator: Compute a global target ordering respecting dependencies
Move this up from `cmGlobalXCodeGenerator`.  It will be useful for all
generators.
2020-09-04 09:31:06 -04:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Brad King
e33f8f078a Xcode: Avoid unnecessary duplication of custom commands across targets
Do not attach a custom command to a target if it is already attached to one of
the target's dependencies.  The command's output will be available by the time
the target needs it because the dependency containing the command will have
already been built.

Since commit fb45559e09 (Xcode: Process targets in depth-first order during
generation, 2018-07-19, v3.13.0-rc1~293^2) we generate a target only after
generating its dependencies.  Therefore when visiting the custom commands in a
target, we can assume that custom commands in its dependencies have already
been visited.
2020-09-01 14:05:57 -04:00
Gusts Kaksis
7b3d8411a2 Xcode: Refactor build setting append code and attribute getter naming
Support both STRING and OBJECT_LIST types in build setting attributes and make it possible to mix them
2020-08-28 21:20:38 +03:00
Craig Scott
8abeec58f3 Merge topic 'xcode-native-arch'
26673bf480 Xcode: Explicitly specify default native architecture on macOS
ce624cfbd4 cmGlobalXCodeGenerator: Save CMAKE_SYSTEM_NAME in member

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5023
2020-07-21 07:19:02 -04:00
Brad King
ce624cfbd4 cmGlobalXCodeGenerator: Save CMAKE_SYSTEM_NAME in member 2020-07-16 14:17:47 -04:00
Gusts Kaksis
e637744c51 Xcode: Use "Link Binary With Libraries" to link any library
Add external libraries as fileRefs to Xcode project and add those
references to Link Binary With Libraries build phase.  This allows
linking .a, .o, .dylib, .framework and .tbd libraries through "Link
Binary With Libraries" build phase, as opposed to `OTHER_LINKER_FLAGS`.

This improves on the approach added by commit 58c05e1c73 (Xcode: Use
"Link Binary With Libraries" build phase when possible, 2020-06-12).
2020-07-14 08:07:55 -04:00
Harry Mallon
258c8734a9 Xcode: Fix LANGUAGE property on .m/.mm files
When OBJC or OBJCXX is enabled as a language, prefer that for .m and .mm
source file language selection.

Fixes: #20257
2020-07-03 07:30:50 -04:00
Gusts Kaksis
58c05e1c73 Xcode: Use "Link Binary With Libraries" build phase when possible
Try linking all target linked libraries through frameworks build phase
instead of linker flags, thus letting Xcode manage build product paths
correctly.  Prevent adding duplicate entries to "Link Binary With
Libraries" build phase.

Add check for configuration-dependent linking - in case the library is
not present in all configurations revert back to linker flags which are
per-configuration.

This does change the order of libraries linked, but that does not seem
to matter for Apple linkers invoked by Xcode, even for static libraries.
The linker will go back and re-consider a static library from earlier
on the link line when more symbols from its objects are needed.

Fixes: #14185
2020-06-17 06:35:25 -04:00
Gusts Kaksis
927373b678 Xcode: Refactor generator variable names and types
* Instead of `classes` use name `commonSourceFiles`.
* No need for reference when you have pointer.
2020-06-15 11:20:32 -04:00
Marc Chevrier
9de0355d4f Modernize memory management
Update internals of various classes.
2020-03-05 07:34:01 -05:00
Marc Chevrier
a00960288b GlobalGenerator family: modernize memory management 2020-01-07 11:03:11 +01:00
Marc Chevrier
36c8cae2e8 cmLocalGenerator: modernize memory management 2019-12-10 00:24:06 +01:00
Alexander Boczar
99e83d4235 cmake: Teach --build mode to load CMAKE_GENERATOR_TOOLSET
Extend the `cmGlobalGenerator::SetGeneratorToolset` signature to
indicate when it is called from `cmake::build`.
2019-10-15 13:28:41 -04:00
Brad King
175d8c4bf6 clang-tidy: Resolve performance-unnecessary-value-param diagnostics
Fix diagnostics that appear on macOS with clang-tidy-8.  Suppress cases
where we intentionally take an argument by value to let the caller
choose whether to copy or move.
2019-09-09 13:51:23 -04:00
Sebastian Holtermann
735c6f39d9 Fix invalid ///! doxygen comment line starts
In various places `///!` was used to start a comment line.  This is not valid
Doygen syntax.  This patch replaces `///!` comment starts with `//!`.
2019-03-31 11:27:12 +02:00
Harry Mallon
413b71485a Xcode: Create Xcode schemes per target 2019-03-21 16:50:41 +00:00
Gregor Jasny
482d9ef9a8 cmGlobalXCodeGenerator: Prefer std::string over char* 2019-03-17 20:41:35 +01:00
Bartosz Kosiorek
324d18bb34 cmake: Teach --build mode to support multiple targets
Fixes: #16136
2019-03-05 08:55:28 -05:00
Brad King
eff9c69740 Xcode: Place object library artifacts outside Objects-normal directory
The `CONFIGURATION_BUILD_DIR` value in the Xcode project file specifies
where to place the library artifact.  For object libraries we've used
the `Objects-normal` directory to hide away the `.a` that we otherwise
cannot stop Xcode from producing.  The parent of this directory is also
specific to the target and does not vary with Xcode's sanitizer
features, so move the artifact there.

Issue: #16289
2019-01-30 10:28:05 -05:00
Robert Maynard
1a45266cb5 cmGlobalGenerator: Add a class that represent the build command
This refactors a std::vector<std::string> into a class so that
we can extend the features to represent things such as multiple
chained commands in the future.
2019-01-25 08:20:02 -05:00
Marc Chevrier
c4b4d8b3a6 POSITION_INDEPENDENT_CODE: Manage link flags for executables
Fixes: #14983, #16561
2018-11-11 17:34:09 +01:00
Brad King
39c91d0703 cmGlobalGenerator: Add IsXcode query
Make it easy to detect use of the Xcode generator.
2018-08-01 09:12:42 -04:00
Brad King
d0de296e50 Xcode: Factor target generation loop body into helper method 2018-07-19 13:20:28 -04:00
Brad King
30e27b4110 Xcode: Compute global order index for targets
Compute an index for each target in a global ordering such that no
target comes before its dependencies.
2018-07-19 13:20:28 -04:00
Gregor Jasny
985d3a162c Xcode: Use legacy build system
Closes: #18099
2018-06-19 10:56:50 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2018-06-01 09:53:42 -04:00
Florian Maushart
1ab3881ec9 cmake: Add options for parallel builds to --build mode
While we already support `cmake --build . -- -j`, the options after `--`
are specific to the native build tool.  Add new options `--parallel
[<N>]` and `-j [<N>]` to abstract this and map to the proper option
for the native build tool.
2018-05-25 09:42:20 -04:00
Brad King
8480c2afc0 Restore support for explicitly referenced CMakeLists.txt sources
Since commit v3.11.0-rc1~467^2 (VS,Xcode: Add CMakeLists.txt sources
without mutating targets, 2017-10-18) we do not add `CMakeLists.txt` to
target sources but instead generate references to them directly.  This
broke projects that explicitly specify their `CMakeLists.txt` file as a
source file because the explicit entry is no longer consolidated with
the generated one.

Teach the relevant generators to avoid duplicating `CMakeLists.txt`
source references and add test cases.

Fixes: #17828
2018-04-13 09:41:06 -04:00