From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Example Ada calling Gnu Scientific Library (GSL) Date: Mon, 10 Apr 2017 18:43:22 +0100 Organization: A noiseless patient Spider Message-ID: References: <2b035819-e55e-4805-9ff1-a2cec09f13e0@googlegroups.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: mx02.eternal-september.org; posting-host="733ebcbcb2ddc652667a098546bc9ca3"; logging-data="25230"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+v2Hrz6CH1bw2lN3G+eRMuFfSYyRaqXf0=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:EsNB233S7N3wNSJp5wWoxgB2cU0= sha1:CWJMTYZdaCSkgG5iUUfg+OLvOeM= Xref: news.eternal-september.org comp.lang.ada:46566 Date: 2017-04-10T18:43:22+01:00 List-Id: --=-=-= Content-Type: text/plain hreba writes: > On 04/10/2017 11:47 AM, Dmitry A. Kazakov wrote: >> >> You also seem confuse project to build and project to use a library. >> They are not same! For a bindings library you need both. >> > > I don't understand that. If you're building a library project, you have to specify all sorts of things - particularly the compiler options, but you might for example have multiple source directories. Once the project has been built, this sort of thing isn't needed, you can use a different GPR to present just what's needed to use the library. Indeed, you can write an externally-built library GPR for a completely external library. If you're going to install the built library, the tool gprinstall knows what to do and will generate the necessary externally-built library GPR for you. But if you don't want to install the built library, your projects can just use the GPR you used for building it. I'm not quite sure what to do when using a two-layer library like your GSL binding! You can see a Makefile and GPR (complicated, I know) at https://sourceforge.net/p/gnatutil/code/ci/default/tree/ . The resulting installed GPR is --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=gnat_util.gpr Content-Description: gnat_util.gpr -- This project has been generated by GPRINSTALL Pro 17.0w (20150615) (x86_64-apple-darwin15) library project Gnat_Util is type BUILD_KIND is ("static", "relocatable"); BUILD : BUILD_KIND := external("LIBRARY_TYPE", "static"); for Languages use ("Ada", "C"); case BUILD is when "relocatable" => for Source_Dirs use ("../../include/gnat_util/gnat_util.relocatable"); for Library_Dir use "../gnat_util/gnat_util.relocatable"; for Library_Kind use "relocatable"; when "static" => for Source_Dirs use ("../../include/gnat_util/gnat_util.static"); for Library_Dir use "../gnat_util/gnat_util.static"; for Library_Kind use "static"; end case; for Library_Name use "gnat_util"; package Naming is for dot_replacement use "-"; for casing use "lowercase"; case BUILD is when "relocatable" => for body_suffix ("ada") use ".adb"; for body_suffix ("c") use ".c"; for spec_suffix ("ada") use ".ads"; for spec_suffix ("c") use ".h"; when "static" => for body_suffix ("ada") use ".adb"; for body_suffix ("c") use ".c"; for spec_suffix ("ada") use ".ads"; for spec_suffix ("c") use ".h"; end case; end Naming; package Linker is case BUILD is when "relocatable" => null; when "static" => null; end case; end Linker; package Install is for Active use "False"; end Install; for Externally_Built use "True"; type Library_T is ("static", "relocatable"); library_type : library_t := "static"; end Gnat_Util; --=-=-=--