diff --git a/CMakeModules/Common.cmake b/CMakeModules/Common.cmake index d1c5825..b7d6c7f 100644 --- a/CMakeModules/Common.cmake +++ b/CMakeModules/Common.cmake @@ -1,5 +1,13 @@ +set(ENV_COMMAND export) +set(ENV_SEP ":") set(DEPOTTOOLS_PATH ${CMAKE_SOURCE_DIR}/Dependencies/depot_tools) +if(WIN32) + set(ENV_COMMAND set) + set(ENV_SEP ";") + set(DEPOTTOOLS_PATH "${DEPOTTOOLS_PATH};${DEPOTTOOLS_PATH}/python276_bin;") +endif(WIN32) + macro(add_libwebrtc_command ARG_NAME ARG_OUTPUT diff --git a/Dependencies/depot_tools b/Dependencies/depot_tools index f7b29d4..d05b9b1 160000 --- a/Dependencies/depot_tools +++ b/Dependencies/depot_tools @@ -1 +1 @@ -Subproject commit f7b29d4a6dd3fa9777f68423fedcc1a6154014bf +Subproject commit d05b9b1575d9ca30230ae612d2f08e0381a0da2b diff --git a/Targets/Install/CMakeLists.txt b/Targets/Install/CMakeLists.txt index bd5447e..6bb28ee 100644 --- a/Targets/Install/CMakeLists.txt +++ b/Targets/Install/CMakeLists.txt @@ -47,6 +47,8 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") set(LIBWEBRTC_ARCH "x86") elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^x86.64$") set(LIBWEBRTC_ARCH "x64") +elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") + set(LIBWEBRTC_ARCH "x64") elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc") set(LIBWEBRTC_ARCH "ppc") elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc64") diff --git a/jakelib/build.jake b/jakelib/build.jake index ebbe6b3..89be170 100644 --- a/jakelib/build.jake +++ b/jakelib/build.jake @@ -2,14 +2,27 @@ var os = require('os'); var fs = require('fs-extra'); +var exec = require('child_process').exec; +var execSync = require('child_process').execSync; namespace('build', function () { task('generate', {async: true}, function () { var opts = 'use_gold=false is_debug=false rtc_include_tests=false'; + var pathSep = (os.platform() === 'win32') ? '\\' : '/'; + var envSep = (os.platform() === 'win32') ? ';' : ':'; + + if (os.platform() === 'win32') { + process.env.DEPOT_TOOLS_WIN_TOOLCHAIN = 0; + process.env.PATH = process.cwd() + '/Dependencies/depot_tools;' + process.env.PATH; + process.env.PATH = process.cwd() + '/Dependencies/depot_tools/python276_bin;' + process.env.PATH; + } else { + process.env.PATH = process.cwd() + '/Dependencies/depot_tools:' + process.env.PATH; + } + + console.log('Generating WebRTC build files...' + 'gn gen out/Default --args=\'' + opts + '\''); - process.env.PATH = process.cwd() + '/Dependencies/depot_tools:' + process.env.PATH; process.chdir('src'); - jake.exec('gn gen out/Default --args=\'' + opts + '\'', function () { + exec('gn gen out/Default --args="' + opts + '"', function (error, stdout, stderr) { complete(); }); }); @@ -18,14 +31,14 @@ namespace('build', function () { var packages = 'libjingle_peerconnection field_trial_default metrics_default'; console.log('Building WebRTC...'); - jake.exec('ninja -C out/Default ' + packages, { printStdout: true }, function () { + jake.exec('ninja -C out/Default ' + packages, { printStdout: true, printStderr: true }, function () { complete(); }); }); task('merge', ['build:ninja'], {async: true}, function () { - var prefix = os.platform() !== 'windows' ? 'lib' : ''; - var suffix = os.platform() === 'windows' ? '.lib' : '.a'; + var prefix = os.platform() !== 'win32' ? 'lib' : ''; + var suffix = os.platform() === 'win32' ? '.lib' : '.a'; var path = '../lib/' + prefix + 'webrtc' + suffix; console.log('Merging libraries...'); @@ -34,7 +47,15 @@ namespace('build', function () { fs.mkdir('../lib'); } - jake.exec('python webrtc/build/merge_libs.py out/Default ' + path, function () { + if (os.platform() === 'win32') { + var output = execSync('python chromium/src/build/vs_toolchain.py get_toolchain_dir', { encoding: 'utf-8' }); + var matches = output.match(/vs_path = \"(.*)\"/); + console.log(matches); + + process.env.PATH = matches[1] + '\\VC\\bin' + ';' + process.env.PATH; + } + + jake.exec('python webrtc/build/merge_libs.py out/Default ' + path, { printStdout: true, printStderr: true }, function () { complete(); }); }); diff --git a/jakelib/common.js b/jakelib/common.js index 20f57a2..3cc9f59 100644 --- a/jakelib/common.js +++ b/jakelib/common.js @@ -8,7 +8,7 @@ function getPackageName() { var platform = os.platform(); var arch = os.arch(); var nodever = process.version; - var suffix = (platform === 'windows') ? '.zip' : '.tar.gz'; + var suffix = (platform === 'win32') ? '.zip' : '.tar.gz'; return pkg.config.filename .replace('{VERSION}', version) diff --git a/jakelib/fetch.jake b/jakelib/fetch.jake index 91765aa..3b62b9c 100644 --- a/jakelib/fetch.jake +++ b/jakelib/fetch.jake @@ -45,7 +45,7 @@ namespace('fetch', function () { var packageName = getPackageName(); console.log('Extracting', packageName); - jake.exec('tar xf ' + packageName, function () { + jake.exec('tar xf ' + packageName, { printStdout: true, printStderr: true }, function () { fs.unlinkSync(packageName); complete(); }); @@ -59,37 +59,44 @@ namespace('fetch', function () { }); task('configure', ['fetch:submodules'], {async: true}, function () { + var pathSep = (os.platform() === 'win32') ? '\\' : '/'; + var envSep = (os.platform() === 'win32') ? ';' : ':'; + + if (os.platform() === 'win32') { + process.env.DEPOT_TOOLS_WIN_TOOLCHAIN = 0; + } + console.log('Configuring gclient to fetch WebRTC code'); - process.env.PATH = process.cwd() + '/Dependencies/depot_tools:' + process.env.PATH; - jake.exec('gclient config --name src ' + WebRTCUrl, {printStdout: true}, function () { + process.env.PATH = process.cwd() + pathSep + 'Dependencies' + pathSep + 'depot_tools' + envSep + process.env.PATH; + jake.exec('gclient config --name src ' + WebRTCUrl, { printStdout: true, printStderr: true }, function () { complete(); }); }); task('sync', ['fetch:configure'], {async: true}, function () { console.log('Retrieving WebRTC source code'); - jake.exec('gclient sync --revision ' + WebRTCRev + ' -n -D', {printStdout: true}, function () { + jake.exec('gclient sync --revision ' + WebRTCRev + ' -n -D', { printStdout: true, printStderr: true }, function () { complete(); }); }); task('chromium', ['fetch:sync'], {async: true}, function () { console.log('Retrieving Chromium dependencies'); - jake.exec('git clone ' + ChromiumUrl + ' src/chromium/src', { breakOnError: false, printStdout: true }, function () { + jake.exec('git clone ' + ChromiumUrl + ' src/chromium/src', { breakOnError: false, printStdout: true, printStderr: true }, function () { complete(); }); }); task('clang', ['fetch:chromium'], {async: true}, function () { console.log('Updating clang'); - jake.exec('python src/chromium/src/tools/clang/scripts/update.py', {printStdout: true}, function () { + jake.exec('python src/chromium/src/tools/clang/scripts/update.py', { printStdout: true, printStderr: true }, function () { complete(); }); }); task('links', ['fetch:clang'], {async: true}, function () { console.log('Creating symbolic links'); - jake.exec('python src/setup_links.py', {printStdout: true}, function () { + jake.exec('python src/setup_links.py', { printStdout: true, printStderr: true }, function () { complete(); }); }); diff --git a/jakelib/package.jake b/jakelib/package.jake index e37a111..50eb6ef 100644 --- a/jakelib/package.jake +++ b/jakelib/package.jake @@ -7,7 +7,7 @@ task('package', {async: true}, function () { var packageName = getPackageName(); console.log('Creating ' + packageName + '...'); - if (os.platform() !== 'windows') { + if (os.platform() !== 'win32') { jake.exec('tar cfz ' + packageName + ' include lib', function () { complete(); });