def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Flexisip and its dependencies.") argparser.add_argument( '-c', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-C', '--veryclean', help="Clean a previous build instead of preparing a build (also deleting the install prefix).", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G', '--generator', help="CMake build system generator (default: Unix Makefiles, use cmake -h to get the complete list).", default='Unix Makefiles', dest='generator') argparser.add_argument( '-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.generator] #additional_args += ["-DLINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS=YES"] if check_tools() != 0: return 1 target = None target = FlexisipTarget() if args.clean or args.veryclean: if args.veryclean: target.veryclean() else: target.clean() if os.path.isfile('Makefile'): os.remove('Makefile') else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode # only generated makefile if we are using Ninja or Makefile if args.generator.endswith('Ninja'): if not check_is_installed("ninja", "it"): return 1 generate_makefile('ninja -C') info("You can now run 'make' to build.") elif args.generator.endswith("Unix Makefiles"): generate_makefile('$(MAKE) -C') info("You can now run 'make' to build.") elif args.generator == "Xcode": info("You can now open Xcode project with: open WORK/cmake/Project.xcodeproj") else: warning("Not generating meta-makefile for generator {}.".format(args.generator)) return 0
def wrangle_pick_data(): """ This function takes acquired mall data, completes the prep and splits the data into train, validate, and test datasets """ # get data df = acquire.run() # prep and split data train, test, validate = prepare.run(df) # scale and define target # not completed yet return train, test, validate
def main(argv = None): if argv is None: argv = sys.argv argparser = argparse.ArgumentParser(description="Prepare build of Linphone and its dependencies.") argparser.add_argument('-c', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument('-C', '--veryclean', help="Clean a previous build and its installation directory.", action='store_true') argparser.add_argument('-d', '--debug', help="Prepare a debug build.", action='store_true') argparser.add_argument('-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument('-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument('platform', choices=platforms, help="The platform to build for.") args, additional_args = argparser.parse_known_args() selected_platforms = [] if args.platform == 'all': selected_platforms += ['armv7', 'arm64', 'i386', 'x86_64'] elif args.platform == 'devices': selected_platforms += ['armv7', 'arm64'] elif args.platform == 'simulators': selected_platforms += ['i386', 'x86_64'] else: selected_platforms += [args.platform] retcode = 0 for platform in selected_platforms: target = prepare.targets['ios-' + platform] if args.veryclean: target.veryclean() elif args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: return retcode return retcode
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-ac', '--all-codecs', help="Enable all codecs, including the non-free ones", action='store_true') argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-dv', '--debug-verbose', help="Activate ms_debug logs.", action='store_true') argparser.add_argument( '--disable-gpl-third-parties', help="Disable GPL third parties such as FFMpeg, x264.", action='store_true') argparser.add_argument( '--enable-non-free-codecs', help="Enable non-free codecs such as OpenH264, MPEG4, etc.. Final application must comply with their respective license (see README.md).", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G', '--generator', help="CMake build system generator (default: Unix Makefiles, use cmake -h to get the complete list).", default='Unix Makefiles', dest='generator') argparser.add_argument( '-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument( '-lf', '--list-features', help="List optional features and their default values.", action='store_true', dest='list_features') argparser.add_argument( '-t', '--tunnel', help="Enable Tunnel.", action='store_true') argparser.add_argument('platform', nargs='*', action=PlatformListAction, default=[ 'arm', 'armv7', 'x86'], help="The platform to build for (default is 'arm armv7 x86'). Space separated architectures in list: {0}.".format(', '.join([repr(platform) for platform in platforms]))) args, additional_args2 = argparser.parse_known_args() additional_args = ["-G", args.generator] if check_tools() != 0: return 1 if args.debug_verbose is True: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] if args.enable_non_free_codecs is True: additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] if args.all_codecs is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=YES"] additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] additional_args += ["-DENABLE_AMRNB=YES"] additional_args += ["-DENABLE_AMRWB=YES"] additional_args += ["-DENABLE_BV16=YES"] additional_args += ["-DENABLE_CODEC2=YES"] additional_args += ["-DENABLE_G729=YES"] additional_args += ["-DENABLE_GSM=YES"] additional_args += ["-DENABLE_ILBC=YES"] additional_args += ["-DENABLE_ISAC=YES"] additional_args += ["-DENABLE_OPUS=YES"] additional_args += ["-DENABLE_SILK=YES"] additional_args += ["-DENABLE_SPEEX=YES"] additional_args += ["-DENABLE_FFMPEG=YES"] additional_args += ["-DENABLE_H263=YES"] additional_args += ["-DENABLE_H263P=YES"] additional_args += ["-DENABLE_MPEG4=YES"] additional_args += ["-DENABLE_OPENH264=YES"] additional_args += ["-DENABLE_VPX=YES"] additional_args += ["-DENABLE_X264=YES"] if args.disable_gpl_third_parties is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=NO"] if args.tunnel or os.path.isdir("submodules/tunnel"): if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen("git clone [email protected]:tunnel.git submodules/tunnel".split(" ")) p.wait() if p.returncode != 0: error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html") return 1 warning("Tunnel enabled, disabling GPL third parties.") additional_args += ["-DENABLE_TUNNEL=YES", "-DENABLE_GPL_THIRD_PARTIES=OFF"] # User's options are priority upon all automatic options additional_args += additional_args2 if args.list_features: list_features(args.debug, additional_args) return 0 selected_platforms_dup = [] for platform in args.platform: if platform == 'all': selected_platforms_dup += ['arm', 'armv7', 'x86'] else: selected_platforms_dup += [platform] # unify platforms but keep provided order selected_platforms = [] for x in selected_platforms_dup: if x not in selected_platforms: selected_platforms.append(x) if os.path.isdir('WORK') and not args.clean and not args.force: warning("Working directory WORK already exists. Please remove it (option -C or -c) before re-executing CMake " "to avoid conflicts between executions, or force execution (option -f) if you are aware of consequences.") if os.path.isfile('Makefile'): Popen("make help-prepare-options".split(" ")) return 0 for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: # only generated makefile if we are using Ninja or Makefile if args.generator.endswith('Ninja'): if not check_is_installed("ninja", "it"): return 1 generate_makefile(selected_platforms, 'ninja -C') info("You can now run 'make' to build.") elif args.generator.endswith("Unix Makefiles"): generate_makefile(selected_platforms, '$(MAKE) -C') info("You can now run 'make' to build.") else: warning("Not generating meta-makefile for generator {}.".format(target.generator)) return 0
def main(argv=None): if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument('-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument('platform', nargs='*', action=PlatformListAction, default=[ 'x86_64', 'devices'], help="The platform to build for (default is 'x86_64 devices'). Space separated" " architectures in list: {0}.".format(', '.join([repr(platform) for platform in platforms]))) args, additional_args = argparser.parse_known_args() selected_platforms = [] for platform in args.platform: if platform == 'all': selected_platforms += archs_device + archs_simu elif platform == 'devices': selected_platforms += archs_device elif platform == 'simulators': selected_platforms += archs_simu else: selected_platforms += [platform] selected_platforms = list(set(selected_platforms)) retcode = 0 makefile_platforms = [] for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: if args.debug: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] 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: libs_list = extract_libs_list() packages = os.listdir('WORK/ios-' + makefile_platforms[0] + '/Build') packages.sort() arch_targets = "" for arch in makefile_platforms: arch_targets += """ {arch}: all-{arch} {arch}-build: @for package in $(packages); do \\ $(MAKE) {arch}-build-$$package; \\ done {arch}-clean: @for package in $(packages); do \\ $(MAKE) {arch}-clean-$$package; \\ done {arch}-veryclean: @for package in $(packages); do \\ $(MAKE) {arch}-veryclean-$$package; \\ done {arch}-build-%: rm -f WORK/ios-{arch}/Stamp/EP_$*/EP_$*-update; \\ $(MAKE) -C WORK/ios-{arch}/cmake EP_$* {arch}-clean-%: $(MAKE) -C WORK/ios-{arch}/Build/$* clean; \\ rm -f WORK/ios-{arch}/Stamp/EP_$*/EP_$*-build; \\ rm -f WORK/ios-{arch}/Stamp/EP_$*/EP_$*-install; {arch}-veryclean-%: cat WORK/ios-{arch}/Build/$*/install_manifest.txt | xargs rm; \\ rm -rf WORK/ios-{arch}/Build/$*/*; \\ rm -f WORK/ios-{arch}/Stamp/EP_$*/*; \\ echo "Run 'make {arch}-build-$*' to rebuild $* correctly."; {arch}-veryclean-ffmpeg: $(MAKE) -C WORK/ios-{arch}/Build/ffmpeg uninstall; \\ rm -rf WORK/ios-{arch}/Build/ffmpeg/*; \\ rm -f WORK/ios-{arch}/Stamp/EP_ffmpeg/*; \\ echo "Run 'make {arch}-build-ffmpeg' to rebuild ffmpeg correctly."; {arch}-clean-openh264: cd WORK/ios-{arch}/Build/openh264; \\ $(MAKE) -f ../../../../submodules/externals/openh264/Makefile clean; \\ rm -f WORK/ios-{arch}/Stamp/EP_openh264/EP_openh264-build; \\ rm -f WORK/ios-{arch}/Stamp/EP_openh264/EP_openh264-install; {arch}-veryclean-openh264: rm -rf liblinphone-sdk/{arch}-apple-darwin.ios/include/wels; \\ rm -f liblinphone-sdk/{arch}-apple-darwin.ios/lib/libopenh264.*; \\ rm -rf WORK/ios-{arch}/Build/openh264/*; \\ rm -f WORK/ios-{arch}/Stamp/EP_openh264/*; \\ echo "Run 'make {arch}-build-openh264' to rebuild openh264 correctly."; {arch}-veryclean-vpx: rm -rf liblinphone-sdk/{arch}-apple-darwin.ios/include/vpx; \\ rm -f liblinphone-sdk/{arch}-apple-darwin.ios/lib/libvpx.*; \\ rm -rf WORK/ios-{arch}/Build/vpx/*; \\ rm -f WORK/ios-{arch}/Stamp/EP_vpx/*; \\ echo "Run 'make {arch}-build-vpx' to rebuild vpx correctly."; """.format(arch=arch) multiarch = "" for arch in makefile_platforms[1:]: multiarch += \ """ 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} packages={packages} libs_list={libs_list} LINPHONE_IPHONE_VERSION=$(shell git describe --always) .PHONY: all all: build {arch_targets} all-%: @for package in $(packages); do \\ rm -f WORK/ios-$*/Stamp/EP_$$package/EP_$$package-update; \\ done $(MAKE) -C WORK/ios-$*/cmake build-%: @for arch in $(archs); do \\ echo "==== starting build of $* for arch $$arch ===="; \\ $(MAKE) $$arch-build-$*; \\ done clean-%: @for arch in $(archs); do \\ echo "==== starting clean of $* for arch $$arch ===="; \\ $(MAKE) $$arch-clean-$*; \\ done veryclean-%: @for arch in $(archs); do \\ echo "==== starting veryclean of $* for arch $$arch ===="; \\ $(MAKE) $$arch-veryclean-$*; \\ done; \\ echo "Run 'make build-$*' to rebuild $* correctly." build: libs sdk clean: $(addprefix clean-,$(packages)) veryclean: $(addprefix veryclean-,$(packages)) libs: $(addprefix all-,$(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}/arm64/"`; \\ 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`; \\ {multiarch} \\ echo "[$$all_archs] Mixing `basename $$archive` in $$destpath"; \\ lipo -create $$all_paths -output $$destpath; \\ done && \\ for lib in {libs_list} ; do \\ if [ $${{lib:0:5}} = "libms" ] ; then \\ library_path=liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/$$lib ; \\ else \\ library_path=liblinphone-sdk/apple-darwin/lib/$$lib ; \\ fi ; \\ if ! test -f $$library_path ; then \\ echo "[$$all_archs] Generating dummy $$lib static library." ; \\ cp -f submodules/binaries/libdummy.a $$library_path ; \\ fi \\ done ipa: build xcodebuild -configuration Release \\ && xcrun -sdk iphoneos PackageApplication -v build/Release-iphoneos/linphone.app -o linphone-iphone.ipa sdk: libs echo "Generating SDK zip file for version $(LINPHONE_IPHONE_VERSION)" zip -r liblinphone-iphone-sdk-$(LINPHONE_IPHONE_VERSION).zip \\ liblinphone-sdk/apple-darwin \\ liblinphone-tutorials \\ -x liblinphone-tutorials/hello-world/build\* \\ -x liblinphone-tutorials/hello-world/hello-world.xcodeproj/*.pbxuser \\ -x liblinphone-tutorials/hello-world/hello-world.xcodeproj/*.mode1v3 pull-transifex: tx pull -af push-transifex: && ./Tools/generate_strings_files.sh && tx push -s -t -f --no-interactive zipres: @tar -czf ios_assets.tar.gz Resources iTunesArtwork help: @echo "(please read the README.md file first)" @echo "" @echo "Available architectures: {archs}" @echo "Available packages: {packages}" @echo "" @echo "Available targets:" @echo "" @echo " * all : builds all architectures and creates the liblinphone sdk" @echo " * zipres : creates a tar.gz file with all the resources (images)" @echo "" @echo "=== Advanced usage ===" @echo "" @echo " * build-[package] : builds the package for all architectures" @echo " * clean-[package] : clean the package for all architectures" @echo "" @echo " * [{arch_opts}]-build-[package] : builds a package for the selected architecture" @echo " * [{arch_opts}]-clean-[package] : clean the package for the selected architecture" @echo "" @echo " * sdk : re-add all generated libraries to the SDK. Use this only after a full build." @echo " * libs : after a rebuild of a subpackage, will mix the new libs in liblinphone-sdk/apple-darwin directory" """.format(archs=' '.join(makefile_platforms), arch_opts='|'.join(makefile_platforms), first_arch=makefile_platforms[0], arch_targets=arch_targets, packages=' '.join(packages), libs_list=' '.join(libs_list), multiarch=multiarch) f = open('Makefile', 'w') f.write(makefile) f.close() warning(makefile_platforms) elif os.path.isfile('Makefile'): os.remove('Makefile') return retcode
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser(description="Prepare build of Linphone and its dependencies.") argparser.add_argument( "-c", "-C", "--clean", help="Clean a previous build instead of preparing a build.", action="store_true" ) argparser.add_argument( "-d", "--debug", help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action="store_true", ) argparser.add_argument("-dv", "--debug-verbose", help="Activate ms_debug logs.", action="store_true") argparser.add_argument( "-f", "--force", help="Force preparation, even if working directory already exist.", action="store_true" ) argparser.add_argument( "--disable-gpl-third-parties", help="Disable GPL third parties such as FFMpeg, x264.", action="store_false" ) argparser.add_argument( "--enable-non-free-codecs", help="Enable non-free codecs such as OpenH264, MPEG4, etc.. Final application must comply with their respective license (see README.md).", action="store_true", ) argparser.add_argument( "-G" "--generator", help="CMake build system generator (default: Unix Makefiles).", default="Unix Makefiles", choices=["Unix Makefiles", "Ninja"], dest="generator", ) argparser.add_argument( "-L", "--list-cmake-variables", help="List non-advanced CMake cache variables.", action="store_true", dest="list_cmake_variables", ) argparser.add_argument( "-lf", "--list-features", help="List optional features and their default values.", action="store_true", dest="list_features", ) argparser.add_argument("-t", "--tunnel", help="Enable Tunnel.", action="store_true") argparser.add_argument( "platform", nargs="*", action=PlatformListAction, default=["x86_64", "devices"], help="The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}.".format( ", ".join([repr(platform) for platform in platforms]) ), ) args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.generator] if args.generator == "Ninja": if not check_is_installed("ninja", "it"): return 1 generator = "ninja -C" else: generator = "$(MAKE) -C" if check_tools() != 0: return 1 additional_args += ["-DENABLE_DEBUG_LOGS={}".format("YES" if args.debug_verbose else "NO")] additional_args += ["-DENABLE_NON_FREE_CODECS={}".format("YES" if args.enable_non_free_codecs else "NO")] additional_args += ["-DENABLE_GPL_THIRD_PARTIES={}".format("NO" if args.disable_gpl_third_parties else "YES")] if args.tunnel or os.path.isdir("submodules/tunnel"): if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen("git clone [email protected]:tunnel.git submodules/tunnel".split(" ")) p.wait() if p.retcode != 0: error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html") return 1 warning("Tunnel enabled, disabling GPL third parties.") additional_args += ["-DENABLE_TUNNEL=ON", "-DENABLE_GPL_THIRD_PARTIES=OFF"] if args.list_features: tmpdir = tempfile.mkdtemp(prefix="linphone-iphone") tmptarget = IOSarm64Target() option_regex = re.compile("ENABLE_(.*):(.*)=(.*)") option_list = [""] for line in Popen( tmptarget.cmake_command("Debug", False, True, additional_args), cwd=tmpdir, shell=False, stdout=PIPE ).stdout.readlines(): match = option_regex.match(line) if match is not None: option_list.append("ENABLE_{} (is currently {})".format(match.groups()[0], match.groups()[2])) info("Here is the list of available features: {}".format("\n\t".join(option_list))) info("To enable some feature, please use -DENABLE_SOMEOPTION=ON") info("Similarly, to disable some feature, please use -DENABLE_SOMEOPTION=OFF") shutil.rmtree(tmpdir) return 0 selected_platforms = [] for platform in args.platform: if platform == "all": selected_platforms += archs_device + archs_simu elif platform == "devices": selected_platforms += archs_device elif platform == "simulators": selected_platforms += archs_simu else: selected_platforms += [platform] selected_platforms = list(set(selected_platforms)) for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode if args.clean: if os.path.isfile("Makefile"): os.remove("Makefile") elif selected_platforms: install_git_hook() generate_makefile(selected_platforms, generator) return 0
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-ac', '--all-codecs', help="Enable all codecs, including the non-free ones", action='store_true') argparser.add_argument( '-c', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-C', '--veryclean', help="Clean a previous build instead of preparing a build (also deleting the install prefix).", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G', '--generator', help="CMake build system generator (default: let CMake choose, use cmake -h to get the complete list).", default=None, dest='generator') argparser.add_argument( '-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument( '-sys', '--use-system-dependencies', help="Find dependencies on the system.", action='store_true') argparser.add_argument( '-p', '--package', help="Build an installation package (only on Mac OSX and Windows).", action='store_true') argparser.add_argument( '--python', help="Build Python module instead of desktop application.", action='store_true') argparser.add_argument( '--python-raspberry', help="Build Python module for raspberry pi instead of desktop application.", action='store_true') argparser.add_argument( '-t', '--tunnel', help="Enable Tunnel.", action='store_true') args, additional_args = argparser.parse_known_args() if args.use_system_dependencies: additional_args += ["-DLINPHONE_BUILDER_USE_SYSTEM_DEPENDENCIES=YES"] if args.all_codecs: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=YES"] additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] additional_args += ["-DENABLE_AMRNB=YES"] additional_args += ["-DENABLE_AMRWB=YES"] additional_args += ["-DENABLE_G729=YES"] additional_args += ["-DENABLE_GSM=YES"] additional_args += ["-DENABLE_ILBC=YES"] additional_args += ["-DENABLE_ISAC=YES"] additional_args += ["-DENABLE_OPUS=YES"] additional_args += ["-DENABLE_SILK=YES"] additional_args += ["-DENABLE_SPEEX=YES"] additional_args += ["-DENABLE_FFMPEG=YES"] additional_args += ["-DENABLE_H263=YES"] additional_args += ["-DENABLE_H263P=YES"] additional_args += ["-DENABLE_MPEG4=YES"] additional_args += ["-DENABLE_OPENH264=YES"] additional_args += ["-DENABLE_VPX=YES"] additional_args += ["-DENABLE_X264=NO"] if args.package: additional_args += ["-DENABLE_PACKAGING=YES"] additional_args += ["-DCMAKE_SKIP_INSTALL_RPATH=YES"] additional_args += ["-DENABLE_RELATIVE_PREFIX=YES"] if check_tools() != 0: return 1 if args.tunnel or os.path.isdir("submodules/tunnel"): if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen("git clone [email protected]:tunnel.git submodules/tunnel".split(" ")) p.wait() if p.returncode != 0: error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html") return 1 info("Tunnel enabled.") additional_args += ["-DENABLE_TUNNEL=YES"] # install_git_hook() target = None if args.python: target = PythonTarget() elif args.python_raspberry: target = PythonRaspberryTarget() else: target = DesktopTarget() if args.generator is not None: target.generator = args.generator if target.generator is None: # Default to "Unix Makefiles" if no target specific generator is set and the user has not defined one target.generator = "Unix Makefiles" if args.clean or args.veryclean: if args.veryclean: target.veryclean() else: target.clean() if os.path.isfile('Makefile'): os.remove('Makefile') else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode # only generated makefile if we are using Ninja or Makefile if target.generator.endswith('Ninja'): if not check_is_installed("ninja", "it"): return 1 generate_makefile('ninja -C') info("You can now run 'make' to build.") elif target.generator.endswith("Unix Makefiles"): generate_makefile('$(MAKE) -C') info("You can now run 'make' to build.") elif target.generator == "Xcode": info("You can now open Xcode project with: open WORK/cmake/Project.xcodeproj") else: warning("Not generating meta-makefile for generator {}.".format(target.generator)) return 0
default="merged.json") args = parser.parse_args() if args.cache_dir is None: args.cache_dir = os.path.join(Path.home(), ".vw_benchmark_cache") args.cache_dir = os.path.abspath(os.path.realpath(args.cache_dir)) # Check if a command was supplied if args.command is None: parser.print_help() sys.exit(1) elif args.command == "clone": clone.run(args.commits, args.num, args.from_ref, args.to_ref, args.cache_dir) elif args.command == "prepare": prepare.run(args.cache_dir) elif args.command == "run": benchmark.run(args.commits, args.num, args.from_ref, args.to_ref, args.runs, args.skip_existing, args.cache_dir) elif args.command == "compare_bin": benchmark.run_for_binary(args.binary, args.reference_binary, args.runs, args.cache_dir) elif args.command == "compare_commit": benchmark.run_for_commit(args.commit, args.reference_commit, args.runs, args.cache_dir) elif args.command == "find": find.run(args.name, args.path) elif args.command == "merge": data.merge(args.files, args.merged_name)
def main(argv=None): if argv is None: argv = sys.argv argparser = argparse.ArgumentParser(description="Prepare build of Linphone and its dependencies.") argparser.add_argument( "-c", "-C", "--clean", help="Clean a previous build instead of preparing a build.", action="store_true" ) argparser.add_argument( "-d", "--debug", help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action="store_true", ) argparser.add_argument("-dv", "--debug-verbose", help="Activate ms_debug logs.", action="store_true") argparser.add_argument( "-f", "--force", help="Force preparation, even if working directory already exist.", action="store_true" ) argparser.add_argument( "-G" "--generator", help="CMake build system generator (default: Unix Makefiles).", default="Unix Makefiles", choices=["Unix Makefiles", "Ninja"], ) argparser.add_argument( "-L", "--list-cmake-variables", help="List non-advanced CMake cache variables.", action="store_true", dest="list_cmake_variables", ) argparser.add_argument( "platform", nargs="*", action=PlatformListAction, default=["x86_64", "devices"], help="The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}.".format( ", ".join([repr(platform) for platform in platforms]) ), ) args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.G__generator] if args.debug_verbose: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] if os.path.isdir("submodules/tunnel"): print("Enabling tunnel") additional_args += ["-DENABLE_TUNNEL=YES"] if check_tools() != 0: return 1 install_git_hook() selected_platforms = [] for platform in args.platform: if platform == "all": selected_platforms += archs_device + archs_simu elif platform == "devices": selected_platforms += archs_device elif platform == "simulators": selected_platforms += archs_simu else: selected_platforms += [platform] selected_platforms = list(set(selected_platforms)) if args.G__generator == "Ninja": if check_installed("ninja", "it") != 0: return 1 generator = "ninja -C" else: generator = "$(MAKE) -C" for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode if args.clean: if os.path.isfile("Makefile"): os.remove("Makefile") elif selected_platforms: generate_makefile(selected_platforms, generator) return 0
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-ac', '--all-codecs', help="Enable all codecs, including the non-free ones", action='store_true') argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help= "Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument('-dv', '--debug-verbose', help="Activate ms_debug logs.", action='store_true') argparser.add_argument( '--disable-gpl-third-parties', help="Disable GPL third parties such as FFMpeg, x264.", action='store_true') argparser.add_argument( '--enable-non-free-codecs', help= "Enable non-free codecs such as OpenH264, MPEG4, etc.. Final application must comply with their respective license (see README.md).", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G', '--generator', help= "CMake build system generator (default: Unix Makefiles, use cmake -h to get the complete list).", default='Unix Makefiles', dest='generator') argparser.add_argument('-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument( '-lf', '--list-features', help="List optional features and their default values.", action='store_true', dest='list_features') argparser.add_argument('-t', '--tunnel', help="Enable Tunnel.", action='store_true') argparser.add_argument( 'platform', nargs='*', action=PlatformListAction, default=['arm', 'armv7', 'x86'], help= "The platform to build for (default is 'arm armv7 x86'). Space separated architectures in list: {0}." .format(', '.join([repr(platform) for platform in platforms]))) args, additional_args2 = argparser.parse_known_args() additional_args = ["-G", args.generator] if check_tools() != 0: return 1 if args.debug_verbose is True: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] if args.enable_non_free_codecs is True: additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] if args.all_codecs is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=YES"] additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] additional_args += ["-DENABLE_AMRNB=YES"] additional_args += ["-DENABLE_AMRWB=YES"] additional_args += ["-DENABLE_BV16=YES"] additional_args += ["-DENABLE_CODEC2=YES"] additional_args += ["-DENABLE_G729=YES"] additional_args += ["-DENABLE_GSM=YES"] additional_args += ["-DENABLE_ILBC=YES"] additional_args += ["-DENABLE_ISAC=YES"] additional_args += ["-DENABLE_OPUS=YES"] additional_args += ["-DENABLE_SILK=YES"] additional_args += ["-DENABLE_SPEEX=YES"] additional_args += ["-DENABLE_FFMPEG=YES"] additional_args += ["-DENABLE_H263=YES"] additional_args += ["-DENABLE_H263P=YES"] additional_args += ["-DENABLE_MPEG4=YES"] additional_args += ["-DENABLE_OPENH264=YES"] additional_args += ["-DENABLE_VPX=YES"] #additional_args += ["-DENABLE_X264=YES"] # Do not activate x264 because it has text relocation issues if args.disable_gpl_third_parties is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=NO"] if args.tunnel or os.path.isdir("submodules/tunnel"): if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen( "git clone [email protected]:tunnel.git submodules/tunnel" .split(" ")) p.wait() if p.returncode != 0: error( "Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html" ) return 1 warning("Tunnel enabled, disabling GPL third parties.") additional_args += [ "-DENABLE_TUNNEL=YES", "-DENABLE_GPL_THIRD_PARTIES=OFF" ] # User's options are priority upon all automatic options additional_args += additional_args2 if args.list_features: list_features(args.debug, additional_args) return 0 selected_platforms_dup = [] for platform in args.platform: if platform == 'all': selected_platforms_dup += ['arm', 'armv7', 'x86'] else: selected_platforms_dup += [platform] # unify platforms but keep provided order selected_platforms = [] for x in selected_platforms_dup: if x not in selected_platforms: selected_platforms.append(x) if os.path.isdir('WORK') and not args.clean and not args.force: warning( "Working directory WORK already exists. Please remove it (option -C or -c) before re-executing CMake " "to avoid conflicts between executions, or force execution (option -f) if you are aware of consequences." ) if os.path.isfile('Makefile'): Popen("make help-prepare-options".split(" ")) return 0 for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: # only generated makefile if we are using Ninja or Makefile if args.generator.endswith('Ninja'): if not check_is_installed("ninja", "it"): return 1 generate_makefile(selected_platforms, 'ninja -C') info("You can now run 'make' to build.") elif args.generator.endswith("Unix Makefiles"): generate_makefile(selected_platforms, '$(MAKE) -C') info("You can now run 'make' to build.") else: warning("Not generating meta-makefile for generator {}.".format( target.generator)) return 0
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help= "Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '--build-all-codecs', help= "Build all codecs including non-free. Final application must comply with their respective license (see README.md).", action='store_true') argparser.add_argument( '-G', '--generator', help= "CMake build system generator (default: Unix Makefiles, use cmake -h to get the complete list).", default='Unix Makefiles', dest='generator') argparser.add_argument( '-lf', '--list-features', help="List optional features and their default values.", action='store_true', dest='list_features') argparser.add_argument('-t', '--tunnel', help="Enable Tunnel.", action='store_true') argparser.add_argument( 'platform', nargs='*', action=PlatformListAction, default=['x86_64', 'devices'], help= "The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}." .format(', '.join([repr(platform) for platform in platforms]))) argparser.add_argument( '-L', '--list-cmake-variables', help="(debug) List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') args, additional_args2 = argparser.parse_known_args() additional_args = [] additional_args += ["-G", args.generator] if check_tools() != 0: return 1 additional_args += [ "-DLINPHONE_IOS_DEPLOYMENT_TARGET=" + extract_deployment_target() ] additional_args += [ "-DLINPHONE_BUILDER_DUMMY_LIBRARIES=" + ' '.join(extract_libs_list()) ] if args.build_all_codecs is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=YES"] additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] additional_args += ["-DENABLE_AMRNB=YES"] additional_args += ["-DENABLE_AMRWB=YES"] additional_args += ["-DENABLE_G729=YES"] additional_args += ["-DENABLE_GSM=YES"] additional_args += ["-DENABLE_ILBC=YES"] additional_args += ["-DENABLE_ISAC=YES"] additional_args += ["-DENABLE_OPUS=YES"] additional_args += ["-DENABLE_SILK=YES"] additional_args += ["-DENABLE_SPEEX=YES"] additional_args += ["-DENABLE_FFMPEG=YES"] additional_args += ["-DENABLE_H263=YES"] additional_args += ["-DENABLE_H263P=YES"] additional_args += ["-DENABLE_MPEG4=YES"] additional_args += ["-DENABLE_OPENH264=YES"] additional_args += ["-DENABLE_VPX=YES"] additional_args += ["-DENABLE_X264=YES"] if args.tunnel: if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen( "git submodule add -f [email protected]:tunnel.git submodules/tunnel" .split(" ")) p.wait() if p.returncode != 0: error( "Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html" ) return 1 warning("Tunnel enabled, disabling GPL third parties.") additional_args += [ "-DENABLE_TUNNEL=ON", "-DENABLE_GPL_THIRD_PARTIES=OFF", "-DENABLE_FFMPEG=NO" ] # User's options are priority upon all automatic options additional_args += additional_args2 if args.list_features: list_features(args.debug, additional_args) return 0 selected_platforms_dup = [] for platform in args.platform: if platform == 'all': selected_platforms_dup += archs_device + archs_simu elif platform == 'devices': selected_platforms_dup += archs_device elif platform == 'simulators': selected_platforms_dup += archs_simu else: selected_platforms_dup += [platform] # unify platforms but keep provided order selected_platforms = [] for x in selected_platforms_dup: if x not in selected_platforms: selected_platforms.append(x) if os.path.isdir('WORK') and not args.clean and not args.force: warning( "Working directory WORK already exists. Please remove it (option -C or -c) before re-executing CMake " "to avoid conflicts between executions, or force execution (option -f) if you are aware of consequences." ) if os.path.isfile('Makefile'): Popen("make help-prepare-options".split(" ")) return 0 for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: error( "Configuration failed, please check errors and rerun prepare.py." ) error("Aborting now.") return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: install_git_hook() # only generated makefile if we are using Ninja or Makefile if args.generator == 'Ninja': if not check_is_installed("ninja", "it"): return 1 generate_makefile(selected_platforms, 'ninja -C') elif args.generator == "Unix Makefiles": generate_makefile(selected_platforms, '$(MAKE) -C') elif args.generator == "Xcode": info( "You can now open Xcode project with: open WORK/cmake/Project.xcodeproj" ) else: info("Not generating meta-makefile for generator {}.".format( args.generator)) return 0
def main(argv=None): if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-dv', '--debug-verbose', help="Activate ms_debug logs.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G' '--generator', help="CMake build system generator (default: Unix Makefiles).", default='Unix Makefiles', choices=['Unix Makefiles', 'Ninja']) argparser.add_argument( '-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument('platform', nargs='*', action=PlatformListAction, default=[ 'x86_64', 'devices'], help="The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}.".format(', '.join([repr(platform) for platform in platforms]))) args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.G__generator] if args.debug_verbose: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] install_git_hook() selected_platforms = [] for platform in args.platform: if platform == 'all': selected_platforms += archs_device + archs_simu elif platform == 'devices': selected_platforms += archs_device elif platform == 'simulators': selected_platforms += archs_simu else: selected_platforms += [platform] selected_platforms = list(set(selected_platforms)) if args.G__generator == 'Ninja': generator = 'ninja -C' else: generator = '$(MAKE) -C' for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: retcode = Popen(["make", "help-prepare-options"]) return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: generate_makefile(selected_platforms, generator) return 0
# # START # answer = "n" # input("Start Generate Data? (y/n)") if (answer.lower() == "y" or 'generate' in sys.argv): import generate if ('test' in sys.argv): generate.test() else: generate.run() answer = "n" # input("Start Prepare Data? (y/n)") if (answer.lower() == "y" or 'prepare' in sys.argv): import prepare if ('analyze' in sys.argv): prepare.analyze() else: prepare.run() answer = "n" # input("Start Training? (y/n)") if (answer.lower() == "y" or 'train' in sys.argv): import train train.run() answer = "n" #input("Start Visualize? (y/n)") if (answer.lower() == "y" or 'visualize' in sys.argv): import analysis analysis.run()
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-ac', '--all-codecs', help="Enable all codecs, including the non-free ones", action='store_true') argparser.add_argument( '-c', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-C', '--veryclean', help="Clean a previous build instead of preparing a build (also deleting the install prefix).", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G', '--generator', help="CMake build system generator (default: let CMake choose, use cmake -h to get the complete list).", default=None, dest='generator') argparser.add_argument( '-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument( '-os', '--only-submodules', help="Build only submodules (finding all dependencies on the system.", action='store_true') argparser.add_argument( '-p', '--package', help="Build an installation package (only on Mac OSX and Windows).", action='store_true') argparser.add_argument( '--python', help="Build Python module instead of desktop application.", action='store_true') argparser.add_argument( '--python-raspberry', help="Build Python module for raspberry pi instead of desktop application.", action='store_true') argparser.add_argument( '-t', '--tunnel', help="Enable Tunnel.", action='store_true') args, additional_args = argparser.parse_known_args() if args.only_submodules: additional_args += ["-DLINPHONE_BUILDER_BUILD_ONLY_EXTERNAL_SOURCE_PATH=YES"] if args.all_codecs: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=YES"] additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] additional_args += ["-DENABLE_AMRNB=YES"] additional_args += ["-DENABLE_AMRWB=YES"] additional_args += ["-DENABLE_G729=YES"] additional_args += ["-DENABLE_GSM=YES"] additional_args += ["-DENABLE_ILBC=YES"] additional_args += ["-DENABLE_ISAC=YES"] additional_args += ["-DENABLE_OPUS=YES"] additional_args += ["-DENABLE_SILK=YES"] additional_args += ["-DENABLE_SPEEX=YES"] additional_args += ["-DENABLE_FFMPEG=YES"] additional_args += ["-DENABLE_H263=YES"] additional_args += ["-DENABLE_H263P=YES"] additional_args += ["-DENABLE_MPEG4=YES"] additional_args += ["-DENABLE_OPENH264=YES"] additional_args += ["-DENABLE_VPX=YES"] additional_args += ["-DENABLE_X264=NO"] if args.package: additional_args += ["-DENABLE_PACKAGING=YES"] additional_args += ["-DCMAKE_SKIP_INSTALL_RPATH=YES"] additional_args += ["-DENABLE_RELATIVE_PREFIX=YES"] if check_tools() != 0: return 1 if args.tunnel or os.path.isdir("submodules/tunnel"): if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen("git clone [email protected]:tunnel.git submodules/tunnel".split(" ")) p.wait() if p.returncode != 0: error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html") return 1 info("Tunnel enabled.") additional_args += ["-DENABLE_TUNNEL=YES"] # install_git_hook() target = None if args.python: target = PythonTarget() elif args.python_raspberry: target = PythonRaspberryTarget() else: target = DesktopTarget() if args.generator is not None: target.generator = args.generator if target.generator is None: # Default to "Unix Makefiles" if no target specific generator is set and the user has not defined one target.generator = "Unix Makefiles" if args.clean or args.veryclean: if args.veryclean: target.veryclean() else: target.clean() if os.path.isfile('Makefile'): os.remove('Makefile') else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode # only generated makefile if we are using Ninja or Makefile if target.generator.endswith('Ninja'): if not check_is_installed("ninja", "it"): return 1 generate_makefile('ninja -C') info("You can now run 'make' to build.") elif target.generator.endswith("Unix Makefiles"): generate_makefile('$(MAKE) -C') info("You can now run 'make' to build.") elif target.generator == "Xcode": info("You can now open Xcode project with: open WORK/cmake/Project.xcodeproj") else: warning("Not generating meta-makefile for generator {}.".format(target.generator)) return 0
def main(argv=None): if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help= "Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument('-dv', '--debug-verbose', help="Activate ms_debug logs.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G' '--generator', help="CMake build system generator (default: Unix Makefiles).", default='Unix Makefiles', choices=['Unix Makefiles', 'Ninja']) argparser.add_argument('-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument( 'platform', nargs='*', action=PlatformListAction, default=['x86_64', 'devices'], help= "The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}." .format(', '.join([repr(platform) for platform in platforms]))) args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.G__generator] if args.debug_verbose: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] install_git_hook() selected_platforms = [] for platform in args.platform: if platform == 'all': selected_platforms += archs_device + archs_simu elif platform == 'devices': selected_platforms += archs_device elif platform == 'simulators': selected_platforms += archs_simu else: selected_platforms += [platform] selected_platforms = list(set(selected_platforms)) if args.G__generator == 'Ninja': generator = 'ninja -C' else: generator = '$(MAKE) -C' for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: retcode = Popen(["make", "help-prepare-options"]) return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: generate_makefile(selected_platforms, generator) return 0
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '--build-all-codecs', help="Build all codecs including non-free. Final application must comply with their respective license (see README.md).", action='store_true') argparser.add_argument( '-G', '--generator', help="CMake build system generator (default: Unix Makefiles, use cmake -h to get the complete list).", default='Unix Makefiles', dest='generator') argparser.add_argument( '-lf', '--list-features', help="List optional features and their default values.", action='store_true', dest='list_features') argparser.add_argument( '-t', '--tunnel', help="Enable Tunnel.", action='store_true') argparser.add_argument('platform', nargs='*', action=PlatformListAction, default=[ 'x86_64', 'devices'], help="The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}.".format(', '.join([repr(platform) for platform in platforms]))) argparser.add_argument( '-L', '--list-cmake-variables', help="(debug) List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') args, additional_args2 = argparser.parse_known_args() additional_args = [] additional_args += ["-G", args.generator] if check_tools() != 0: return 1 additional_args += ["-DLINPHONE_IOS_DEPLOYMENT_TARGET=" + extract_deployment_target()] additional_args += ["-DLINPHONE_BUILDER_DUMMY_LIBRARIES=" + ' '.join(extract_libs_list())] if args.build_all_codecs is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=YES"] additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] additional_args += ["-DENABLE_AMRNB=YES"] additional_args += ["-DENABLE_AMRWB=YES"] additional_args += ["-DENABLE_G729=YES"] additional_args += ["-DENABLE_GSM=YES"] additional_args += ["-DENABLE_ILBC=YES"] additional_args += ["-DENABLE_ISAC=YES"] additional_args += ["-DENABLE_OPUS=YES"] additional_args += ["-DENABLE_SILK=YES"] additional_args += ["-DENABLE_SPEEX=YES"] additional_args += ["-DENABLE_FFMPEG=YES"] additional_args += ["-DENABLE_H263=YES"] additional_args += ["-DENABLE_H263P=YES"] additional_args += ["-DENABLE_MPEG4=YES"] additional_args += ["-DENABLE_OPENH264=YES"] additional_args += ["-DENABLE_VPX=YES"] additional_args += ["-DENABLE_X264=YES"] if args.tunnel: if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen("git submodule add -f [email protected]:tunnel.git submodules/tunnel".split(" ")) p.wait() if p.returncode != 0: error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html") return 1 warning("Tunnel enabled, disabling GPL third parties.") additional_args += ["-DENABLE_TUNNEL=ON", "-DENABLE_GPL_THIRD_PARTIES=OFF", "-DENABLE_FFMPEG=NO"] # User's options are priority upon all automatic options additional_args += additional_args2 if args.list_features: list_features(args.debug, additional_args) return 0 selected_platforms_dup = [] for platform in args.platform: if platform == 'all': selected_platforms_dup += archs_device + archs_simu elif platform == 'devices': selected_platforms_dup += archs_device elif platform == 'simulators': selected_platforms_dup += archs_simu else: selected_platforms_dup += [platform] # unify platforms but keep provided order selected_platforms = [] for x in selected_platforms_dup: if x not in selected_platforms: selected_platforms.append(x) if os.path.isdir('WORK') and not args.clean and not args.force: warning("Working directory WORK already exists. Please remove it (option -C or -c) before re-executing CMake " "to avoid conflicts between executions, or force execution (option -f) if you are aware of consequences.") if os.path.isfile('Makefile'): Popen("make help-prepare-options".split(" ")) return 0 for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: error("Configuration failed, please check errors and rerun prepare.py.") error("Aborting now.") return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: install_git_hook() # only generated makefile if we are using Ninja or Makefile if args.generator == 'Ninja': if not check_is_installed("ninja", "it"): return 1 generate_makefile(selected_platforms, 'ninja -C') elif args.generator == "Unix Makefiles": generate_makefile(selected_platforms, '$(MAKE) -C') elif args.generator == "Xcode": info("You can now open Xcode project with: open WORK/cmake/Project.xcodeproj") else: info("Not generating meta-makefile for generator {}.".format(args.generator)) return 0
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help= "Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument('-dv', '--debug-verbose', help="Activate ms_debug logs.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '--disable-gpl-third-parties', help="Disable GPL third parties such as FFMpeg, x264.", action='store_true') argparser.add_argument( '--enable-non-free-codecs', help= "Enable non-free codecs such as OpenH264, MPEG4, etc.. Final application must comply with their respective license (see README.md).", action='store_true') argparser.add_argument( '-G', '--generator', help= "CMake build system generator (default: Unix Makefiles, use cmake -h to get the complete list).", default='Unix Makefiles', dest='generator') argparser.add_argument('-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument( '-lf', '--list-features', help="List optional features and their default values.", action='store_true', dest='list_features') argparser.add_argument('-t', '--tunnel', help="Enable Tunnel.", action='store_true') argparser.add_argument( 'platform', nargs='*', action=PlatformListAction, default=['x86_64', 'devices'], help= "The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}." .format(', '.join([repr(platform) for platform in platforms]))) args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.generator] if check_tools() != 0: return 1 additional_args += [ "-DLINPHONE_IOS_DEPLOYMENT_TARGET=" + extract_deployment_target() ] additional_args += [ "-DLINPHONE_BUILDER_DUMMY_LIBRARIES=" + ' '.join(extract_libs_list()) ] if args.debug_verbose is True: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] if args.enable_non_free_codecs is True: additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] if args.disable_gpl_third_parties is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=NO"] if args.tunnel or os.path.isdir("submodules/tunnel"): if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen( "git clone [email protected]:tunnel.git submodules/tunnel" .split(" ")) p.wait() if p.returncode != 0: error( "Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html" ) return 1 warning("Tunnel enabled, disabling GPL third parties.") additional_args += [ "-DENABLE_TUNNEL=ON", "-DENABLE_GPL_THIRD_PARTIES=OFF" ] if args.list_features: tmpdir = tempfile.mkdtemp(prefix="linphone-iphone") tmptarget = IOSarm64Target() tmptarget.abs_cmake_dir = tmpdir option_regex = re.compile("ENABLE_(.*):(.*)=(.*)") option_list = [""] build_type = 'Debug' if args.debug else 'Release' for line in Popen(tmptarget.cmake_command(build_type, False, True, additional_args), cwd=tmpdir, shell=False, stdout=PIPE).stdout.readlines(): match = option_regex.match(line) if match is not None: option_list.append("ENABLE_{} (is currently {})".format( match.groups()[0], match.groups()[2])) info("Here is the list of available features: {}".format( "\n\t".join(option_list))) info("To enable some feature, please use -DENABLE_SOMEOPTION=ON") info( "Similarly, to disable some feature, please use -DENABLE_SOMEOPTION=OFF" ) shutil.rmtree(tmpdir) return 0 selected_platforms_dup = [] for platform in args.platform: if platform == 'all': selected_platforms_dup += archs_device + archs_simu elif platform == 'devices': selected_platforms_dup += archs_device elif platform == 'simulators': selected_platforms_dup += archs_simu else: selected_platforms_dup += [platform] # unify platforms but keep provided order selected_platforms = [] for x in selected_platforms_dup: if x not in selected_platforms: selected_platforms.append(x) for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: install_git_hook() # only generated makefile if we are using Ninja or Makefile if args.generator == 'Ninja': if not check_is_installed("ninja", "it"): return 1 generate_makefile(selected_platforms, 'ninja -C') elif args.generator == "Unix Makefiles": generate_makefile(selected_platforms, '$(MAKE) -C') elif args.generator == "Xcode": print( "You can now open Xcode project with: open WORK/cmake/Project.xcodeproj" ) else: print("Not generating meta-makefile for generator {}.".format( args.generator)) return 0
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Linphone and its dependencies.") argparser.add_argument( '-c', '-C', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-d', '--debug', help="Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-dv', '--debug-verbose', help="Activate ms_debug logs.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '--disable-gpl-third-parties', help="Disable GPL third parties such as FFMpeg, x264.", action='store_true') argparser.add_argument( '--enable-non-free-codecs', help="Enable non-free codecs such as OpenH264, MPEG4, etc.. Final application must comply with their respective license (see README.md).", action='store_true') argparser.add_argument( '-G' '--generator', help="CMake build system generator (default: Unix Makefiles).", default='Unix Makefiles', choices=['Unix Makefiles', 'Ninja'], dest='generator') argparser.add_argument( '-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument( '-lf', '--list-features', help="List optional features and their default values.", action='store_true', dest='list_features') argparser.add_argument( '-t', '--tunnel', help="Enable Tunnel.", action='store_true') argparser.add_argument('platform', nargs='*', action=PlatformListAction, default=[ 'x86_64', 'devices'], help="The platform to build for (default is 'x86_64 devices'). Space separated architectures in list: {0}.".format(', '.join([repr(platform) for platform in platforms]))) args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.generator] if args.generator == 'Ninja': if not check_is_installed("ninja", "it"): return 1 generator = 'ninja -C' else: generator = '$(MAKE) -C' if check_tools() != 0: return 1 additional_args += ["-DLINPHONE_IOS_DEPLOYMENT_TARGET=" + extract_deployment_target()] additional_args += ["-DLINPHONE_BUILDER_DUMMY_LIBRARIES=" + ' '.join(extract_libs_list())] if args.debug_verbose is True: additional_args += ["-DENABLE_DEBUG_LOGS=YES"] if args.enable_non_free_codecs is True: additional_args += ["-DENABLE_NON_FREE_CODECS=YES"] if args.disable_gpl_third_parties is True: additional_args += ["-DENABLE_GPL_THIRD_PARTIES=NO"] if args.tunnel or os.path.isdir("submodules/tunnel"): if not os.path.isdir("submodules/tunnel"): info("Tunnel wanted but not found yet, trying to clone it...") p = Popen("git clone [email protected]:tunnel.git submodules/tunnel".split(" ")) p.wait() if p.retcode != 0: error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html") return 1 warning("Tunnel enabled, disabling GPL third parties.") additional_args += ["-DENABLE_TUNNEL=ON", "-DENABLE_GPL_THIRD_PARTIES=OFF"] if args.list_features: tmpdir = tempfile.mkdtemp(prefix="linphone-iphone") tmptarget = IOSarm64Target() tmptarget.abs_cmake_dir = tmpdir option_regex = re.compile("ENABLE_(.*):(.*)=(.*)") option_list = [""] build_type = 'Debug' if args.debug else 'Release' for line in Popen(tmptarget.cmake_command(build_type, False, True, additional_args), cwd=tmpdir, shell=False, stdout=PIPE).stdout.readlines(): match = option_regex.match(line) if match is not None: option_list.append("ENABLE_{} (is currently {})".format(match.groups()[0], match.groups()[2])) info("Here is the list of available features: {}".format("\n\t".join(option_list))) info("To enable some feature, please use -DENABLE_SOMEOPTION=ON") info("Similarly, to disable some feature, please use -DENABLE_SOMEOPTION=OFF") shutil.rmtree(tmpdir) return 0 selected_platforms_dup = [] for platform in args.platform: if platform == 'all': selected_platforms_dup += archs_device + archs_simu elif platform == 'devices': selected_platforms_dup += archs_device elif platform == 'simulators': selected_platforms_dup += archs_simu else: selected_platforms_dup += [platform] # unify platforms but keep provided order selected_platforms = [] for x in selected_platforms_dup: if x not in selected_platforms: selected_platforms.append(x) for platform in selected_platforms: target = targets[platform] if args.clean: target.clean() else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode if args.clean: if os.path.isfile('Makefile'): os.remove('Makefile') elif selected_platforms: install_git_hook() generate_makefile(selected_platforms, generator) return 0
def main(argv=None): basicConfig(format="%(levelname)s: %(message)s", level=INFO) if argv is None: argv = sys.argv argparser = argparse.ArgumentParser( description="Prepare build of Flexisip and its dependencies.") argparser.add_argument( '-c', '--clean', help="Clean a previous build instead of preparing a build.", action='store_true') argparser.add_argument( '-C', '--veryclean', help= "Clean a previous build instead of preparing a build (also deleting the install prefix).", action='store_true') argparser.add_argument( '-d', '--debug', help= "Prepare a debug build, eg. add debug symbols and use no optimizations.", action='store_true') argparser.add_argument( '-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true') argparser.add_argument( '-G', '--generator', help= "CMake build system generator (default: Unix Makefiles, use cmake -h to get the complete list).", default='Unix Makefiles', dest='generator') argparser.add_argument('-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables') argparser.add_argument('target', choices=target_names, help="The target to build.", default='flexisip') args, additional_args = argparser.parse_known_args() additional_args += ["-G", args.generator] #additional_args += ["-DLINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS=YES"] if check_tools() != 0: return 1 target = targets[args.target] if args.clean or args.veryclean: if args.veryclean: target.veryclean() else: target.clean() if os.path.isfile('Makefile'): os.remove('Makefile') else: retcode = prepare.run(target, args.debug, False, args.list_cmake_variables, args.force, additional_args) if retcode != 0: if retcode == 51: Popen("make help-prepare-options".split(" ")) retcode = 0 return retcode # only generated makefile if we are using Ninja or Makefile if args.generator.endswith('Ninja'): if not check_is_installed("ninja", "it"): return 1 generate_makefile('ninja -C', target.work_dir + "/cmake") info("You can now run 'make' to build.") elif args.generator.endswith("Unix Makefiles"): generate_makefile('$(MAKE) -C', target.work_dir + "/cmake") info("You can now run 'make' to build.") elif args.generator == "Xcode": info( "You can now open Xcode project with: open WORK/cmake/Project.xcodeproj" ) else: warning("Not generating meta-makefile for generator {}.".format( args.generator)) return 0