mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 20:10:08 +03:00
Quicker compilation for frsky firmware
This commit is contained in:
parent
bf1ca19914
commit
0f8688edab
1 changed files with 7 additions and 6 deletions
|
@ -5,6 +5,7 @@ import datetime
|
||||||
import os
|
import os
|
||||||
from builtins import NotADirectoryError
|
from builtins import NotADirectoryError
|
||||||
import shutil
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -27,23 +28,23 @@ def timestamp():
|
||||||
|
|
||||||
def build(board, srcdir):
|
def build(board, srcdir):
|
||||||
cmake_options = " ".join(["-D%s=%s" % (key, value) for key, value in options[board].items()])
|
cmake_options = " ".join(["-D%s=%s" % (key, value) for key, value in options[board].items()])
|
||||||
shutil.rmtree("build", ignore_errors=True)
|
cwd = os.getcwd()
|
||||||
os.mkdir("build")
|
|
||||||
if not os.path.exists("output"):
|
if not os.path.exists("output"):
|
||||||
os.mkdir("output")
|
os.mkdir("output")
|
||||||
os.chdir("build")
|
path = tempfile.mkdtemp()
|
||||||
|
os.chdir(path)
|
||||||
os.system("cmake -DPCB=%s %s %s" % (board, cmake_options, srcdir))
|
os.system("cmake -DPCB=%s %s %s" % (board, cmake_options, srcdir))
|
||||||
os.system("make firmware -j6")
|
os.system("make firmware -j6")
|
||||||
os.chdir("..")
|
os.chdir(cwd)
|
||||||
index = 0
|
index = 0
|
||||||
while 1:
|
while 1:
|
||||||
suffix = "" if index == 0 else "_%d" % index
|
suffix = "" if index == 0 else "_%d" % index
|
||||||
filename = "output/firmware_%s_%s%s.bin" % (board.lower(), timestamp(), suffix)
|
filename = "output/firmware_%s_%s%s.bin" % (board.lower(), timestamp(), suffix)
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
os.rename("build/firmware.bin", filename)
|
shutil.copy("%s/firmware.bin" % path, filename)
|
||||||
break
|
break
|
||||||
index += 1
|
index += 1
|
||||||
shutil.rmtree("build")
|
shutil.rmtree(path)
|
||||||
|
|
||||||
|
|
||||||
def dir_path(string):
|
def dir_path(string):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue