mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
build optimizations
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
Import("env")
|
||||
|
||||
env.Execute("node ./tools/webfilesbuilder/node_modules/gulp/bin/gulp.js --silent --cwd ./tools/webfilesbuilder")
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
from subprocess import call
|
||||
import os
|
||||
Import("env")
|
||||
|
||||
def code_check(source, target, env):
|
||||
print("\n** Starting cppcheck...")
|
||||
call(["cppcheck", os.getcwd()+"/.", "--force", "--enable=all"])
|
||||
print("\n** Finished cppcheck...\n")
|
||||
print("\n** Starting cpplint...")
|
||||
call(["cpplint", "--extensions=ino,cpp,h", "--filter=-legal/copyright,-build/include,-whitespace",
|
||||
"--linelength=120", "--recursive", "src", "lib/myESP"])
|
||||
print("\n** Finished cpplint...")
|
||||
|
||||
#my_flags = env.ParseFlags(env['BUILD_FLAGS'])
|
||||
#defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")}
|
||||
# print defines
|
||||
# print env.Dump()
|
||||
|
||||
# built in targets: (buildprog, size, upload, program, buildfs, uploadfs, uploadfsota)
|
||||
env.AddPreAction("buildprog", code_check)
|
||||
# env.AddPostAction(.....)
|
||||
|
||||
# see http://docs.platformio.org/en/latest/projectconf/advanced_scripting.html#before-pre-and-after-post-actions
|
||||
# env.Replace(PROGNAME="firmware_%s" % defines.get("VERSION"))
|
||||
# env.Replace(PROGNAME="firmware_%s" % env['BOARD'])
|
||||
37
scripts/main_script.py
Normal file
37
scripts/main_script.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
Import("env")
|
||||
|
||||
class Color(object):
|
||||
BLACK = '\x1b[1;30m'
|
||||
RED = '\x1b[1;31m'
|
||||
GREEN = '\x1b[1;32m'
|
||||
YELLOW = '\x1b[1;33m'
|
||||
BLUE = '\x1b[1;34m'
|
||||
MAGENTA = '\x1b[1;35m'
|
||||
CYAN = '\x1b[1;36m'
|
||||
WHITE = '\x1b[1;37m'
|
||||
LIGHT_GREY = '\x1b[0;30m'
|
||||
LIGHT_RED = '\x1b[0;31m'
|
||||
LIGHT_GREEN = '\x1b[0;32m'
|
||||
LIGHT_YELLOW = '\x1b[0;33m'
|
||||
LIGHT_BLUE = '\x1b[0;34m'
|
||||
LIGHT_MAGENTA = '\x1b[0;35m'
|
||||
LIGHT_CYAN = '\x1b[0;36m'
|
||||
LIGHT_WHITE = '\x1b[0;37m'
|
||||
|
||||
|
||||
def clr(color, text):
|
||||
return color + str(text) + '\x1b[0m'
|
||||
|
||||
def remove_float_support():
|
||||
flags = " ".join(env['LINKFLAGS'])
|
||||
print(clr(Color.BLUE, "** LINKFLAGS = %ss" % flags))
|
||||
flags = flags.replace("-u _printf_float", "")
|
||||
flags = flags.replace("-u _scanf_float", "")
|
||||
newflags = flags.split()
|
||||
|
||||
env.Replace(
|
||||
LINKFLAGS=newflags
|
||||
)
|
||||
|
||||
remove_float_support()
|
||||
@@ -4,10 +4,25 @@ import os
|
||||
import re
|
||||
Import("env")
|
||||
|
||||
def build_web(source, target, env):
|
||||
print("\n** Build web...")
|
||||
call(["gulp", "-f", os.getcwd()+"/tools/webfilesbuilder/gulpfile.js"])
|
||||
def build_web():
|
||||
print("** Building web...")
|
||||
env.Execute(
|
||||
"node ./tools/webfilesbuilder/node_modules/gulp/bin/gulp.js --cwd ./tools/webfilesbuilder")
|
||||
|
||||
def code_check(source, target, env):
|
||||
print("** Starting cppcheck...")
|
||||
call(["cppcheck", os.getcwd()+"/.", "--force", "--enable=all"])
|
||||
print("\n** Finished cppcheck...\n")
|
||||
print("\n** Starting cpplint...")
|
||||
call(["cpplint", "--extensions=ino,cpp,h", "--filter=-legal/copyright,-build/include,-whitespace",
|
||||
"--linelength=120", "--recursive", "src", "lib/myESP"])
|
||||
print("\n** Finished cpplint...")
|
||||
|
||||
|
||||
# build web files
|
||||
build_web()
|
||||
|
||||
# extract application details
|
||||
bag = {}
|
||||
exprs = [
|
||||
(re.compile(r'^#define APP_VERSION\s+"(\S+)"'), 'app_version'),
|
||||
@@ -31,16 +46,9 @@ with open('./src/ems-esp.cpp', 'r') as f:
|
||||
app_version = bag.get('app_version')
|
||||
app_name = bag.get('app_name')
|
||||
app_hostname = bag.get('app_hostname')
|
||||
|
||||
board = env['BOARD']
|
||||
branch = env['PIOENV']
|
||||
|
||||
# build the web files
|
||||
env.AddPreAction("buildprog", build_web)
|
||||
|
||||
# build filename, replacing . with _ for the version
|
||||
#env.Replace(PROGNAME="firmware_%s" % branch + "_" + app_version.replace(".", "_"))
|
||||
#env.Replace(PROGNAME=app_name + "-" + app_version.replace(".", "_") + "-" + board + "-" + branch)
|
||||
env.Replace(PROGNAME=app_name + "-" + app_version.replace(".", "_") + "-" + board)
|
||||
|
||||
|
||||
env.Replace(PROGNAME=app_name + "-" +
|
||||
app_version.replace(".", "_") + "-" + board)
|
||||
Reference in New Issue
Block a user