Skip to content

Commit

Permalink
Do not use full path for system libraries and frameworks in `.xcodepr…
Browse files Browse the repository at this point in the history
…oj` (#867)
  • Loading branch information
misl6 authored Sep 23, 2023
1 parent 829de94 commit 952bbec
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
17 changes: 16 additions & 1 deletion .ci/test_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@ set -eo pipefail

toolchain create Touchtracer kivy-ci-clone/examples/demo/touchtracer

# If runner arch is arm64, then the simulator arch is arm64,
# otherwise it's x86_64
if [ $(arch) == "arm64" ]; then
SIM_ARCH="arm64"
else
SIM_ARCH="x86_64"
fi

# Build for iOS
xcodebuild -project touchtracer-ios/touchtracer.xcodeproj \
-scheme touchtracer \
-destination generic/platform=iOS\
clean build CODE_SIGNING_ALLOWED=NO | xcpretty
clean build CODE_SIGNING_ALLOWED=NO | xcpretty

# Build for iOS Simulator
xcodebuild -project touchtracer-ios/touchtracer.xcodeproj \
-scheme touchtracer \
-destination 'generic/platform=iOS Simulator' \
clean build CODE_SIGNING_ALLOWED=NO ARCHS=$SIM_ARCH | xcpretty
3 changes: 2 additions & 1 deletion kivy_ios/recipes/zbarlight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class ZbarLightRecipe(Recipe):
url = "https://github.com/Polyconseil/zbarlight/archive/{version}.tar.gz"
library = "zbarlight.a"
depends = ["hostpython3", "python3", "libzbar"]
pbx_libraries = ["libz", "libbz2", "libc++", "libsqlite3", "CoreMotion"]
pbx_libraries = ["libz", "libbz2", "libc++", "libsqlite3"]
pbx_frameworks = ["CoreMotion"]
include_per_platform = True

def get_zbar_env(self, plat):
Expand Down
18 changes: 8 additions & 10 deletions kivy_ios/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,6 @@ def update_pbxproj(filename, pbx_frameworks=None):
logger.info("Analysis of {}".format(filename))

project = XcodeProject.load(filename)
sysroot = sh.xcrun("--sdk", "iphonesimulator", "--show-sdk-path").strip()

group = project.get_or_create_group("Frameworks")
g_classes = project.get_or_create_group("Classes")
Expand All @@ -1343,8 +1342,9 @@ def update_pbxproj(filename, pbx_frameworks=None):
f_path = join(ctx.dist_dir, "frameworks", framework_name)
else:
logger.info("Ensure {} is in the project (pbx_frameworks, system)".format(framework))
f_path = join(sysroot, "System", "Library", "Frameworks",
"{}.framework".format(framework))
# We do not need to specify the full path to the framework, as
# Xcode will search for it in the SDKs.
f_path = framework_name
project.add_file(
f_path,
parent=group,
Expand All @@ -1356,13 +1356,11 @@ def update_pbxproj(filename, pbx_frameworks=None):
),
)
for library in pbx_libraries:
logger.info("Ensure {} is in the project (pbx_libraries, dylib+tbd)".format(library))
f_path = join(sysroot, "usr", "lib",
"{}.dylib".format(library))
project.add_file(f_path, parent=group, tree="DEVELOPER_DIR", force=False)
f_path = join(sysroot, "usr", "lib",
"{}.tbd".format(library))
project.add_file(f_path, parent=group, tree="DEVELOPER_DIR", force=False)
library_name = f"{library}.tbd"
logger.info("Ensure {} is in the project (pbx_libraries, tbd)".format(library))
# We do not need to specify the full path to the library, as
# Xcode will search for it in the SDKs.
project.add_file(library_name, parent=group, tree="DEVELOPER_DIR", force=False)
for xcframework in xcframeworks:
logger.info("Ensure {} is in the project (xcframework)".format(xcframework))
project.add_file(
Expand Down

0 comments on commit 952bbec

Please sign in to comment.