From: Ergus <spacibba@aol.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dmitry@gutov.dev, emacs-devel@gnu.org
Subject: Re: Project out of sources compilation
Date: Sun, 17 Mar 2024 18:33:21 +0100 [thread overview]
Message-ID: <pvii3ssiwwfvnsbbvuhvhlendfc7r7i2cydnqi4x5c2xu6dv23@tb6d7yw6er3o> (raw)
In-Reply-To: <865xxl5jrq.fsf@gnu.org>
On Sun, Mar 17, 2024 at 10:45:29AM +0200, Eli Zaretskii wrote:
>> Date: Sun, 17 Mar 2024 08:22:56 +0100
>> From: Ergus <spacibba@aol.com>
>>
>> >
>> >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
next prev parent reply other threads:[~2024-03-17 17:33 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4wwljrdnra3bsloehioa46y24ozxajajmvf2elvskxxq3mhtg2.ref@pyv2z5snot6h>
2024-03-16 13:12 ` Project out of sources compilation Ergus
2024-03-16 16:50 ` Konstantin Kharlamov
2024-03-16 19:00 ` Ergus
2024-03-16 20:56 ` Konstantin Kharlamov
2024-03-17 2:53 ` Dmitry Gutov
2024-03-17 7:22 ` Ergus
2024-03-17 8:45 ` Eli Zaretskii
2024-03-17 17:33 ` Ergus [this message]
2024-03-17 17:38 ` Eli Zaretskii
2024-03-17 17:58 ` Ergus
2024-03-17 11:36 ` Augusto Stoffel
2024-03-17 17:47 ` Ergus
2024-03-19 18:36 ` Ergus
2024-03-27 16:38 ` [PATCH] " Ergus
2024-03-31 2:41 ` Dmitry Gutov
2024-03-31 21:07 ` Ergus
2024-04-01 7:49 ` Dirk-Jan C. Binnema
2024-04-01 13:52 ` Ergus
2024-04-01 15:09 ` Dirk-Jan C. Binnema
2024-04-01 17:18 ` Ergus
2024-04-02 23:23 ` Dmitry Gutov
2024-04-03 19:47 ` Ergus
2024-04-06 2:05 ` Ergus
2024-04-14 1:44 ` Dmitry Gutov
2024-04-16 14:56 ` Ergus
2024-04-22 17:05 ` Ergus
2024-04-22 18:48 ` Ergus
2024-04-22 21:20 ` Mohsin Kaleem
2024-04-23 15:17 ` Ergus
2024-04-23 19:26 ` Mohsin Kaleem
2024-04-26 0:47 ` Dmitry Gutov
2024-04-02 21:39 ` Richard Stallman
2024-04-02 22:43 ` Dr. Arne Babenhauserheide
2024-04-05 21:40 ` Richard Stallman
2024-04-03 10:40 ` Konstantin Kharlamov
2024-04-03 11:45 ` Eli Zaretskii
2024-04-03 13:31 ` Konstantin Kharlamov
2024-04-03 14:11 ` Eli Zaretskii
2024-04-03 15:00 ` Konstantin Kharlamov
2024-04-03 15:47 ` Eli Zaretskii
2024-04-03 17:27 ` Konstantin Kharlamov
2024-04-03 18:22 ` Eli Zaretskii
2024-04-03 19:08 ` Konstantin Kharlamov
2024-04-03 20:12 ` Ergus
2024-04-04 5:26 ` Eli Zaretskii
2024-04-04 9:59 ` Ergus
2024-04-04 11:59 ` Eli Zaretskii
2024-04-04 12:34 ` Ergus
2024-04-04 13:02 ` Eli Zaretskii
2024-04-04 14:27 ` Ergus
2024-04-04 14:41 ` Eli Zaretskii
2024-04-04 18:15 ` Ergus
2024-04-04 18:56 ` Eli Zaretskii
2024-04-04 20:16 ` Konstantin Kharlamov
2024-04-05 5:11 ` Eli Zaretskii
2024-04-04 5:07 ` Eli Zaretskii
[not found] ` <87jzlefgi9.fsf@dick>
2024-04-03 18:44 ` Konstantin Kharlamov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pvii3ssiwwfvnsbbvuhvhlendfc7r7i2cydnqi4x5c2xu6dv23@tb6d7yw6er3o \
--to=spacibba@aol.com \
--cc=dmitry@gutov.dev \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).