Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanli
evm-store
Commits
97cfe161
Commit
97cfe161
authored
Nov 10, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🌈
style: 新增qmake工程构建工具
parent
3cb3d82a
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
477 additions
and
0 deletions
+477
-0
backend/utils/qmake_pris.py
backend/utils/qmake_pris.py
+144
-0
backend/utils/qmake_pro.py
backend/utils/qmake_pro.py
+333
-0
No files found.
backend/utils/qmake_pris.py
0 → 100644
View file @
97cfe161
import
os
import
json
import
platform
from
pathlib
import
Path
project
=
{
"name"
:
"evue-awtk"
,
# xxx.pro,
"modules"
:
{
"crane_lvgl_W31/external/zlib"
:
""
,
"crane_lvgl_W31/external/libpng"
:
""
,
"crane_lvgl_W31/external/libjpeg-turbo"
:
""
,
"crane_lvgl_W31/external/libqrencode"
:
""
,
"crane_lvgl_W31/gui/lv_watch"
:
""
,
"crane_lvgl_W31/gui/lv_drivers"
:
""
,
"ecma/src"
:
"ecma"
}
}
def
get_module_name
(
path
):
for
key
in
project
.
get
(
"modules"
):
if
Path
(
path
)
.
as_posix
()
.
find
(
key
)
>=
0
:
result
=
key
.
split
(
"/"
)[
-
1
]
if
len
(
project
.
get
(
"modules"
)
.
get
(
key
))
>
0
:
result
=
project
.
get
(
"modules"
)
.
get
(
key
)
return
result
return
Path
(
path
)
.
as_posix
()
.
split
(
"/"
)[
-
1
]
def
gen_pro_from_build_log
(
projectname
,
root_dir
,
filename
,
output_dir
):
source_path
=
Path
(
filename
)
target_path
=
Path
(
output_dir
)
with
open
(
source_path
.
as_posix
(),
"r"
,
encoding
=
"utf-8"
)
as
f
:
lines
=
f
.
readlines
()
gccLines
=
[
l
for
l
in
lines
if
l
.
find
(
"-o"
)
>=
0
]
pris
=
{}
defs
=
""
# define
incs
=
""
# include
lnks
=
""
# link
pri_files
=
[]
srcs
=
"SOURCES +=
\\\n
"
ss
=
"$$PWD/../"
# 相对路径的问题
tmp
=
""
pro_relative_path
=
"$$PWD/"
parent_path
=
Path
(
output_dir
)
while
Path
(
root_dir
)
.
absolute
()
.
as_posix
()
!=
parent_path
.
absolute
()
.
as_posix
():
tmp
+=
"../"
pro_relative_path
+=
"../"
parent_path
=
parent_path
.
parent
# print("tmp ========>", tmp)
ss
+=
tmp
for
l
in
gccLines
:
options
=
l
.
split
(
' '
)
name
=
options
[
-
1
]
.
split
(
"
\\
"
)[
-
1
]
path
=
options
[
-
1
][:
-
len
(
name
)]
defines
=
[]
includes
=
[]
links
=
[]
for
d
in
options
:
if
d
.
startswith
(
"-D"
):
defines
.
append
(
d
[
2
:])
if
d
.
startswith
(
"-I"
):
includes
.
append
(
d
[
2
:])
if
d
.
startswith
(
"-l"
)
or
d
.
startswith
(
"-L"
):
links
.
append
(
d
)
if
path
not
in
pris
:
pris
[
path
]
=
[]
pris
[
path
]
.
append
({
'name'
:
name
,
'fullpath'
:
Path
(
options
[
-
1
]
.
replace
(
"
\n
"
,
""
))
.
as_posix
()
})
if
defs
==
""
:
for
d
in
defines
:
defs
+=
"DEFINES += "
+
d
+
"
\n
"
if
incs
==
""
:
for
i
in
includes
:
incs
+=
"INCLUDEPATH += "
+
pro_relative_path
+
i
+
"
\n
"
if
lnks
==
""
:
for
i
in
links
:
lnks
+=
"LIBS += "
+
i
+
"
\n
"
with
open
(
"a.json"
,
"w+"
)
as
f
:
f
.
write
(
json
.
dumps
(
pris
))
for
key
in
pris
:
if
len
(
key
)
<=
0
:
continue
for
d
in
pris
[
key
]:
fn
=
get_module_name
(
key
)
+
".pri"
print
(
d
[
"fullpath"
],
" <=====> "
,
fn
)
if
fn
not
in
pri_files
:
pri_files
.
append
(
fn
)
if
not
target_path
.
joinpath
(
"pris"
)
.
exists
():
os
.
makedirs
(
target_path
.
joinpath
(
"pris"
)
.
absolute
()
.
as_posix
())
if
not
target_path
.
joinpath
(
"pris"
)
.
joinpath
(
fn
)
.
exists
():
with
open
(
target_path
.
joinpath
(
"pris"
)
.
joinpath
(
fn
)
.
absolute
()
.
as_posix
(),
"w+"
)
as
f
:
f
.
write
(
srcs
+
" "
*
(
len
(
srcs
)
-
4
)
+
ss
+
d
[
"fullpath"
]
+
"
\\\n
"
)
else
:
with
open
(
target_path
.
joinpath
(
"pris"
)
.
joinpath
(
fn
)
.
absolute
()
.
as_posix
(),
"a+"
)
as
f
:
f
.
write
(
" "
*
(
len
(
srcs
)
-
4
)
+
ss
+
d
[
"fullpath"
]
+
"
\\\n
"
)
target_name
=
projectname
.
split
(
"
\\
"
)[
-
1
]
.
replace
(
".log"
,
""
)
.
replace
(
".exe"
,
""
)
pro_file
=
target_path
.
joinpath
(
"{}.pro"
.
format
(
target_name
))
.
absolute
()
.
as_posix
()
with
open
(
pro_file
,
"w+"
)
as
f
:
f
.
write
(
'''
TEMPLATE = app
TARGET = {}
CONFIG -= app_bundle
CONFIG -= qt
\n
'''
.
format
(
target_name
))
f
.
write
(
"
\n
{}
\n\n
{}
\n\n
{}
\n\n
"
.
format
(
lnks
,
defs
,
incs
))
for
aa
in
pri_files
:
f
.
write
(
"include(pris/{})"
.
format
(
aa
)
+
"
\n
"
)
return
pro_file
if
__name__
==
"__main__"
:
# root_dir = "./"
# output_dir = "build_log"
# tmp = "$$PWD/"
# parent_path = Path(output_dir)
# while Path(root_dir).absolute().as_posix() != parent_path.absolute().as_posix():
# tmp += "../"
# parent_path = parent_path.parent
# print(parent_path.absolute().as_posix())
# print("tmp ========>", tmp)
gen_pro_from_build_log
(
"evue-awtk"
,
"."
,
"./build.log"
,
"project"
)
\ No newline at end of file
backend/utils/qmake_pro.py
0 → 100644
View file @
97cfe161
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment