Projects outside of the OF folder broken in Windows 10 and Visual Studio when using addons
The most recent version of Project Generator fails to create valid projects if the project has a local addon. PG also deletes all of the local addons from the addons.make file, presumably because it doesn't find them.
The previous behavior gave precedence to local addons, which is what makes the most sense.
Rolling back to before 67e0b87c72539b1473eafa3031f70569c3273e4b and running the old ProjectGenerator.exe fixes the issue, so it looks like the problem is in the updates to the PG submodule.
Ahh thanks @c-mendoza pinging @2bbb @dimitre
can you please test again using latest nightly @c-mendoza ? Thank you
Sorry for the delay. Downloaded latest nightly and unfortunately generating any project that is outside of the "apps" folder creates a .sln that has errors and refuses to load. It looks like there is typo in the path to the OF project. This is the error when you open the .sln in VisualStudio:
C:\Users\xxx\Documents\developer\test_delete\test_delete.vcxproj : error : The imported project "C:\Users\xxx\Documents\developer\of_v20230822_vs_releaselibs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" was not found.
The part of the path that says of_v20230822_vs_releaselibs should be of_v20230822_vs_release\libs.
A separate issue: When generating a project that is inside the "apps" folder, if there are local addons, the source files for EVERY local addon show up in a single unnamed group in the VisualStudio project:
I did not try compiling, but it looked like VS was finding the headers for the addons, so at least those paths look like they work.
Sorry for the bad news!
Hey @c-mendoza not bad news at all. Thanks for testing. This is my attempt to fix it https://github.com/openframeworks/projectGenerator/pull/409 not sure if it will help with both the issues, the first one is ok from my tests, but I only looked at the files, not in windows right now.
@c-mendoza now merged and it will be on tomorrow nightly
I’ll test again tomorrow. Thanks!
On Aug 22, 2023, at 10:30 PM, Dimitre @.***> wrote:
@c-mendoza https://github.com/c-mendoza now merged and it will be on tomorrow nightly
— Reply to this email directly, view it on GitHub https://github.com/openframeworks/openFrameworks/issues/7560#issuecomment-1689168059, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALC7AOZOL6YSXBYLJTJM5DXWVTKZANCNFSM6AAAAAAZNYFLKA. You are receiving this because you were mentioned.
Can you please test it again @c-mendoza? thank you
Sorry, I've been slammed with work. Tested 0.12. Still broken. Still the same issue with the groups as above. Still fails to compile. I am getting a completely different error now:
1>------ Build started: Project: openframeworksLib, Configuration: Debug x64 ------
1>openframeworksLib.vcxproj -> C:\Users\xxx\Documents\developer\of_v0.12.0_vs_release\libs\openFrameworksCompiled\lib\vs\x64\openframeworksLib_debug.lib
2>------ Build started: Project: test_delete, Configuration: Debug x64 ------
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(1016,5): error MSB3191: Unable to create directory "C:\Users\xxx\Documents\developer\test_delete\obj\x64\Debug\Build\C:\Users\xxx\Documents\developer\of_v0.12.0_vs_release\addons\ofxPoco\src\Debug". The given path's format is not supported.
2>Done building project "test_delete.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Looks like two paths are getting spliced together? There is a "C:" in the middle of the directory that MSVS is trying to create.
Thank you @c-mendoza can you please share which addons you are using?
@c-mendoza were you trying to create an app at this location:
\Users\xxx\Documents\developer\test_delete\ or were you trying to create an app inside the apps/myApps folder?
I am using ofxImGui and ofxImGuiUtils, but I think that is probably not relevant to the problem.
The project is in \Users\xxx\Documents\developer\test_delete\.
When the project is in OF_DIRECTORY\apps\myApps\test_delete it compiles, but the local_addons group still does not have subgroups for each addon, so all of the files show up in the same unnamed subgroup, as pictured previously.
Okay I can recreate this issue @c-mendoza
The issue is a result of the temporary files ( object files ) needing to be in sub-folders in the build/ folder due to there being multiple files with the same name.
We are using the relative path to essentially create a unique location for each file. But when you make a project outside of the OF folder it uses an absolute path which then creates a path for the build file which can't be created.
So in your case RelativeDir is: C:\Users\xxx\Documents\developer\of_v0.12.0_vs_release\addons\ofxPoco\src\Debug which is not allowed.
So the TLDR is that right now Windows VS won't support projects outside of the OF folder.
I think we could fix this to maybe use a file hash or some other approach to create a unique build file that doesn't rely on the directory location.
@ofTheo let me know if I can help somehow. I'll be back on my setup after sep 12 so I'l be able to test PG changes.
Just tested creating a VS project using the PG outside of the OF folder with the ofxSvg addon and it compiled successfully using VS 2022 on Windows 10. (using the nightly). Also tested generating a project with existing src and bin folders and including the ofxSvg addon with the PG. This project was outside of the OF folder and it compiled as well. Maybe this is fixed? @dimitre @ofTheo @c-mendoza Unsure about the 'local_addons' issue.
Yeah this should be fixed @dimitre did heaps of work with PG folders to sort this definitely done
Sorry all, but this is still not working when using local addons, inside or outside the OF folder.
Using the latest nightly.
@c-mendoza can you elaborate on the local addons issue? A sample folder structure would be helpful to reproduce it.
Sure:
myProject/
src/
bin/
ofxAddonOne/
ofxAddonTwo/
...
In this case, ofxAddonOne and ofxAddonTwo are "local addons", which should be included in the project and given preference over any copies that may be in the OF_ROOT/addons directory. For this to work, the local addons need to be included in addons.make, like any addon.
The advantage of this setup is that you can use addons as git submodules in OF projects, making it much simpler to handle dependencies, and being able to use particular commits or branches of a given addon without having to change the global addons folder upon which other projects may rely.
Ok, I didn't realize this was a supported feature. As @c-mendoza mentioned, The PG does not add an addon placed directly in the project folder.
I could not find any documentation on this, but after following this suggestion by Arturo (https://github.com/openframeworks/openFrameworks/issues/5932#issuecomment-374667307) , it seems to compile.
I created an addons folder in the project folder; OF / apps / myApps / TestLocalAddon / addons / ofxSvg. Then I edited the addons.mk to reflect the location adding the line addons/ofxSvg.
Though the PG shows the following confusing message, I updated the project.
The PG created a local_addons group in the VS project
And added the addon from the local location.
Neat, I didn't know that local addons could be in a sub directory... so local addons work for you?
If so, this is very strange, because they don't for me with the nightly or any of the recent releases.
Yeah I tried with a folder 'addons' and another time using 'local_addons' that were in the project directory and the addons_config.mk had addons/ofxMyAddon or local_addons/ofxMyAddon. It only worked when it was in a sub directory though.
Do you mean to say that you modified the local addon's addon_config.mk?
Oh sorry!, I meant addons.make in the project folder.