Skip to content

Create a simple makefile and allow regressions to use it.#1380

Open
threeifbyair wants to merge 2 commits into
hsutter:mainfrom
threeifbyair:threeifbyair/makefile
Open

Create a simple makefile and allow regressions to use it.#1380
threeifbyair wants to merge 2 commits into
hsutter:mainfrom
threeifbyair:threeifbyair/makefile

Conversation

@threeifbyair

Copy link
Copy Markdown
Contributor

One of the frustrating things about cppfront is that I always have to remember the precise incantation to build cppfront. In addition, the regression tests always build cppfront whether or not it needs to be built.

This PR adds a simple Makefile. Nothing special and explicitly marked as optional. In addition, it allows the regression tests to be run with a pre-built version of cppfront. This allows us (for instance) to build a sanitized cppfront and run it through the regressions to see if we get any memory or undefined behavior errors.

@threeifbyair threeifbyair force-pushed the threeifbyair/makefile branch from ad30ca6 to b364cc0 Compare June 17, 2025 23:16
@hsutter

hsutter commented Jul 27, 2025

Copy link
Copy Markdown
Owner

Thanks! @jarzec you're the expert on that, do you think this will improve regression tests, and do you approve merging this PR?

@hsutter hsutter added the question - further information requested Further information is requested label Jul 27, 2025
@jarzec

jarzec commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

Thanks! @jarzec you're the expert on that, do you think this will improve regression tests, and do you approve merging this PR?

Some context
A while back, after your CppCon 22 presentation, Cpp2 caught interest of many people (myself included). This interest resulted in a number of PRs with CMake setup for cppfront. At that stage you closed those as you didn't want to add extra dependencies. That is why I proposed a pure bash sctipt that can be used on MasOS, Linux and Windows (through git bash) without any extra deps installed. This is what I used for the GitHub actions running for the regression tests.
The idea of using a build system for cppfront was not buried, though. In the Related Projects section of the wiki you point to a number of forks that propose a CMake/Mason setup.

My thoughts
It turns out GNU Make is installed on the Windows GitHub runners (which I didn't know), so it seems to be a possible way to go.
However, if adding Make for regression tests starts to be an option I would suggest a discussion about a more complete and flexible system like CMake or the like. The source code of cppfront is constantly growing while still being basically a single translation unit with really huge files.
CMake would also greatly facilitate integration of cppfront in other projects.
As I mentioned before, this is might be a good topic for a discussion.

On the other hand, adding a command line option to provide the executable to the run-test.sh wouldn't hurt It would e.g. help with developing new tests without having to recompile cppfront every time the test is run.

@hsutter What do you say?

@threeifbyair

Copy link
Copy Markdown
Contributor Author

I'm old-school and I wanted something quick and dirty, so I added a Makefile. Quick and dirty is better than nothing and I was sick and tired of having to get the incantation right on the command line.

With that said, you're probably right that a CMake setup is better. I'll take a look around the related projects. I did set up a CMake system to compile cpp2 files in https://github.com/threeifbyair/advent2024, but that was really my first experience with CMake (I've spent the last ten-plus years with proprietary build tools!) so it may not be all that good.

@MaxSagebaum

Copy link
Copy Markdown
Contributor

I also prefer makefiles for a quick setup. Usually they also do not block the path for manual compilation. Since the project is kept quite simple.

Why not have both. A makefile and cmake file can exist next to each other. Use the simple makefile for the ci and cmake can be used to integrate it into other projects.

@jarzec jarzec left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the discussion in the comments I agree that a Makefile wouldn't hurt.
It is already a nice step towards more internal tooling.

@jarzec

jarzec commented Aug 19, 2025

Copy link
Copy Markdown
Contributor

@hsutter I think you can merge this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question - further information requested Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants