Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akshayaurora/34711aee4890345319bfab2b88ad69b2 to your computer and use it in GitHub Desktop.
Save akshayaurora/34711aee4890345319bfab2b88ad69b2 to your computer and use it in GitHub Desktop.
Sample recipe on iOS using CMAKE
from kivy_ios.toolchain import Recipe, shprint
from os.path import join
import sys
import sh
class LFKBenchmarkRecipe(Recipe):
version = "main"
url = f'<your url here {version}.tar.gz>'
libraries = "lfk_benchmark/liblfk-benchmark.a", "lfk_benchmark/core/liblfk-core-nonoptimized.a", "lfk_benchmark/core/liblfk-core-optimized.a"
archs = ["arm64", "x86_64"]
include_per_arch = True
def get_build_env(self, arch):
build_env = arch.get_env()
build_env["CFLAGS"] += " -isysroot{}".format(arch.sysroot)
build_env["CFLAGS"] += f" -DCMAKE_OSX_SYSROOT={arch.sysroot}"
build_env["CFLAGS"] += " -DCMAKE_TOOLCHAIN_FILE=cmake/iOS.cmake"
#build_env["CFLAGS"] += " -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0"
build_env["CFLAGS"] += " -DCPU_BASELINE=NATIVE"
build_env["CFLAGS"] += " -DCMAKE_OSX_ARCHITECTURES={arch.arch}"
return build_env
def build_arch(self, arch):
build_env = self.get_build_env(arch)
sys.path.append(build_env["CC"])
shprint(
sh.cmake, '-S', '.', '-B', self.build_dir,
'-DBUILD_SHARED_LIBS=OFF',
"-DCMAKE_TOOLCHAIN_FILE=cmake/iOS.cmake",
f'-DCMAKE_OSX_SYSROOT={arch.sysroot}',
f'-DCMAKE_OSX_ARCHITECTURES={arch.arch}',
'-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0',
_env=build_env)
shprint(sh.cmake, '--build', self.build_dir, _env=build_env)
recipe = LFKBenchmarkRecipe()
@akshayaurora
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment