提交 f41601f0 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Add root Makefile (make Release, make Debug)

Allow 'Release'/'Debug' worker build types via env MEDIASOUP_BUILDTYPE
Allow cusotm worker bin via env variables MEDIASOUP_WORKER_PATH
上级 989d400c
.PHONY: default Release Debug clean
default: Release
Release:
cd worker && ./scripts/configure.py
$(MAKE) BUILDTYPE=Release -C worker/out
Debug:
cd worker && ./scripts/configure.py
$(MAKE) BUILDTYPE=Debug -C worker/out
clean:
$(RM) -rf worker/out
......@@ -10,9 +10,26 @@ const utils = require('./utils');
const Channel = require('./Channel');
const Room = require('./Room');
const WORKER_BIN_PATH = path.join(__dirname, '..', 'worker', 'out', 'Release', 'mediasoup-worker');
const CHANNEL_FD = 3;
let workerPath;
// If env MEDIASOUP_WORKER_PATH is given, use it
if (process.env.MEDIASOUP_WORKER_PATH)
{
workerPath = process.env.MEDIASOUP_WORKER_PATH;
}
// Otherwise check if env MEDIASOUP_BUILDTYPE == 'Debug' is set
else if (process.env.MEDIASOUP_BUILDTYPE === 'Debug')
{
workerPath = path.join(__dirname, '..', 'worker', 'out', 'Debug', 'mediasoup-worker');
}
// Otherwise use 'Release'
else
{
workerPath = path.join(__dirname, '..', 'worker', 'out', 'Release', 'mediasoup-worker');
}
// Set environtment variable for the worker
process.env.MEDIASOUP_CHANNEL_FD = String(CHANNEL_FD);
......@@ -40,7 +57,7 @@ class Worker extends EventEmitter
};
// Create the mediasoup-worker child process
this._child = spawn(WORKER_BIN_PATH, spawnArgs, spawnOptions);
this._child = spawn(workerPath, spawnArgs, spawnOptions);
// Channel instance
this._channel = new Channel(this._child.stdio[CHANNEL_FD]);
......
......@@ -37,6 +37,6 @@
},
"scripts": {
"test": "gulp test",
"postinstall": "cd worker && ./scripts/configure.py && make -C out"
"postinstall": "make Release"
}
}
......@@ -8,9 +8,9 @@
# Others:
'gcc_version%': 'unknown',
'clang%': 1,
'openssl_fips%': 'false',
'mediasoup_asan%': 'false',
'libopenssl': '<(PRODUCT_DIR)/libopenssl.a',
'openssl_fips%': 'false',
'libopenssl': '<(PRODUCT_DIR)/libopenssl.a'
},
'target_defaults':
......@@ -19,6 +19,10 @@
'configurations':
{
'Release':
{
'cflags': [ '-g' ]
},
'Debug':
{
'defines': [ ' MS_DEVEL', 'DEBUG' ],
......@@ -27,10 +31,6 @@
{
'GCC_OPTIMIZATION_LEVEL': '0'
}
},
'Release':
{
'cflags': [ '-g' ]
}
},
......
......@@ -100,9 +100,6 @@ if __name__ == '__main__':
args.append('-Dnode_byteorder=' + sys.byteorder)
# TMP
# args.append('--debug=all')
gyp_args = list(args)
print gyp_args
run_gyp(gyp_args)
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论