Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.extension
Commits
b2e6c0e7
Commit
b2e6c0e7
authored
May 16, 2014
by
André Anjos
💬
Browse files
Filter isystem includes smartly
parent
330dc752
Changes
1
Hide whitespace changes
Inline
Side-by-side
xbob/extension/__init__.py
View file @
b2e6c0e7
...
...
@@ -94,6 +94,25 @@ def generate_self_macros(extname, version):
return
retval
def
reorganize_isystem
(
args
):
"""Re-organizes the -isystem includes so that more specific paths come first"""
remainder
=
[]
includes
=
[]
iterable
=
iter
(
args
)
for
k
in
iterable
:
if
k
in
(
'-isystem'
,):
k
=
iterable
.
next
()
includes
.
append
(
k
)
else
:
remainder
.
append
(
k
)
includes
=
uniq
(
includes
[::
-
1
])[::
-
1
]
retval
=
[
tuple
(
remainder
)]
+
[(
'-isystem'
,
k
)
for
k
in
includes
]
from
itertools
import
chain
return
list
(
chain
.
from_iterable
(
retval
))
class
Extension
(
DistutilsExtension
):
"""Extension building with pkg-config packages.
...
...
@@ -247,6 +266,9 @@ class Extension(DistutilsExtension):
# Uniq'fy parameters that are not on our parameter list
kwargs
[
'include_dirs'
]
=
uniq
(
kwargs
[
'include_dirs'
])
# Stream-line '-isystem' includes
kwargs
[
'extra_compile_args'
]
=
reorganize_isystem
(
kwargs
[
'extra_compile_args'
])
# Make sure the language is correctly set to C++
kwargs
[
'language'
]
=
'c++'
...
...
Write
Preview
Supports
Markdown
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