Commit Graph

80 Commits

Author SHA1 Message Date
Gregor Jasny
53ca6edd8a xcode: add support for xcconfig files
Fixes: #18420
2022-04-03 22:39:34 +02:00
Jake Turner
0798edfb85 Tests: Xcode scheme ENABLE_GPU_FRAME_CAPTURE_MODE
Setting numerical value
Caseless comparison of string values
"Metal" is converted to value 1
"Disabled" is converted to value 3
2021-11-09 06:28:33 +00:00
Brad King
75901f0472 Tests: Fix RunCMake.XcodeProject XcodeIOSInstallCombined cases for Xcode 13.0
The output of `otool -vf` now contains additional content that happens
to be matched by our architectures regex.  Make the regex more strict.
2021-10-05 09:13:23 -04:00
Gregor Jasny
0e86fea0be Tests: Specify destination for Xcode scheme
The `Using the first of multiple matching destinations` warning
vanishes if we explicitly specify a destination.

Fixes: #22704
2021-10-05 07:38:48 -04:00
Yauheni Khnykin
0b5301a778 FindXCTest: Fix output directory for test bundle with Xcode 12.5
The fix from commit eafe740ead (FindXCTest: Fix output directory for
test bundle with new build system, 2021-02-09, v3.19.5~5^2) is not
necessary with Xcode 12.5, which seems to have changed/fixed the
behaviour again.

Fixes: #22462
2021-07-26 13:31:10 -04:00
Danny Parker
dfaf55fbfd Xcode: add extra '$(inherited)' entries using InheritBuildSettingAttribute.
These have been added to:
GCC_PREPROCESSOR_DEFINITIONS
OTHER_CFLAGS
OTHER_LDFLAGS

This is to allow Cocoapods to work correctly as it uses xcconfig files to alter build settings in Xcode, and requires these build settings to inherit from their parent, not overwrite.
2021-05-05 14:38:33 +01:00
Yauheni Khnykin
74eda8ab1f Tests: Add XCTest cases to cover output directory selection
Fixes: #21800
2021-03-13 00:54:25 +01:00
Brad King
cab99f7dba Merge topic 'xcode12-ios_install_combined'
0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5785
2021-02-09 08:23:30 -05:00
Craig Scott
0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)
Xcode 12 doesn't allow nested builds within the same build directory.
That means we can no longer do an install by building the install target
when IOS_INSTALL_COMBINED is true. We can, however, still do an install
by running the cmake_install.cmake script or executing cmake --install,
since there is no outer build and therefore the associated SDK can be
built as a sub-build.

The non-build methods previously didn't work when
IOS_INSTALL_COMBINED was true because the generated install script
and the CMakeIOSInstallCombined script both made certain assumptions
that relied on being part of a build. Those assumptions are now
removed. A side-effect of this work is that cpack now also works from the
command line when IOS_INSTALL_COMBINED is true.

Relates: #21282
Fixes: #20023
2021-02-08 18:02:46 +11: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
Yauheni Khnykin
31d3e64080 Tests: Add Xcode cases fixed by switch to the "new build system"
Support of 'new build system' in Xcode fixes indirectly few issues
which were caused by workaround with `XCODE_DEPEND_HELPER.cmake`
autogenerated script.

This patch adds test which is originated from issue #20260 and
reproduces this issue when 'new build system' is disabled.

Fixes: #20260
2020-11-30 13:02:51 -05:00
Gusts Kaksis
ce2dee9e5b Xcode: Don't add framework as -framework argument in linker info list 2020-10-02 22:13:00 +10:00
Gregor Jasny
2092ab08fe xcode: conditionally enable combined install tests
The new Xcode 12 build system does not support recursive
invocation. Therefore lazily triggered builds for the
corresponding platform which run during the `install` target
fail with:

```
error: unable to attach DB: error: accessing build database
```

While looking for a work-around we conditionally disable those
tests.

Issue: #21206
2020-09-25 09:38:30 +02:00
Gregor Jasny
62ce9e16e0 xcode: annotate test output with selected SDK 2020-09-25 09:30:17 +02:00
Brad King
fe258f6382 Tests: Skip RunCMake.XcodeProject device cases for Xcode "new build system"
The Xcode "new build system" selects different architectures for device
builds than the old build system does.  Skip those tests on Xcode 12+
pending further investigation.

Issue: #21206
2020-09-18 13:46:39 -04:00
Brad King
542884e527 Tests: Update RunCMake.XcodeProject cases for Xcode "new build system" 2020-09-18 13:02:20 -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
d1688ff300 Tests: Tell Xcode to disallow signing altogether in relevant cases
The Xcode 'new build system' rejects empty signing identities unless
signing is explicitly marked as not allowed.  Update test cases where we
turn off signing to explicitly disallow it too.

