Created
September 15, 2015 22:29
-
-
Save cahlbin/4e57723599f40582493c to your computer and use it in GitHub Desktop.
Makefile for WebRTC iOS development setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Makefile for common task required to setup Google WebRTC repository | |
# for iOS development. | |
# | |
# This Makefile helps with the following steps: | |
# | |
# * Download depot_tools and add to PATH (depot_tools is a | |
# pre-requisite for WebRTC development) | |
# | |
# * Use depot_tools / gclient to synchronize WebRTC source tree | |
# | |
# * Generate ninja projects with GYP flags targeting iOS | |
# | |
# * Convenience goals for building and installing AppRTCDemo | |
# | |
SHELL := /bin/bash | |
.PHONY: clean cleanall sync compdb AppRTCDemo AppRTCDemo-install | |
CONFIGURATION ?= Debug-iphoneos | |
GYP_DEFINES="OS=ios target_arch=arm64 build_with_chromium=0" | |
OUT_DIR=src/out/$(CONFIGURATION) | |
clean: | |
rm -rf src/out | |
rm -rf .gclient | |
cleanall: | |
rm -rf src | |
rm -rf .gclient | |
rm -rf .gclient_entries | |
rm -rf depot_tools | |
# download depot_tools and gclient | |
depot_tools/gclient: | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
# generate .gclient file used to sync WebRTC source | |
.gclient: depot_tools/gclient | |
gclient config --name src https://chromium.googlesource.com/external/webrtc.git | |
echo "target_os = [\"ios\"]" >> .gclient | |
# use gclient to synchronize WebRTC source tree | |
src: .gclient | |
export PATH=depot_tools:$(PATH) && gclient sync | |
# generate ninja projects | |
$(OUT_DIR)/build.ninja: .gclient | src | |
export PATH=$(realpath depot_tools):$(PATH) && \ | |
export GYP_CROSSCOMPILE=1 && \ | |
export GYP_DEFINES=$(GYP_DEFINES) && \ | |
cd src && python webrtc/build/gyp_webrtc | |
# produce Clang/LLVM compatible compilation | |
$(OUT_DIR)/compile_commands.json: $(OUT_DIR)/build.ninja | |
ninja -C $(OUT_DIR) -t compdb c cc cxx cc objc objcxx > $@ | |
# build AppRTCDemo | |
$(OUT_DIR)/AppRTCDemo.app: $(OUT_DIR)/build.ninja | |
ninja -C $(OUT_DIR) AppRTCDemo | |
# sync with gclient | |
sync: .gclient | |
export PATH=depot_tools:$(PATH) && gclient sync | |
# convenience goal to build AppRTCDemo | |
AppRTCDemo: $(OUT_DIR)/AppRTCDemo.app | |
# build & Install AppRTCDemo on iOS device | |
AppRTCDemo-install: $(OUT_DIR)/AppRTCDemo.app | |
ideviceinstaller -i $< | |
# convenience goal to produce Clang/LLVM compatible compilation | |
# database | |
compdb: $(OUT_DIR)/compile_commands.json | |
# set DEFAULT_GOAL to generate ninja projects | |
.DEFAULT_GOAL := $(OUT_DIR)/build.ninja |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment