Post not yet marked as solved
I don't think you can write there.
The Kivy App class has a method named get_application_config() (check the documentation) that gives you a writable directory, with the "appdir" keyword on iOS:
app.get_application_config('%(appdir)s')
Post not yet marked as solved
The important Clang compiler flags for cross-compiling are: --target; --sysroot; and -isysroot.
For CMake specifically, the relevant variables for cross-compiling are: CMAKE_C_COMPILER_TARGET; CMAKE_CXX_COMPILER_TARGET; CMAKE_SYSTEM_PROCESSOR; and CMAKE_SYSTEM_NAME.
For example, to build for x86_64 on an M1 Mac (arm64):
export TARGET="x86_64-apple-darwin"
export CFLAGS="$CFLAGS --target=$TARGET"
export CXXFLAGS="$CXXFLAGS --target=$TARGET"
export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
cd mycode
mkdir build
cd build
cmake -DCMAKE_C_COMPILER_TARGET="$TARGET" -DCMAKE_CXX_COMPILER_TARGET="$TARGET" -DCMAKE_SYSTEM_PROCESSOR="x86_64" -DCMAKE_SYSTEM_NAME="Darwin" -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" ..
Note if you set the SDKROOT environment variable, it is not necessary to add "--sysroot $SDKROOT" and "-isysroot $SDKROOT" to CFLAGS and CXXFLAGS.
Do that for each (x86_64 and arm64) then use lipo to make universal binaries.
Edit: Oh and, with CMake, never set the "--target" flag in LDFLAGS, only in CFLAGS/CXXFLAGS, it won't like that.
Post not yet marked as solved
The AppKit module is part of pyobjc.
Create a virtual environment and install pyobjc:
/usr/bin/python3 -m venv ~/myproject
cd ~/myproject
source bin/activate
pip install pyobjc
If the directory already exists, mkdir will fail. Use os.makedirs instead of os.system('mkdir ...'):
if not os.path.exists(dir):
os.makedirs(dir)
Post not yet marked as solved
What entitlements are you using? Pyinstaller requires com.apple.security.cs.allow-unsigned-executable-memory.
Save this to the file entitlements.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key><true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
</dict>
</plist>
Pass this file to pyinstaller with the --osx-entitlements-file entitlements.plist option.
Pass the same file to the codesign utility with the --entitlements entitlements.plist option.