Generate Makefile from prepare.py when building with CMake.

This commit is contained in:
Ghislain MARY 2015-05-25 17:30:46 +02:00
parent 4c5a6458f9
commit 31e61e19cf
2 changed files with 52 additions and 1 deletions

View file

@ -55,6 +55,7 @@ def main(argv = None):
selected_platforms += [args.platform]
retcode = 0
makefile_platforms = []
for platform in selected_platforms:
target = prepare.targets['ios-' + platform]
@ -66,6 +67,56 @@ def main(argv = None):
retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args)
if retcode != 0:
return retcode
makefile_platforms += [platform]
if makefile_platforms:
archs_specific = ""
for arch in makefile_platforms[1:]:
archs_specific += \
""" if test -f "$${arch}_path"; then \\
all_paths=`echo $$all_paths $${arch}_path`; \\
all_archs="$$all_archs,{arch}" ; \\
else \\
echo "WARNING: archive `basename $$archive` exists in {first_arch} tree but does not exists in {arch} tree: $${arch}_path."; \\
fi; \\
""".format(first_arch=makefile_platforms[0], arch=arch)
makefile = """
archs={archs}
.PHONY: all
all: multi-arch
build-%:
make -C WORK/cmake-ios-$*
multi-arch: $(addprefix build-,$(archs))
archives=`find liblinphone-sdk/{first_arch}-apple-darwin.ios -name *.a` && \\
mkdir -p liblinphone-sdk/apple-darwin && \\
cp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/include liblinphone-sdk/apple-darwin/. && \\
cp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/share liblinphone-sdk/apple-darwin/. && \\
for archive in $$archives ; do \\
armv7_path=`echo $$archive | sed -e "s/{first_arch}/armv7/"`; \\
arm64_path=`echo $$archive | sed -e "s/{first_arch}/aarch64/"`; \\
i386_path=`echo $$archive | sed -e "s/{first_arch}/i386/"`; \\
x86_64_path=`echo $$archive | sed -e "s/{first_arch}/x86_64/"`; \\
destpath=`echo $$archive | sed -e "s/-debug//" | sed -e "s/{first_arch}-//" | sed -e "s/\.ios//"`; \\
all_paths=`echo $$archive`; \\
all_archs="{first_arch}"; \\
mkdir -p `dirname $$destpath`; \\
{archs_specific} \\
echo "[$$all_archs] Mixing `basename $$archive` in $$destpath"; \\
lipo -create $$all_paths -output $$destpath; \\
done && \\
if ! test -f liblinphone-sdk/apple-darwin/lib/libtunnel.a ; then \\
cp -f submodules/binaries/libdummy.a liblinphone-sdk/apple-darwin/lib/libtunnel.a ; \\
fi
""".format(archs=' '.join(makefile_platforms), first_arch=makefile_platforms[0], archs_specific=archs_specific)
f = open('Makefile', 'w')
f.write(makefile)
f.close()
elif os.path.isfile('Makefile'):
os.remove('Makefile')
return retcode

@ -1 +1 @@
Subproject commit 135daa1a26407ce7b1e46ce87544b096bb794c83
Subproject commit 3ae778a60f65ac3aca2cc89d13fe0695bfd78cb7