Also turn off signing in the XCTest test.
2020-09-01 10:38:22 -04:00
Gusts Kaksis
525464ed2a Xcode: Use "Link Binary With Libraries" build phase in some cases
OBJECT and STATIC libraries (framework or non-framework) do not use
this build phase. Not all items to be linked use this build phase either.

Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2020-09-01 07:38:48 +10:00
Brad King
386bec2d9d Merge topic 'xcode12-link-matching-zlib'
862dbe1367 Xcode: Link matching zlib for iOS Simulator SDK

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5125
2020-08-17 14:52:51 -04:00
Brad King
3313bf06eb Merge topic 'ios-combined-prune-archs'
5852b8867f CMakeIOSInstallCombined: Enforce disjoint architecture sets
79098d23eb Tests: Avoid warnings about unused arguments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5111
2020-08-17 14:52:08 -04:00
Gregor Jasny
862dbe1367 Xcode: Link matching zlib for iOS Simulator SDK
The XcodeRemoveExcessiveISystem test runs
`find_package(ZLIB)` which returns an SDK-relative
path to `zlib.tlb`. When the test switches the SDK
for building to something different than the SDK used
for configuration the linker rightfully complains about
the mismatch.

The fix is to configure and build with the same SDK.
2020-08-13 18:05:34 +02:00
Gregor Jasny
79098d23eb Tests: Avoid warnings about unused arguments 2020-08-08 14:32:48 +02:00
Brad King
4391913133 Add INTERFACE libraries to generated buildsystem if they have SOURCES
INTERFACE libraries were created with the intention of collecting usage
requirements for use by other targets via `target_link_libraries`.
Therefore they were not allowed to have SOURCES and were not included in
the generated buildsystem.  In practice, this has become limiting:

* Header-only libraries do have sources, they just do not compile.
  Developers should be able to edit those sources (the header files)
  in their IDE.

* Header-only libraries may need to generate some of their header
  files via custom commands.

Some projects work around these limitations by pairing each interface
library with an `add_custom_target` that makes the header files and
custom commands appear in the generated buildsystem and in IDEs.

Lift such limitations by allowing INTERFACE libraries to have SOURCES.
For those with sources, add a corresponding build target to the
generated buildsystem.

Fixes: #19145
2020-08-07 08:46:32 -04:00
Brad King
9b99b4bfc8 Tests/RunCMake: Update cmake_minimum_required versions
Use 3.3 or 2.8.12 where possible.
2020-06-18 09:52:05 -04:00
Yauheni Khnykin
5c2a92f44f Swift: Exclude SDK include paths
Populate `CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES` with the macOS SDK's
include directory so that we filter such implicit directories out of
Swift targets.

Fixes: #19845
2020-02-10 10:32:37 -05:00
Yauheni Khnykin
64304fe72b Xcode: Fix post build script for 'top level project only' opt
When CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY is set on
Xcode generator created post build scripts which tried to call
XCODE_DEPEND_HELPER.make script in subproject.
But XCODE_DEPEND_HELPER.make don't exist in
subprojects when mentioned option is set on.

Fixes: #20262
2020-01-27 16:14:19 -05:00
Cristian Adam
a55df20499 Multi-Ninja: Add precompile headers support
Fixes: #19789
2020-01-17 23:17:35 +01:00
Gregor Jasny
92c4c852db Xcode: Add custom working directory property
Closes: #19967
2019-11-18 22:34:34 +01:00
Cristian Adam
bb42e1ed43 ObjC: Add OBJC/OBJCXX flags to Xcode projects
Fixes: #19936
2019-11-11 17:43:17 +01:00
Brad King
0ce8a5c08d Xcode: Fix generated references to CMakeLists.txt files
Refactoring in commit 2d888e3390 (cmSourceFile: Rename mutating
GetFullPath() overload, 2019-08-29, v3.16.0-rc1~160^2) accidentally left
the paths to `CMakeLists.txt` files empty in generated Xcode project
files.

Fixes: #19927
2019-11-05 14:29:41 -05:00
Brad King
7cccc5b199 Xcode: Restore CMAKE_XCODE_GENERATE_SCHEME for custom targets
The target property introduced by commit 413b71485a (Xcode: Create Xcode
schemes per target, 2019-03-11, v3.15.0-rc1~347^2) was accidentally not
initialized by `CMAKE_XCODE_GENERATE_SCHEME` for custom targets.  Fix it
and update the test.

Fixes: #19759
2019-10-02 08:21:02 -04:00
Brad King
fa36e2151d Merge topic 'precompile-headers'
8da78d4efe Precompile headers: Update documentation
5772930164 Precompile headers: Add unit tests
519606704e Precompile headers: Add support for Visual Studio generators
28be170fbc Precompile headers: Add support for Xcode generator
b8626261e9 Precompile headers: Add methods to generate PCH sources
375d01c680 PCH: add example/test
9b6797e71d PCH: add target_precompile_headers command
0467a2f91b PCH: add PRECOMPILE_HEADERS to special properties

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Acked-by: Ivan171 <heavenandhell171@gmail.com>
Acked-by: Stanislav Ershov <digital.stream.of.mind@gmail.com>
Acked-by: Steve Mokris <smokris@softpixel.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
Acked-by: Danila Malyutin <flashmozzg@gmail.com>
Acked-by: Viktor Kirilov <vik.kirilov@gmail.com>
Acked-by: Lucas Zhao <zhaopf6@163.com>
Merge-request: !3553
2019-08-29 09:38:21 -04:00
Cristian Adam
5772930164 Precompile headers: Add unit tests 2019-08-28 11:47:51 -04:00
Gregor Jasny
3186bb91ed Xcode: Make iOS tests compatible with Xcode 11 2019-08-26 21:08:00 +02:00
Brad King
bae7a2e250 Merge topic 'error-generate-step'
8cc04b1918 cmake: Display error if generate step fails

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !3304
2019-05-14 10:57:44 -04:00
Brad King
7d9db24f4c Merge topic 'ios-xctest-lookup'
e9d128b789 Apple: Properly lookup XCTest for iOS and tvOS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3309
2019-05-14 10:48:13 -04:00
Kyle Edwards
8cc04b1918 cmake: Display error if generate step fails 2019-05-13 10:31:39 -04:00
Gregor Jasny
e9d128b789 Apple: Properly lookup XCTest for iOS and tvOS
Closes: #19172
2019-05-11 12:12:32 +02:00
Harry Mallon
413b71485a Xcode: Create Xcode schemes per target 2019-03-21 16:50:41 +00:00
Ruslan Baratov
e427c7c1d8 iOS: Add IOS variable
Since commit 11da882a12 (Apple: Introduce separate system name for iOS,
tvOS, and watchOS, 2018-01-15, v3.14.0-rc1~14^2~1) we support setting
`CMAKE_SYSTEM_NAME` to `iOS`.  Existing iOS toolchain files already
set `IOS` as a short-hand variable, so do the same here.
2019-03-05 09:42:41 -05:00
Gregor Jasny
11da882a12 Apple: Introduce separate system name for iOS, tvOS, and watchOS
- Remove code signing requirements for non-macOS
- Do not set deployment target for non-macOS
- Build static library for compiler feature detection for non-macOS
- Use framework to run CompilerId tests for watchOS
- Port tests to new SDK handling
- Add new Apple cross-compiling section to toolchain documentation

Closes: #17870
2019-02-04 09:03:35 -05:00
Brad King
36cf44a7a3 Tests: Isolate RunCMake.XcodeProject per-device cases from host arch
Run all host cases before per-device cases.  Do not expose the host
`CMAKE_OSX_ARCHITECTURES` environment value to the per-device tests.
2019-02-04 09:02:47 -05:00
Gregor Jasny
6b7f1e1db0 Xcode: Add variables and properties to configure schemes
Add `XCODE_SCHEME_*` target properties and associated variables
`CMAKE_XCODE_SCHEME_*` to initialize them on target creation.
Map each target property value to an associated Xcode scheme entry.

Co-Author: Martin Sander <mail@martin-sander.de>
Fixes: #17919
2018-08-01 09:12:42 -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
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
Gregor Jasny
481420ee89 Xcode: Generate ZERO_CHECK generator target only once
In case CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY has been enabled
generate only the root-level ZERO_CHECK target so targets in
subdirectories pick up the root generator target of ZERO_CHECK.

For the case that CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY is not
enabled more investigation and a proper and final fix is still needed.

Issue: 14297
2018-02-22 21:15:48 +01:00
Marc Chevrier
0448311179 sourceFile properties: add property INCLUDE_DIRECTORIES 2018-01-24 15:10:10 +01:00
Gregor Jasny
4017bf40de Darwin: Emit deployment target that matches the SDK
Closes: #17431
2017-12-22 21:56:53 +01:00
Marc Chevrier
9432f686e6 Add generator expression support to per-source COMPILE_DEFINITIONS
This allows users to specify different genex-based compile definitions for each file in a target.

Fixes: #17508
2017-12-05 14:47:39 +01:00