@@ -542,6 +542,9 @@ def __init__(self, name: str, ints: tuple[int, ...]):
542
542
def __repr__ (self ) -> str :
543
543
return f"<{ self .name } ({ '.' .join (str (v ) for v in self .ints )} )>"
544
544
545
+ ANDROID_ABI_EXTRA_LINK_OPTIONS = {
546
+ "arm64-v8a" : "-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" ,
547
+ }
545
548
546
549
class Releaser :
547
550
def __init__ (self , release_info : dict , commit : str , revision : str , root : Path , dist_path : Path , section_printer : SectionPrinter , executer : Executer , cmake_generator : str , deps_path : Path , overwrite : bool , github : bool , fast : bool ):
@@ -1013,6 +1016,7 @@ def create_android_archives(self, android_api: int, android_home: Path, android_
1013
1016
android_devel_file_tree = ArchiveFileTree ()
1014
1017
1015
1018
for android_abi in android_abis :
1019
+ extra_link_options = ANDROID_ABI_EXTRA_LINK_OPTIONS .get (android_abi , "" )
1016
1020
with self .section_printer .group (f"Building for Android { android_api } { android_abi } " ):
1017
1021
build_dir = self .root / "build-android" / f"{ android_abi } -build"
1018
1022
install_dir = self .root / "install-android" / f"{ android_abi } -install"
@@ -1023,8 +1027,11 @@ def create_android_archives(self, android_api: int, android_home: Path, android_
1023
1027
"cmake" ,
1024
1028
"-S" , str (self .root ),
1025
1029
"-B" , str (build_dir ),
1026
- f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={ self .root } =/src/{ self .project } "''' ,
1027
- f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={ self .root } =/src/{ self .project } "''' ,
1030
+ # NDK 21e does not support -ffile-prefix-map
1031
+ # f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
1032
+ # f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
1033
+ f"-DCMAKE_EXE_LINKER_FLAGS={ extra_link_options } " ,
1034
+ f"-DCMAKE_SHARED_LINKER_FLAGS={ extra_link_options } " ,
1028
1035
f"-DCMAKE_TOOLCHAIN_FILE={ cmake_toolchain_file } " ,
1029
1036
f"-DCMAKE_PREFIX_PATH={ str (android_deps_path )} " ,
1030
1037
f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH" ,
@@ -1530,7 +1537,7 @@ def main(argv=None) -> int:
1530
1537
parser .error ("Invalid --android-api, and/or could not be detected" )
1531
1538
android_api_path = Path (args .android_home ) / f"platforms/{ args .android_api .name } "
1532
1539
if not android_api_path .is_dir ():
1533
- parser . error (f"Android API directory does not exist ({ android_api_path } )" )
1540
+ logger . warning (f"Android API directory does not exist ({ android_api_path } )" )
1534
1541
with section_printer .group ("Android arguments" ):
1535
1542
print (f"android_home = { args .android_home } " )
1536
1543
print (f"android_ndk_home = { args .android_ndk_home } " )
0 commit comments