From 31e61e19cf1f49e3ca4ec9f674927f9ce72e8c61 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 25 May 2015 17:30:46 +0200 Subject: [PATCH] Generate Makefile from prepare.py when building with CMake. --- prepare.py | 51 ++++++++++++++++++++++++++++++++++++++++ submodules/cmake-builder | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/prepare.py b/prepare.py index 6c3601bac..47951104b 100755 --- a/prepare.py +++ b/prepare.py @@ -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 diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 135daa1a2..3ae778a60 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 135daa1a26407ce7b1e46ce87544b096bb794c83 +Subproject commit 3ae778a60f65ac3aca2cc89d13fe0695bfd78cb7