Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
4d6f220a
Commit
4d6f220a
authored
Sep 26, 2023
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python/build/cmake: write toolchain file only if cross-compiling
parent
0ffbe5b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
cmake.py
python/build/cmake.py
+18
-15
No files found.
python/build/cmake.py
View file @
4d6f220a
...
...
@@ -56,35 +56,38 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
"""
)
def
configure
(
toolchain
:
AnyToolchain
,
src
:
str
,
build
:
str
,
args
:
list
[
str
]
=
[],
env
:
Optional
[
Mapping
[
str
,
str
]]
=
None
)
->
None
:
cross_args
=
[]
cross_args
:
list
[
str
]
=
[]
if
toolchain
.
is_windows
:
cross_args
.
append
(
'-DCMAKE_RC_COMPILER='
+
cast
(
str
,
toolchain
.
windres
))
# Several targets need a sysroot to prevent pkg-config from
# looking for libraries on the build host (TODO: fix this
# properly); but we must not do that on Android because the NDK
# has a sysroot already
if
not
toolchain
.
is_android
and
not
toolchain
.
is_darwin
:
cross_args
.
append
(
'-DCMAKE_SYSROOT='
+
toolchain
.
install_prefix
)
os
.
makedirs
(
build
,
exist_ok
=
True
)
cmake_toolchain_file
=
os
.
path
.
join
(
build
,
'cmake_toolchain_file'
)
with
open
(
cmake_toolchain_file
,
'w'
)
as
f
:
__write_cmake_toolchain_file
(
f
,
toolchain
)
configure
=
[
'cmake'
,
src
,
'-DCMAKE_TOOLCHAIN_FILE='
+
cmake_toolchain_file
,
'-DCMAKE_INSTALL_PREFIX='
+
toolchain
.
install_prefix
,
'-DCMAKE_BUILD_TYPE=release'
,
'-GNinja'
,
]
+
cross_args
+
args
if
toolchain
.
host_triplet
is
not
None
:
# cross-compiling: write a toolchain file
os
.
makedirs
(
build
,
exist_ok
=
True
)
# Several targets need a sysroot to prevent pkg-config from
# looking for libraries on the build host (TODO: fix this
# properly); but we must not do that on Android because the NDK
# has a sysroot already
if
not
toolchain
.
is_android
and
not
toolchain
.
is_darwin
:
cross_args
.
append
(
'-DCMAKE_SYSROOT='
+
toolchain
.
install_prefix
)
cmake_toolchain_file
=
os
.
path
.
join
(
build
,
'cmake_toolchain_file'
)
with
open
(
cmake_toolchain_file
,
'w'
)
as
f
:
__write_cmake_toolchain_file
(
f
,
toolchain
)
configure
.
append
(
'-DCMAKE_TOOLCHAIN_FILE='
+
cmake_toolchain_file
)
if
env
is
None
:
env
=
toolchain
.
env
else
:
...
...
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