-
Notifications
You must be signed in to change notification settings - Fork 52
Developer Notes
If you need to change the list of libraries that mkxp-z links with on macOS, and you don't have a macOS system available to run Xcode on, you can use pbxproj on Linux or Windows to make the edits. As an example, the following Bash script is what I used to add libjxl:
#!/usr/bin/env bash
set -euo pipefail
# Show the existing libs
for TARGET in Z-intel Z-universal Z-steam Z-steam-universal
do
pbxproj show --target "${TARGET}" ./ -f
done
echo ""
echo "*** Adding files now..."
echo ""
# Add the new libs
for LIBRARY in libjxl_dec.a libbrotlidec-static.a libbrotlicommon-static.a libhwy.a
do
pbxproj file --target Z-intel --target Z-steam ./ "Dependencies/build-macosx-x86_64/lib/${LIBRARY}" --weak --tree "<group>" --parent Intel
pbxproj file --target Z-universal --target Z-steam-universal ./ "Dependencies/build-macosx-universal/lib/${LIBRARY}" --weak --tree "<group>" --parent Universal
done
echo ""
echo "*** Done adding files."
echo ""
# Show the result
for TARGET in Z-intel Z-universal Z-steam Z-steam-universal
do
pbxproj show --target "${TARGET}" ./ -f
done
Similar to the above, this is the script I used to add the bicubic
shader to macOS from Linux or Windows:
#!/usr/bin/env python3
from pbxproj import XcodeProject
from pbxproj.pbxextensions import FileOptions
project = XcodeProject.load('./project.pbxproj')
project._FILE_TYPES['.frag'] = ('sourcecode.glsl', 'PBXCopyFilesBuildPhase')
group = project.get_or_create_group('Shaders')
options = FileOptions(create_build_files=True, weak=False, embed_framework=False, code_sign_on_copy=True)
project.add_file('../shader/bicubic.frag', target_name='Assets', force=False, tree='<group>', parent=group, file_options=options)
project.save()
On Linux-based OS's, when testing performance improvements that might be affected by I/O caching, you can run the following command prior to running mkxp-z: echo 3 | sudo tee /proc/sys/vm/drop_caches
. As the name implies, this will instruct Linux to drop the disk cache, so that you can test your optimizations without interference from whatever caching might have happened during the previous run. Thanks to Linux ate my RAM! for the tip.