我有一个GPR库项目wichi成功构建(静态或动态类型在这里不相关)。我知道gprinstall提供了管理库交付的方法,即:
这背后的想法是让用户只使用新的GPR来查看接口文件(例如在Ada中的.ads)。
然而,我不能设法让gprinstall发挥作用。以下命令
E:\DEV\Projets\Ada\LibA>gprinstall --dry-run -p -m -f -P LibA.gpr只提供:
Install project LibA-v详细选项不会给出一小部分线索。(该项目显然已经成功构建,代码文件与理解并不真正相关)
这是我的探地雷达档案:
with "../Production_Options/Production_Options.gpr";
with "../InterfaceA/InterfaceA.gpr";
library project LibA is
for Source_Dirs use ("src") & InterfaceA.Interface_Files;
for Object_Dir use "obj";
for Library_Name use project'Name;
for Library_Dir use "Library";
for Library_Ali_Dir use "Library_Ali";
for Library_Src_Dir use "Public_Interfaces";
for Library_Interface use (InterfaceA.Interface_Name);
for Library_Kind use "static";
package Install extends Production_Options.Install is
for Prefix use Production_Options.Install'Prefix & Production_Options.Install.Install_Libs & project'Name;
for Mode use "dev";
for Side_Debug use "true";
end Install;
-- various renames of Productions_Options
end LibA;
project InterfaceA is
Interface_Files := (project'Project_Dir & "src");
Interface_Name := "InterfaceA";
for Source_Dirs use ();
end InterfaceA;我的选择探地雷达:
project Production_Options is
for Source_Dirs use ();
-- various switches for compiler, builder, clean, binder, ide, linker, namling, pretty printer ...
package Install is
Install_Root := "../INSTALL_BUILDS/";
Install_Exe := "EXECUTABLES/";
Install_Libs := "LIBS/";
Install_Root_Exe := Install_Root & Install_Exe;
Install_Root_Libs := Install_Root & Install_Libs;
for Prefix use Install_Root;
for Lib_Subdir use "BIN";
for Ali_Subdir use "ALI";
for Sources_Subdir use "SRC";
for Project_Subdir use "GPR";
end Install;
end Production_Options;发布于 2018-05-21 01:58:50
在使用了Install包选项和命令行之后,我终于意识到了以下几点:
for Mode use "dev"选项使gprinstall工具完全麻木。起初,我在Adacore (manager.html#installing-a-library-with-project-files)上找不到这方面的可靠文档,但是这里没有什么更清楚的地方-- tools.html#installing-with-gprinstall-a)。您可以使用命令行开关-m来更改这一点。Install_Root := "../INSTALL_BUILDS/";中指示的文件夹(由于环境变量:PATH=E:\DEV\GNAT\2017\bin;...)。用这些GPRs:
library project LibA is
for Source_Dirs use ("src") & InterfaceA.Interface_Files;
for Object_Dir use "obj";
for Library_Name use project'Name;
for Library_Dir use "Library";
for Library_Ali_Dir use "Library_Ali";
for Library_Src_Dir use "Public_Interfaces";
for Library_Interface use (InterfaceA.Interface_Name);
for Library_Kind use "static";
package Install extends Production_Options.Install is
for Prefix use Production_Options.Install.Install_Root_Libs;
-- makes gprinstall silent and numb in --dry-run mode ?!
-- for Mode use "dev";
for Side_Debug use "true";
end Install;
-- various renames of Productions_Options
end LibA;
project Production_Options is
package Install is
Install_Root := project'Project_Dir & "../INSTALL_BUILDS/";
Install_Exe := "EXECUTABLES/";
Install_Libs := "LIBS/";
Install_Root_Exe := Install_Root & Install_Exe;
Install_Root_Libs := Install_Root & Install_Libs;
for Prefix use Install_Root;
for Exec_Subdir use "EXE";
for Lib_Subdir use "BIN";
for Ali_Subdir use "ALI";
for Sources_Subdir use "SRC";
for Project_Subdir use "GPR";
--
-- | with my settings: |_INSTALL_BUILDS
-- |_Prefix |_LIBS
-- |_Exec_Subdir |_Exec_Subdir
-- |_liba |_liba would contain exe if it was an exe project
-- |_Lib_Subdir |_Lib_Subdir
-- |_liba |_liba contains the .a file
-- |_Ali_Subdir |_Ali_Subdir
-- |_liba |_liba contains the ali files
-- |_Sources_Subdir |_Sources_Subdir
-- |_liba |_liba contains the src files
end Install;
end Production_Options;命令gprinstall -m --dry-run -p -f -P LibA.gpr现在正常工作。
下面是您可能获得的输出:
E:\DEV\Projets\Ada\LibA>gprinstall -d -m -p -f -P LibA.gpr
Install project LibA
cp E:\DEV\Projets\Ada\InterfaceA\src\InterfaceA.ads E:\DEV\GNAT\INSTALL_BUILDS\LIBS\SRC\liba\interfacea.ads
cp E:\DEV\Projets\Ada\LibA\Library_Ali\interfacea.ali E:\DEV\GNAT\INSTALL_BUILDS\LIBS\ALI\liba\interfacea.ali
cp E:\DEV\Projets\Ada\LibA\Library\libliba.a E:\DEV\GNAT\INSTALL_BUILDS\LIBS\BIN\liba\libliba.a
Project E:\DEV\GNAT\INSTALL_BUILDS\LIBS\GPR\liba\LibA.gpr would be installed
-- This project has been generated by GPRINSTALL GPL 2017 (20170515) (i686-pc-mingw32)
library project LibA is
type BUILD_KIND is ("default");
BUILD : BUILD_KIND := external("LIBA_BUILD", "default");
for Languages use ("Ada");
case BUILD is
when "default" =>
for Source_Dirs use ("../SRC/");
for Library_Dir use "../BIN/";
for Library_ALI_Dir use "../ALI/";
for Library_Kind use "static";
for Library_Interface use ("interfacea");
end case;
for Library_Name use "liba";
package Naming is
for dot_replacement use "-";
for casing use "MixedCase";
case BUILD is
when "default" =>
for body_suffix ("ada") use ".adb";
for spec_suffix ("ada") use ".ads";
end case;
end Naming;
package Linker is
case BUILD is
when "default" =>
null;
end case;
end Linker;
package Install is
for Active use "False";
end Install;
for Externally_Built use "True";
end LibA;完整的源代码可以在这里找到:https://github.com/LoneWanderer-GH/Samples-GPR-Aggregate-Libs
https://stackoverflow.com/questions/50441066
复制相似问题