ocornut / imgui_test_engine

Dear ImGui Automation Engine & Test Suite
386 stars 40 forks source link

Proposal: Simple MSVC build script (without MSBuild or Make) #38

Closed liamwhan closed 5 months ago

liamwhan commented 5 months ago

Seeking feedback on @ocornut 's thoughts on the below before I commit the time to raising a PR.

I found this project very difficult to build (it took me 2 attempts to get it building from a batch file and the successful attempt took ~5 hours) from the provided instructions for a couple of primary reasons:

  1. I don't use Make or any fancy build system
  2. The vcxproj and solution target the v140 toolset and the Windows 8 SDK, neither of which are installed by default with VS anymore

One of the things I love about Dear ImGui proper is that it doesn't require a huge amount of setup and reading through existing build stuff or install a bunch of pre-requisites to figure out how to get it building.

I was wondering if it is worth me I raising a PR that added a simple build.bat for app_minimal that built using MSVC (basically just using cl.exe)

Is this something that you think would be beneficial?

liamwhan commented 5 months ago

Actually, thinking about it

I thinking it might also be beneficial to work up a separate example app that doesn't rely on imgui_app.h/.cpp as this is intended to be internal and one cannot build app_minimal without it

Id be happy to do this jointly or severally as well if we think this would not add too much of a maintenance burden.

EDIT: Scratch this. This would imply having N number of examples where N = supported backends, as are present in the Dear ImGui proper examples, so it would be A LOT more maintenance unless you were happy to have a single backend example that was isolated from the imgui_app for user convenience.

liamwhan commented 5 months ago

In the end I needed to do this for my own purposes anyway, so have submitted a PR #40

ocornut commented 5 months ago

The vcxproj and solution target the v140 toolset and the Windows 8 SDK, neither of which are installed by default with VS anymore

When you open one of them it should offer you to update to your current/latest toolset and SDK. Did you have a problem with this? I'll probably merge your batch file but if you are using VS i don't quite understand why you didn't use the provided solution. It has never been easy to provide examples for so many backends that works flawlessly on all setups and build systems. It's been taking an enormous amount of energy on imgui end to full-fill that.

The problem is that prior to VS 2019 there's no "Latest Windows 10 SDK" versions and there are so many Windows 10 SDK anyway that it's going to ask you to update if we have a pre-VS 2019 project.

(it took me 2 attempts to get it building from a batch file and the successful attempt took ~5 hours)

Can you clarify where did you spent that time? Merging the batch file would be good because it provides another source of truth for building.

To be honest there's another big issue with our setup, the imgui_test_engine,vcxproj actually is configured to use imgui_test_suite/imgui_test_suite_imconfig.h, which pulls in ImPlot, which is an optional dependency to provide pretty renders in Dear ImGui Perf Tool, but given we have too much tech debt in perf tool + the confusion caused by this optional ImPlot support I am consider to remove it all-together.

liamwhan commented 5 months ago

Hey Omar,

Firstly a point of clarification: I am significantly less experienced than you in the (over-)complicated world of build systems etc. and I am severely allergic to build systems in general - even relatively simpler systems like MSBuild. So you need bear my inexperience in mind and take my opinions above (and my further clarification below) with a grain of salt.

When you open one of them it should offer you to update to your current/latest toolset and SDK. Did you have a problem with this?

My first attempt at this was late in 2023, and when I read your question I realised I couldn't remember the issue I had, so I cloned a fresh copy of imgui_test_engine (and a fresh copy of imgui alongside) and tried again. After doing a simple git submodule init --update to pull in implot, I had no issues whatsoever building app_minimal.

After some reflection this morning, I think what happened has nothing to do with issues in this repo and the problem is ME! What happened originally must have been this: Given that I do not use VS, VS Solutions or Projects, I knew immediately that I needed to figure out how to build this without MSBuild, (which is not super-simple to do actually because not everything required for the build is specified in the .vcxproj xml so there was a fair bit of trial and error involved - for me at least). I did try to open the app_minimal solution in VS, and my memory was that I still couldn't get it to build, but I think that was incorrect.

TL; DR; I had thought that I couldn't build this in 2023, so didn't even attempt it when I returned to this yesterday, but I was wrong, I think after the toolset and SDK auto-upgrade in VS 2022 it was always working fine.

I'll probably merge your batch file but if you are using VS i don't quite understand why you didn't use the provided solution. It has never been easy to provide examples for so many backends that works flawlessly on all setups and build systems. It's been taking an enormous amount of energy on imgui end to full-fill that.

Let me first acknowledge that I can not imagine how much work it must be to provide so many flawless (and the ones in the imgui repo are, in my experience, flawless) examples and keep them up-to-date. But can I also say what an important and incredible user-experience this creates for new adopters.

With that in mind, here is one small justification for the existence of that batch file: for those of us who develop on windows but don't use VS / Solutions & Projects / MSBuild / Any build system at all there is an ambiguous step we need to solve before we use this which is to figure out how to convert the MSBuild project to our system. The benefit of the build_win64.bat file is that it contains all of the information you would need to, for instance, build this with any other compiler.

I guess in short, its easier to reverse engineer the bat file than the vcxproj.

Finally, I wonder if maintaining the examples for the backends is a good job for a contributor. I would be happy to take on this role if you thought that was feasible?

liamwhan commented 5 months ago

Closing this as it's resolved from my perspective, but if there is anything you'd like to follow up with me please don't hesitate