11'''
2- known to build with cmake version 3.19 .2 and NDK r19c .
2+ known to build with cmake version 3.23 .2 and NDK r21e .
33See https://gitlab.kitware.com/cmake/cmake/-/issues/18739
44'''
55
1515arch_to_sysroot = {'armeabi' : 'arm' , 'armeabi-v7a' : 'arm' , 'arm64-v8a' : 'arm64' }
1616
1717
18+ def arch_to_toolchain (arch ):
19+ if 'arm' in arch .arch :
20+ return arch .command_prefix
21+ return arch .arch
22+
23+
1824class LapackRecipe (Recipe ):
1925
2026 name = 'lapack'
21- version = 'v3.9.0 '
27+ version = 'v3.10.1 '
2228 url = 'https://github.com/Reference-LAPACK/lapack/archive/{version}.tar.gz'
2329 libdir = 'build/install/lib'
2430 built_libraries = {'libblas.so' : libdir , 'liblapack.so' : libdir , 'libcblas.so' : libdir }
@@ -28,14 +34,14 @@ def get_recipe_env(self, arch):
2834
2935 ndk_dir = environ .get ("LEGACY_NDK" )
3036 if ndk_dir is None :
31- raise BuildInterruptingException ("Please set the environment variable 'LEGACY_NDK' to point to a NDK location with gcc/gfortran support (last tested NDK version was 'r19c ')" )
37+ raise BuildInterruptingException ("Please set the environment variable 'LEGACY_NDK' to point to a NDK location with gcc/gfortran support (supported NDK version: 'r21e ')" )
3238
3339 GCC_VER = '4.9'
3440 HOST = build_platform
3541
3642 sysroot_suffix = arch_to_sysroot .get (arch .arch , arch .arch )
3743 sysroot = f"{ ndk_dir } /platforms/{ env ['NDK_API' ]} /arch-{ sysroot_suffix } "
38- FC = f"{ ndk_dir } /toolchains/{ arch . command_prefix } -{ GCC_VER } /prebuilt/{ HOST } /bin/{ arch .command_prefix } -gfortran"
44+ FC = f"{ ndk_dir } /toolchains/{ arch_to_toolchain ( arch ) } -{ GCC_VER } /prebuilt/{ HOST } /bin/{ arch .command_prefix } -gfortran"
3945 env ['FC' ] = f'{ FC } --sysroot={ sysroot } '
4046 if sh .which (FC ) is None :
4147 raise BuildInterruptingException (f"{ FC } not found. See https://github.com/mzakharo/android-gfortran" )
@@ -51,19 +57,20 @@ def build_arch(self, arch):
5157 env = self .get_recipe_env (arch )
5258 ndk_dir = environ ["LEGACY_NDK" ]
5359 shprint (sh .rm , '-rf' , 'CMakeFiles/' , 'CMakeCache.txt' , _env = env )
54- shprint ( sh . cmake , source_dir ,
60+ opts = [
5561 '-DCMAKE_SYSTEM_NAME=Android' ,
5662 '-DCMAKE_POSITION_INDEPENDENT_CODE=1' ,
5763 '-DCMAKE_ANDROID_ARCH_ABI={arch}' .format (arch = arch .arch ),
5864 '-DCMAKE_ANDROID_NDK=' + ndk_dir ,
65+ '-DCMAKE_ANDROID_API={api}' .format (api = self .ctx .ndk_api ),
5966 '-DCMAKE_BUILD_TYPE=Release' ,
6067 '-DCMAKE_INSTALL_PREFIX={}' .format (install_target ),
61- '-DANDROID_ABI={arch}' .format (arch = arch .arch ),
62- '-DANDROID_ARM_NEON=ON' ,
63- '-DENABLE_NEON=ON' ,
6468 '-DCBLAS=ON' ,
6569 '-DBUILD_SHARED_LIBS=ON' ,
66- _env = env )
70+ ]
71+ if arch .arch == 'armeabi-v7a' :
72+ opts .append ('-DCMAKE_ANDROID_ARM_NEON=ON' )
73+ shprint (sh .cmake , source_dir , * opts , _env = env )
6774 shprint (sh .make , '-j' + str (cpu_count ()), _env = env )
6875 shprint (sh .make , 'install' , _env = env )
6976
0 commit comments