Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
05c70424
Commit
05c70424
authored
Oct 29, 2013
by
Nils Gladitz
Committed by
Brad King
Oct 31, 2013
Browse files
Ninja: run custom commands through launcher if available
parent
1665721c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/cmLocalNinjaGenerator.cxx
View file @
05c70424
...
...
@@ -318,9 +318,13 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc,
cdCmd
<<
cdStr
<<
this
->
ConvertToOutputFormat
(
wd
,
SHELL
);
cmdLines
.
push_back
(
cdCmd
.
str
());
}
std
::
string
launcher
=
this
->
MakeCustomLauncher
(
*
cc
);
for
(
unsigned
i
=
0
;
i
!=
ccg
.
GetNumberOfCommands
();
++
i
)
{
cmdLines
.
push_back
(
this
->
ConvertToOutputFormat
(
ccg
.
GetCommand
(
i
).
c_str
(),
SHELL
));
cmdLines
.
push_back
(
launcher
+
this
->
ConvertToOutputFormat
(
ccg
.
GetCommand
(
i
).
c_str
(),
SHELL
));
std
::
string
&
cmd
=
cmdLines
.
back
();
ccg
.
AppendArguments
(
i
,
cmd
);
}
...
...
@@ -407,3 +411,39 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
this
->
WriteCustomCommandBuildStatement
(
i
->
first
,
ccTargetDeps
);
}
}
std
::
string
cmLocalNinjaGenerator
::
MakeCustomLauncher
(
const
cmCustomCommand
&
cc
)
{
const
char
*
property
=
"RULE_LAUNCH_CUSTOM"
;
const
char
*
property_value
=
this
->
Makefile
->
GetProperty
(
property
);
if
(
!
property_value
||
!*
property_value
)
{
return
std
::
string
();
}
// Expand rules in the empty string. It may insert the launcher and
// perform replacements.
RuleVariables
vars
;
vars
.
RuleLauncher
=
property
;
std
::
string
output
;
const
std
::
vector
<
std
::
string
>&
outputs
=
cc
.
GetOutputs
();
if
(
!
outputs
.
empty
())
{
RelativeRoot
relative_root
=
cc
.
GetWorkingDirectory
()
?
NONE
:
START_OUTPUT
;
output
=
this
->
Convert
(
outputs
[
0
].
c_str
(),
relative_root
,
SHELL
);
}
vars
.
Output
=
output
.
c_str
();
std
::
string
launcher
;
this
->
ExpandRuleVariables
(
launcher
,
vars
);
if
(
!
launcher
.
empty
())
{
launcher
+=
" "
;
}
return
launcher
;
}
Source/cmLocalNinjaGenerator.h
View file @
05c70424
...
...
@@ -121,6 +121,7 @@ private:
void
WriteCustomCommandBuildStatements
();
std
::
string
MakeCustomLauncher
(
const
cmCustomCommand
&
cc
);
std
::
string
ConfigName
;
std
::
string
HomeRelativeOutputPath
;
...
...
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