Created
May 12, 2022 19:40
-
-
Save akshayaurora/34711aee4890345319bfab2b88ad69b2 to your computer and use it in GitHub Desktop.
Sample recipe on iOS using CMAKE
This file contains hidden or 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
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() |
Author
akshayaurora
commented
May 12, 2022
- Make sure to have cmake/iOS.cmake file from apple https://opensource.apple.com/source/clang/clang-800.0.38/src/cmake/platforms/iOS.cmake.auto.html
- Many Redundant flags, will update soon with that fixed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment