From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Project out of sources compilation Date: Sun, 17 Mar 2024 18:33:21 +0100 Message-ID: References: <4wwljrdnra3bsloehioa46y24ozxajajmvf2elvskxxq3mhtg2.ref@pyv2z5snot6h> <4wwljrdnra3bsloehioa46y24ozxajajmvf2elvskxxq3mhtg2@pyv2z5snot6h> <5e04b699-6a0a-45ef-92cc-2115b58a869e@gutov.dev> <9098131B-AFBE-4978-B679-4C1D5507F55E@aol.com> <865xxl5jrq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30244"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 17 18:34:01 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rluOW-0007aI-SO for ged-emacs-devel@m.gmane-mx.org; Sun, 17 Mar 2024 18:34:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rluO8-0005NR-Je; Sun, 17 Mar 2024 13:33:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rluO5-0005Mt-LU for emacs-devel@gnu.org; Sun, 17 Mar 2024 13:33:33 -0400 Original-Received: from sonic305-2.consmr.mail.bf2.yahoo.com ([74.6.133.41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rluO3-00055T-2a for emacs-devel@gnu.org; Sun, 17 Mar 2024 13:33:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1710696806; bh=DvoZXmoQAfVziBuyWcxzPsW/k513J9AZE+SkLsqXm+8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=QwSOweX1AZj62VCMiKosEduXqAdLikPZx4an92qnf0XRY4ITOCHerh+mMztwHVx5VtHO7Y6LZf9totzdUh0U7omgx5FeIvos4GjPZJsrNdeIjruhevtgLoEY6YZP5Bm2o8ifzH6Y7Xno+whrHwyOPZ7LWmmUPPELac19HckV+BxdxpiLz3xeTvXLLTan0VXRrGNctmyTYNq7Z+85pXPcjMcW8mS4XfGwiQF8Ak9pDWYXWm0MNfB3qS6FWXRxlXH8KlcnW0L65R2kIHLCa6rGS05XhXpL1+h8swUaT6bxksZ2UPeOY/Hq6kKiO1ejK3mKNXoXk4Ftt5Y3OD7foSFRUQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1710696806; bh=tdf1tGf6Lvb/vkAG9HuqTC6ykFDC/nZmysxfpazdRo1=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=lVmw73AgjfBOT0qO2OHqyvqsZmNAVPn54WcJ4OewvEdu3Ku9keURtM1SZvBtx3YOYW73T6P9wfpmRH2nKsscoM+tHV85+gvaEQ8wh/uCNbJa3bMTnhrUagEAqr6i74Qkv8YG5sop+TvfDFTBiserKvsjEkR4FBGp3FZnaudee3z8JLTa4QN7CIDnK6ky7nAy4WVGZISHcehj3UFeQeisTU2M3i/WN1ThO9vc/tTVxFwIbtHnh3dR9N6mO8Nqe39J7LzZCPl50rR0oq/2nF3rXc3C7kWM1CzSq01f7gjnCWXCeczFPrj7eBTfrCpnZed6xoRZImLjkpJxbczrzTnKIw== X-YMail-OSG: nboMHBgVM1nPPajJNOb3ZN43zGrBsqCoKlDhQvji69gKNrBLZvYhFAjcMaFNzkn SvGqdxrm5hwdGlrsIhxokPYJdgVPXEY_5JmlrlBtuTgOw6d1csHLZWzZHA3yCfxroBq7pHxjRKrh 1CbCzOlrjFEkU.qvrd2dEePzGl0m9bWdvvNf_xP4YIR1tpztarx3IUIiPQ7nOX5BoLthXGR.mLGj 4nr1XDNPE5DUM1Ch9VZP9VSk3im1V3SKvc515QM9nU5odP9qKd1EoFKzv_W3sPDewwvXZoYMwnx. vGRp_edyLau4bb2QYQWctYggsCdty85Lu9GB2Cj8E5gbbRceQhON4oB3oY0qlTkjSLtocfh29x4u d48RpmkVwTIkDSnlJFepotvAm7b6aNMiQfOJ.C0xSt6lnR18sjWWg4hiAo1xjvnxaafvoxFwEsAI UtrqyXRIoGa3ECk.jqvj781rshHzVd3VjEH2jfogNJ9_jGC05hSwFl9soGkvP1.NQYnBC4qLYimi VIjf6hkPLZ1.108rgucPaFRdaCXmX4epfYuOOj0Et4V4.CM8NXxzbnYmngI8N1VDbU2yYGqKVPOX ok.FscA_M1.ANuVuUiJ6szRLEwqZT1wrAEAzIqbgtL7r7tt3s9ykJwvVdGnsQ2HrOxe8B3ad.4EW F7ASUw2fkeeBwOqhZIsfDujjfqBGeg.3HGTsq623OUAwNNeFYj4qZt8yHd9sLoHKM68sL1tcUvqT FEjGmWu_PH8Dk6vqh.lmuWwGJ3HsT8ZM6igUZqsIhG7lYgJa3VjOYBkxfb5wK_eg9q74KYcOsPW2 p4.yUp6WU7kYp_XzzbKQ5jHfPZiN0SN6B2I3OucYxK X-Sonic-MF: X-Sonic-ID: 0209a582-8240-42b2-b31b-f248710e7990 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Sun, 17 Mar 2024 17:33:26 +0000 Original-Received: by hermes--production-ir2-7bc88bfc75-h6nxx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9789231200c72516e3d3514d561b59a6; Sun, 17 Mar 2024 17:33:23 +0000 (UTC) Content-Disposition: inline In-Reply-To: <865xxl5jrq.fsf@gnu.org> X-Mailer: WebService/1.1.22129 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.133.41; envelope-from=spacibba@aol.com; helo=sonic305-2.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317141 Archived-At: On Sun, Mar 17, 2024 at 10:45:29AM +0200, Eli Zaretskii wrote: >> Date: Sun, 17 Mar 2024 08:22:56 +0100 >> From: Ergus >> >> > >> >project.el has just one, very simple command, where the only thing that it does it switch to the root first. How will you customize it? With a hook, where the user would write a function "determine a directory for compilation"? They might as well define a new command - or redefine this one. Or just an option with relative directory name? >> > >> >> IMO the only thing we need is probably a variable/custom like project-build-dir. The user can define it in the dir-locals and the project command will use it if defined/ else use project-root. Maybe the backend could initialize it. >> >> Alternatively (and not totally exclusive) project.el could define a project-build-dir function that project backends could optionally redefine (i.e I use a plist as project id in gags-mode and getting any stored property from there is very easy with a command). By default it will be an alias for project-root in the VC backend. > >Maybe I'm missing something, but isn't the build tree just one more >tree that is part of the project? If so, can't you use >project-external-roots to add this tree to the project? I thought >this was the mechanism to add trees to a project as included in the >original design of project.el and its support in Emacs? > >> There is also some need for a 'bin' dir, that is, where the final executable will reside, useful to execute and debug with tools like gud and independent from 'build'... For example in a python project this may be the project root OR where the file with __main__ resides, but a python project usually won't specify a build dir. But let's go for one thing at a time. > >Likewise here. > >Or what am I missing? Hi Eli: More or less we have it, that's why I said that there was just some (small) missing pieces. We have the `project-external-roots`, but project.el uses them only to find files and regexps. So it looks like they are intended to be source places somehow. The compile or debug programs doesn't know that they are intended to execute there. However, a `build` or `bin` are different because they are where the `compile` or `gud` are intended to run; generally not a place to search for sources (unless the source is generated like config.h). Two examples: ``` git clone emacs cd emacs mkdir build # or mybuild, build_debug.. any name ./autogen.sh # (this is intendedto happen in the root) cd build ../configure options // This creates a Makefile make make install ``` On cmake ``` git clone project cd project // Creates a CMakeCache.txt Alternative 1 cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=true -DCMAKE_BUILD_TYPE=Debug -B build/ cd build Alternative 2 mkdir build cd build cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=true -DCMAKE_BUILD_TYPE=Debug .. make make install ``` The pattern is pretty much the same, so it is pretty simple to allow projects.el to simplify the generation-compilation-execution-debug workflow. And with autotools+cmake we are probably covering a huge range of projects around. Best, Ergus