Merge pull request #2556 from pandamicro/optimize

Support build native with native renderer option
This commit is contained in:
pandamicro
2018-04-19 11:44:18 +08:00
committed by GitHub
4 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ module.exports = {
this.Texture2D = renderEngine.Texture2D;
this.canvas = canvas;
if (CC_JSB) {
if (CC_JSB && CC_NATIVERENDERER) {
// native codes will create an instance of Device, so just use the global instance.
this.device = window.device;
}
+10 -6
View File
@@ -213,9 +213,11 @@ exports.buildJsb = function (sourceFile, outputFile, excludes, opt_macroFlags, c
var outFile = Path.basename(outputFile);
var outDir = Path.dirname(outputFile);
var bundler = createBundler(sourceFile, {
aliasifyConfig: aliasifyConfig
});
var opts = {};
if (opt_macroFlags && opt_macroFlags.nativeRenderer) {
opts.aliasifyConfig = aliasifyConfig;
}
var bundler = createBundler(sourceFile, opts);
excludes = excludes.concat(jsbSkipModules);
excludes.forEach(function (module) {
bundler.ignore(require.resolve(module));
@@ -245,9 +247,11 @@ exports.buildJsbMin = function (sourceFile, outputFile, excludes, opt_macroFlags
var outFile = Path.basename(outputFile);
var outDir = Path.dirname(outputFile);
var bundler = createBundler(sourceFile, {
aliasifyConfig: aliasifyConfig
});
var opts = {};
if (opt_macroFlags && opt_macroFlags.nativeRenderer) {
opts.aliasifyConfig = aliasifyConfig;
}
var bundler = createBundler(sourceFile, opts);
excludes = excludes.concat(jsbSkipModules);
excludes.forEach(function (module) {
bundler.ignore(require.resolve(module));
+1 -1
View File
@@ -1,6 +1,6 @@
const PLATFORM_MACROS = ['CC_EDITOR', 'CC_PREVIEW', 'CC_BUILD', 'CC_TEST'];
const FLAGS = ['jsb', 'wechatgame', 'qqplay', 'debug'];
const FLAGS = ['jsb', 'wechatgame', 'qqplay', 'debug', 'nativeRenderer'];
// generate macros for uglify's global_defs
// available platforms: 'editor' | 'preview' | 'build' | 'test'
+5 -2
View File
@@ -22,8 +22,11 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
require('./gfx');
require('./renderer');
if (CC_NATIVERENDERER) {
require('./gfx');
require('./renderer');
}
require('../index')
require('./jsb-audio')
require('./jsb-loader')