-
Notifications
You must be signed in to change notification settings - Fork 593
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
Add support for multi platform xcframeworks #2691
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0258298
Add support for multi arch xcframeworks
externl 489f77a
Merge branch 'main' into xcframework-multi-arch
externl 3d3dfce
Move iAP into Ice
externl 752c812
Merge remote-tracking branch 'origin/main' into xcframework-multi-arch
externl 1adc347
Fixes
externl 71e58b3
Merge remote-tracking branch 'origin/main' into xcframework-multi-arch
externl 37eace1
Disable xcodesdk ci
externl f4a6d85
Rename files
externl 9e71245
Clang format
externl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,48 @@ | ||
# Copyright (c) ZeroC, Inc. All rights reserved. | ||
|
||
# Gets the library path for a platform (macosx does not have a platform directory) | ||
# $(call xcframework-library,Ice,macosx) => lib/Ice/libIce.a | ||
# $(call xcframework-library,Ice,iphoneos) => lib/iphoneos/libIce.a | ||
xcframework-library = lib/$(if $(filter macosx,$2),,$2/)lib$1.a | ||
|
||
# Gets a list of library paths for a component for all platforms | ||
xcframework-libraries = $(foreach p,$($1_platforms),$(call xcframework-library,$1,$p)) | ||
|
||
# Gets a list of component flags used when generating an xcframework. One set of flags per platform. | ||
xcframework-flags = $(foreach p,$($1_platforms),-library $(call xcframework-library,$1,$p) $(if $2,-headers include/$1)) | ||
|
||
# Creates a xcframework from a static component and its headers | ||
# $1: The name of the framework (Ice, IceDiscovery, etc.) | ||
# $2: The platform | ||
# $3: Output path | ||
define create-xcframework-from-library | ||
# Note: Th headers are coppied into the root of the Headers directory. We move the headers into Header/$1 so that we can | ||
# include Ice as <Ice/Ice.h>. We also copy the generated headers into the Headers/$1 directory. | ||
# | ||
# $(call create-xcframework,$1=framework-name) | ||
define create-xcframework | ||
|
||
lib/$1.xcframework: lib/lib$1.a | ||
$(E) Creating lib/$1.xcframework | ||
lib/$1.xcframework: $(call xcframework-libraries,$1) | ||
$(E) Creating lib/$1.xcframework from $(call xcframework-libraries,$1) | ||
$(Q)$(RM) -r lib/$1.xcframework | ||
$(Q)if [ -d include/$1 ]; then \ | ||
xcodebuild -create-xcframework -library lib/lib$1.a -headers include/$1 -output lib/$1.xcframework ; \ | ||
mkdir -p lib/$1.xcframework/macos-arm64/Headers/$1 ; \ | ||
find lib/$1.xcframework/macos-arm64/Headers/* -prune ! -name $1 -exec mv {} lib/$1.xcframework/macos-arm64/Headers/$1 \; ; \ | ||
cp include/generated/$1/*.h lib/$1.xcframework/macos-arm64/Headers/$1 ; \ | ||
xcodebuild -create-xcframework $(call xcframework-flags,$1,true) -output lib/$1.xcframework ; \ | ||
find lib/$1.xcframework -name Headers -prune -exec mv {} {}_$1 \; -exec mkdir {} \; -exec mv {}_$1 {}/$1 \; ; \ | ||
if [ -d include/generated/$1 ]; then \ | ||
find lib/$1.xcframework -name Headers -prune -exec cp -r include/generated/$1/* {}/$1 \; ; \ | ||
fi \ | ||
else \ | ||
xcodebuild -create-xcframework -library lib/lib$1.a -output lib/$1.xcframework; \ | ||
xcodebuild -create-xcframework $(call xcframework-flags,$1) -output lib/$1.xcframework; \ | ||
fi | ||
|
||
srcs all:: lib/$1.xcframework | ||
|
||
clean:: | ||
$(E) Cleaning lib/$1.xcframework | ||
$(Q)$(RM) -r lib/$1.xcframework | ||
|
||
endef | ||
|
||
ifeq ($(filter $(CONFIGS),static),) | ||
Ice_always_enable_configs := static | ||
IceDiscovery_always_enable_configs := static | ||
IceLocatorDiscovery_always_enable_configs := static | ||
ifeq ($(filter $(config),static),) | ||
$(foreach f, $(xcframeworks), $(eval $f_always_enable_configs := static)) | ||
endif | ||
|
||
$(eval $(call create-xcframework-from-library,Ice)) | ||
$(eval $(call create-xcframework-from-library,IceDiscovery)) | ||
$(eval $(call create-xcframework-from-library,IceLocatorDiscovery)) | ||
define make-xcframeworks | ||
$(foreach f, $(xcframeworks),\ | ||
$(if $($f_platforms),$(eval $(call create-xcframework,$f)))) | ||
endef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be cleaner to add an iAP prefix to all iAP source files and then move them to the ios folder. It's odd to have src/Ice/ios and src/Ice/iAP that are both ios-only.