Skip to content

build: use add_subdirectory instead of add_external_project #2004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2019

Conversation

compnerd
Copy link
Member

This switches the CoreFoundation sub-build to use add_subdirectory.
This has a few MAJOR benefits:

  • CoreFoundation changes get tracked and cause compile/link triggers
  • CoreFoundation warnings are surfaced in the build
  • CoreFoundation dependencies are reflected in the right location
  • Foundation dependencies are reflected in the right location
  • The overall build is simpler

Eventually, it should be possible to further simplify this.

Unfortunately, a couple of hacks are needed to make this work. The
sub-projects properties must be cached, but they were just passthrough
previously, so this is not too terrible. Additionally, the library
control know needs to be saved/restored around it. The worst thing here
is the need to manually collect the dependency as we do not have a
proper library target for the Foundation (Swift) library. When CMake
gains proper Swift support, it should be possible to use add_library
and get a property target that we can use target_link_libraries with
permitting the dependency tracking to allow us to get that without
manual intervention.

This switches the CoreFoundation sub-build to use `add_subdirectory`.
This has a few **MAJOR** benefits:
- CoreFoundation changes get tracked and cause compile/link triggers
- CoreFoundation warnings are surfaced in the build
- CoreFoundation dependencies are reflected in the right location
- Foundation dependencies are reflected in the right location
- The overall build is simpler

Eventually, it should be possible to further simplify this.

Unfortunately, a couple of hacks are needed to make this work.  The
sub-projects properties must be cached, but they were just passthrough
previously, so this is not too terrible.  Additionally, the library
control know needs to be saved/restored around it.  The worst thing here
is the need to manually collect the dependency as we do not have a
proper library target for the Foundation (Swift) library.  When CMake
gains proper Swift support, it should be possible to use `add_library`
and get a property target that we can use `target_link_libraries` with
permitting the dependency tracking to allow us to get that without
manual intervention.
@compnerd
Copy link
Member Author

CC: @millenomi @gwynne

@compnerd
Copy link
Member Author

@swift-ci please test

1 similar comment
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

Please test with following PRs:
swiftlang/swift-corelibs-xctest#261

@swift-ci please test

@compnerd
Copy link
Member Author

Please test with following PRs:
swiftlang/swift-corelibs-xctest#261
swiftlang/swift-llbuild#460

@swift-ci please test

@compnerd
Copy link
Member Author

@compnerd
Copy link
Member Author

compnerd commented Apr 3, 2019

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Apr 3, 2019

@compnerd
Copy link
Member Author

compnerd commented Apr 3, 2019

Please test with following PRs:
swiftlang/swift#23775
swiftlang/swift-package-manager#2054

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Apr 8, 2019

Please test with following PRs:

swiftlang/swift#23869
swiftlang/swift-package-manager#2054

@swift-ci please test

@compnerd compnerd merged commit 89de36e into swiftlang:master Apr 9, 2019
@compnerd compnerd deleted the im-claiming-you-as-a-dependent branch April 9, 2019 01:30
@adrian-prantl
Copy link

I think this may have broken the LLDB tests. They can't locate Foundation swift module any more. I think we may need to update swift/utils/build-script-impl ?

DOTEST_EXTRA="-Xcc -F${FOUNDATION_BUILD_DIR}/CoreFoundation-prefix/System/Library/Frameworks"

@compnerd
Copy link
Member Author

compnerd commented Apr 9, 2019

@adrian-prantl pointed me to https://ci.swift.org/view/LLDB/job/oss-lldb-swift-5.1-incremental-linux-ubuntu-18_04/378/consoleFull#-3714861073122a513-f36a-4c87-8ed7-cbc36a1ec144 which is a 5.1 build. Seems that we need to cross-port the migration path to 5.1. swiftlang/swift#23906 should take care of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants