In Adacore's GPR file, how can I set the compiler to exclude file with full path
I have a project which contains several files which have the same name but in differents folders.
Ex :
->sources
->src
- a.c
- b.c
->stub
- a.c
- z.c
In my gprfile I included the source with
for Source_Dirs use ( "sources/**" )
Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".
Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.
for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both
Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?
compilation ada gprbuild
add a comment |
I have a project which contains several files which have the same name but in differents folders.
Ex :
->sources
->src
- a.c
- b.c
->stub
- a.c
- z.c
In my gprfile I included the source with
for Source_Dirs use ( "sources/**" )
Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".
Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.
for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both
Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?
compilation ada gprbuild
add a comment |
I have a project which contains several files which have the same name but in differents folders.
Ex :
->sources
->src
- a.c
- b.c
->stub
- a.c
- z.c
In my gprfile I included the source with
for Source_Dirs use ( "sources/**" )
Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".
Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.
for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both
Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?
compilation ada gprbuild
I have a project which contains several files which have the same name but in differents folders.
Ex :
->sources
->src
- a.c
- b.c
->stub
- a.c
- z.c
In my gprfile I included the source with
for Source_Dirs use ( "sources/**" )
Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".
Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.
for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both
Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?
compilation ada gprbuild
compilation ada gprbuild
asked Nov 19 '18 at 15:18
LnlB
5310
5310
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c
project Stubbed extends "my_project.gpr" is
for Source_Dirs use ("stub");
end Stubbed;
You can read more about project extentions in the GPRBuild User Guide
add a comment |
I would use scenario variables; also, it sounds as though Excluded_Source_Dirs
would be useful.
type Source_T is ("normal", "stubbed");
Sources : Source_T := external ("SOURCES", "normal");
then either
for Source_Dirs use ("sources/**");
case Sources is
when "normal" =>
for Excluded_Source_Dirs use ("sources/stub");
when "stubbed" =>
for Excluded_Source_Dirs use ("sources/src");
end case;
or
for Source_Dirs use ("sources");
case Sources is
when "normal" =>
for Source_Dirs use project'Source_Dirs & "sources/src";
when "stubbed" =>
for Source_Dirs use project'Source_Dirs & "sources/stub";
end case;
In either case,
gprbuild -P prj
(you could add the defaulted -XSOURCES=normal
) or
gprbuild -P prj -XSOURCES=stubbed
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377655%2fin-adacores-gpr-file-how-can-i-set-the-compiler-to-exclude-file-with-full-path%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c
project Stubbed extends "my_project.gpr" is
for Source_Dirs use ("stub");
end Stubbed;
You can read more about project extentions in the GPRBuild User Guide
add a comment |
Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c
project Stubbed extends "my_project.gpr" is
for Source_Dirs use ("stub");
end Stubbed;
You can read more about project extentions in the GPRBuild User Guide
add a comment |
Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c
project Stubbed extends "my_project.gpr" is
for Source_Dirs use ("stub");
end Stubbed;
You can read more about project extentions in the GPRBuild User Guide
Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c
project Stubbed extends "my_project.gpr" is
for Source_Dirs use ("stub");
end Stubbed;
You can read more about project extentions in the GPRBuild User Guide
answered Nov 19 '18 at 15:28
egilhh
3,59211017
3,59211017
add a comment |
add a comment |
I would use scenario variables; also, it sounds as though Excluded_Source_Dirs
would be useful.
type Source_T is ("normal", "stubbed");
Sources : Source_T := external ("SOURCES", "normal");
then either
for Source_Dirs use ("sources/**");
case Sources is
when "normal" =>
for Excluded_Source_Dirs use ("sources/stub");
when "stubbed" =>
for Excluded_Source_Dirs use ("sources/src");
end case;
or
for Source_Dirs use ("sources");
case Sources is
when "normal" =>
for Source_Dirs use project'Source_Dirs & "sources/src";
when "stubbed" =>
for Source_Dirs use project'Source_Dirs & "sources/stub";
end case;
In either case,
gprbuild -P prj
(you could add the defaulted -XSOURCES=normal
) or
gprbuild -P prj -XSOURCES=stubbed
add a comment |
I would use scenario variables; also, it sounds as though Excluded_Source_Dirs
would be useful.
type Source_T is ("normal", "stubbed");
Sources : Source_T := external ("SOURCES", "normal");
then either
for Source_Dirs use ("sources/**");
case Sources is
when "normal" =>
for Excluded_Source_Dirs use ("sources/stub");
when "stubbed" =>
for Excluded_Source_Dirs use ("sources/src");
end case;
or
for Source_Dirs use ("sources");
case Sources is
when "normal" =>
for Source_Dirs use project'Source_Dirs & "sources/src";
when "stubbed" =>
for Source_Dirs use project'Source_Dirs & "sources/stub";
end case;
In either case,
gprbuild -P prj
(you could add the defaulted -XSOURCES=normal
) or
gprbuild -P prj -XSOURCES=stubbed
add a comment |
I would use scenario variables; also, it sounds as though Excluded_Source_Dirs
would be useful.
type Source_T is ("normal", "stubbed");
Sources : Source_T := external ("SOURCES", "normal");
then either
for Source_Dirs use ("sources/**");
case Sources is
when "normal" =>
for Excluded_Source_Dirs use ("sources/stub");
when "stubbed" =>
for Excluded_Source_Dirs use ("sources/src");
end case;
or
for Source_Dirs use ("sources");
case Sources is
when "normal" =>
for Source_Dirs use project'Source_Dirs & "sources/src";
when "stubbed" =>
for Source_Dirs use project'Source_Dirs & "sources/stub";
end case;
In either case,
gprbuild -P prj
(you could add the defaulted -XSOURCES=normal
) or
gprbuild -P prj -XSOURCES=stubbed
I would use scenario variables; also, it sounds as though Excluded_Source_Dirs
would be useful.
type Source_T is ("normal", "stubbed");
Sources : Source_T := external ("SOURCES", "normal");
then either
for Source_Dirs use ("sources/**");
case Sources is
when "normal" =>
for Excluded_Source_Dirs use ("sources/stub");
when "stubbed" =>
for Excluded_Source_Dirs use ("sources/src");
end case;
or
for Source_Dirs use ("sources");
case Sources is
when "normal" =>
for Source_Dirs use project'Source_Dirs & "sources/src";
when "stubbed" =>
for Source_Dirs use project'Source_Dirs & "sources/stub";
end case;
In either case,
gprbuild -P prj
(you could add the defaulted -XSOURCES=normal
) or
gprbuild -P prj -XSOURCES=stubbed
answered Nov 19 '18 at 16:32


Simon Wright
16.4k21836
16.4k21836
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377655%2fin-adacores-gpr-file-how-can-i-set-the-compiler-to-exclude-file-with-full-path%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown