openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

Project Generator needs fixing to work with Env Variables

Open ofTheo opened this issue 10 months ago • 19 comments

the lastest nightly build, projectGenerator still had trouble with addon_config.mk, can't find and include the source file from include search paths,i.e i'm tested with ofxGStreamer, ADDON_INCLUDES += $(GSTREAMER_1_0_ROOT_MSVC_X86_64)include,it can not find source file and include within the VS2022 project solution

Image

Image

Originally posted by @liquidzym in #7588

ofTheo avatar Feb 28 '25 18:02 ofTheo

@liquidzym is it stripping out the _ and replacing with spaces?

If you change all GSTREAMER 1 0 ROOT MSVC X86 64 to GSTREAMER_1_0_ROOT_MSVC_X86_64 and the same with OF ROOT to OF_ROOT does it work?

ofTheo avatar Feb 28 '25 18:02 ofTheo

@dimitre any ideas

danoli3 avatar Mar 03 '25 04:03 danoli3

I've took a look at the code (I didnt write it) and found this:

			if (containsSourceFiles(normalizedDir)) {

this wont allow this paths to pass because this variables are resolved inside VS, not replaced by PG. cc: @roymacdonald

dimitre avatar Mar 03 '25 04:03 dimitre

It seems like those _ being stripped out are the problem. The issue seems to be in ofAddon::addReplaceStringVectorPathStr That is the point where the replacements happen. It is strange though that it does so for OF_ROOT. Yet, this was working before and now it is not... cheers

roymacdonald avatar Mar 04 '25 00:03 roymacdonald

@danoli3 @ofTheo This path was directly added like this in VS

$(GSTREAMER_1_0_ROOT_MSVC_X86_64)include

and it works from there, because it is an environment variable that is correctly parsed there.

by having a function that checks if a folder is not empty before adding the path

if (containsSourceFiles(normalizedDir)) {

the file is never added because it is not a resolved path for PG. I think PG didn't use this filter until recently

dimitre avatar Mar 04 '25 01:03 dimitre

I see. I think that that filter was there before. I dont recall adding it. But, then you should have some sort of rule in ofAddon::addReplaceStringVectorPathStr that if it is not able to replace that variable it should leave it untouched and then have the containsSourceFiles function to also return true if the path has a variable in it. I am not sure but I could guess that since it is being treated as a std::filesystem::path rather than a string, it gets messed up at some point.

roymacdonald avatar Mar 04 '25 21:03 roymacdonald

Oww finally, found the commit introducing this check, so assigning @danoli3 https://github.com/openframeworks/projectGenerator/commit/28d3e248a94c8f7da91385b78abdb3c1f5238411#diff-569e5575fd4a62c1169c6ffe799bea95b381d89eba1756d4f165a9a1b1e681f3

dimitre avatar Mar 05 '25 01:03 dimitre

yeah most likely due to all those insane vs path issues we had back then, shouldn't be too hard to figure out if the value has a env variable they look pretty much the same

danoli3 avatar Mar 05 '25 06:03 danoli3

@dimitre could you fix this one though, I am overburdened

danoli3 avatar Mar 05 '25 08:03 danoli3

@danoli3 sure. This is what I think can fix with the minimum amount of changes. https://github.com/openframeworks/projectGenerator/pull/616

Anybody else can test this one? @ofTheo @danoli3 ? No windows machine here.

dimitre avatar Mar 05 '25 11:03 dimitre

@dimitre your fix looked good to me so I merged. Do we need to do anything in OF/OF to update the submodule?

@liquidzym - this time tomorrow can you check the nightly builds and see if it works for you now?

ofTheo avatar Mar 06 '25 17:03 ofTheo

@ofTheo I've just invoked manual nightly so we will have a new one in 25 minutes. about OF/OF it should build everything using latest PG. If anybody can help testing in Windows it would be great.

dimitre avatar Mar 06 '25 17:03 dimitre

Testing with the latest nightly on Windows 10 using VS 2022: of_v20250307_vs_64_release Image

Image

Image

NickHardeman avatar Mar 07 '25 22:03 NickHardeman

@NickHardeman is this good? maybe fixed?

dimitre avatar Mar 07 '25 23:03 dimitre

That looks correct to me! Yay!!! 🎉

ofTheo avatar Mar 08 '25 00:03 ofTheo

@ofTheo sorry just backing to home,the addon_config.mk the include path it has "_" with it ,not too sure why the captured images looks like without on it. ADDON_INCLUDES += $(GSTREAMER_1_0_ROOT_MSVC_X86_64)include ADDON_INCLUDES += $(GSTREAMER_1_0_ROOT_MSVC_X86_64)include/gstreamer-1.0 ADDON_INCLUDES += $(GSTREAMER_1_0_ROOT_MSVC_X86_64)include/glib-2.0 ADDON_INCLUDES += $(GSTREAMER_1_0_ROOT_MSVC_X86_64)lib/glib-2.0/include ADDON_INCLUDES += $(GSTREAMER_1_0_ROOT_MSVC_X86_64)lib/gstreamer-1.0/include ADDON_INCLUDES += $(GSTREAMER_1_0_ROOT_MSVC_X86_64)lib/gstreamer-1.0/include/gst

liquidzym avatar Mar 10 '25 06:03 liquidzym

@liquidzym I tested this a few days ago and the PG seemed to add the correct paths from the addon_config.mk. Can you test with the latest PG to determine if the issue is resolved please?

NickHardeman avatar Mar 10 '25 15:03 NickHardeman

@NickHardeman sorry for the multipost i just pasted the output message from PG https://github.com/openframeworks/openFrameworks/issues/8124#issuecomment-2713151687 not too sure why still get the same issue,but i'll testing it with another computer asap!

liquidzym avatar Mar 11 '25 08:03 liquidzym

ok,just did tested with of_v20250311_vs_64_release,same issue,no clue at all,is it because the installed GSTREAMER driver path causing this? but it has env path in the system

Image

Image

liquidzym avatar Mar 11 '25 09:03 liquidzym