Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 Added support for building with conan #1

Merged
merged 10 commits into from
Feb 2, 2024

Conversation

AnotherFoxGuy
Copy link
Contributor

@AnotherFoxGuy AnotherFoxGuy commented Feb 9, 2023

Trying to get stuntrally3 to build with conan

Current status:
Windows: Builds and runs with Vulkan
Linux: Builds

TODO:

  • Add install target back
  • Build a rebuild version with GitHub actions
  • Cleanup code
  • Fix build without conan

@AnotherFoxGuy
Copy link
Contributor Author

@cryham Is it currently possible to build stuntrally3 on Windows?
Because currently I still have this error when building on Windows, and I'm not sure if it is an issue with this PR or also happening on the main branch

MyGUI_Ogre2RenderManager.h(248,8): error C2039: 'auto_ptr': is not a member of 'std'
unordered_set(24): message : see declaration of 'std'
MyGUI_Ogre2RenderManager.h(248,16): error C2143: syntax error: missing ';' before '<'
MyGUI_Ogre2RenderManager.h(248,58): error C2238: unexpected token(s) preceding ';'

@cryham
Copy link
Member

cryham commented May 17, 2023

@AnotherFoxGuy it's not possible.
I'm not even sure if mygui-next builds on Windows. I think I managed it once, there were different paths in Ogre and its deps. But finally I didn't add this to git. I should finish that.

@cryham
Copy link
Member

cryham commented Sep 30, 2023

Hi @AnotherFoxGuy
I've built MyGui on Windows okay. I didn't test it in any app (demos don't build).
But it probably still has bad library name. I think I won't even try building SR3 on windows without conan, too many libraries to build from sources.

I'd like to move this forward, since I'm almost ready to release
(a SR3 alpha / beta version, it works, just a bit buggy, editor etc).

So what issues do we still have before conan and CI work, could you help with this?

Until recent changes, there was conan set up in repo and it worked okay for me on Debian 11, with conan 1.6 (or so).
But I did move to Debian 12, which has Conan 2.0 (and two gcc versions 11 and 12) and this didn't work at all for me.
I first had the same error as in topic post.
Then more errors because the conan syntax changed, e.g. these lines in conanfile.py:
self.requires("libpng/1.6.39", override=True)
like shown here in docs. Which I tried fixing but it didn't work.
So I installed conan 1.61 after, but I also had troubles. I also switched to using clang not gcc.
Finally in repo now, we have a (messed up) version that builds fine for me, without conan (commented out etc), on Debian 12, using system packages (I'm not completely sure if all).

I don't understand this:
"Windows: Unbuildable due to MyGUI requiring C++11, while SR3 requires C++17"
If I build SR3 and Mygui-Next on Debian fine, does it mean it used same C++17 for both? Is MyGui forcing C++11 on windows? Does its build fail with C++17? Is this maybe an issue that has been fixed in latest MyGui, and it's not fixed in my old fork?

@cryham
Copy link
Member

cryham commented Oct 11, 2023

Hi @AnotherFoxGuy
Will you be able to help us with Conan and CI builds before upcoming SR 3.0 beta release?
If not, I'll be trying to build all from sources on Windows, like I did long ago.
I'm aiming to release SR3 3.0 version this month still.

@cryham cryham added the help wanted Extra attention is needed label Oct 12, 2023
@cryham
Copy link
Member

cryham commented Oct 21, 2023

Hi @AnotherFoxGuy
I checked you branch and it builds fine on my setup (Debian 12) with conan (1.61), great.
I see that Windows build is missing Ogre-Next dependency, at least, right?
Do you have plans to continue this? (I have no clue how to)

@AnotherFoxGuy
Copy link
Contributor Author

I will take a look at this again today
The last time I was working on this I had some weird linking issues with zlib

@AnotherFoxGuy
Copy link
Contributor Author

I've updated all dependencies to the one described in BuildingVS.md, but it still failed to build with this error:

MYGUI\MyGUI_Ogre2RenderManager.h(248): error C2039: 'auto_ptr': is not a member of 'std'
unordered_set(24): note: see declaration of 'std'
MYGUI\MyGUI_Ogre2RenderManager.h(248): error C2143: syntax error: missing ';' before '<'
MYGUI\MyGUI_Ogre2RenderManager.h(248): error C2238: unexpected token(s) preceding ';'

@cryham
Copy link
Member

cryham commented Feb 1, 2024

Okay, I think I've seen something similar, not sure.
Checking now, it seems either problem with VS version or C++ standard.
Which VS is building? And is it using std++17?
There is some solution here, but let's not do that
https://stackoverflow.com/questions/48882439/how-to-restore-auto-ptr-in-visual-studio-c17

Actually auto_ptr was removed in C++17:
https://en.cppreference.com/w/cpp/memory/auto_ptr

So very likely it should be replaced.
I see it is only used in:
/mygui-next/Platforms/Ogre2/Ogre2Platform/include/MyGUI_Ogre2RenderManager.h
here:
std::auto_ptr<OgreCompositorPassProvider> mPassProvider;

Could you try changing this line to:
std::unique_ptr<OgreCompositorPassProvider> mPassProvider;
Possibly also adding at top
#include <memory>

and rebuilding?
I did this myself and it builds okay.

@cryham
Copy link
Member

cryham commented Feb 1, 2024

I've rebuild MyGui-next with this change and then SR3, and it works fine.
So I just pushed it into MyGui-next. Should be fine.

@AnotherFoxGuy
Copy link
Contributor Author

I've updated the MyGUI package to include that patch, now it builds without any problems on Windows 👍🏼
Linux still has a linking issue with Bullet, I will take a look at that next
Also, the GL3Plus and Vulkan render systems are missing on Windows, I need to fix that

@AnotherFoxGuy
Copy link
Contributor Author

AnotherFoxGuy commented Feb 2, 2024

I've updated the OGRE package to build with Vulkan on Windows and got the game running:
StuntRally3_2024-02-02_11-45-12

@cryham cryham marked this pull request as ready for review February 2, 2024 14:06
@cryham cryham merged commit 1384067 into stuntrally:main Feb 2, 2024
2 checks passed
@AnotherFoxGuy AnotherFoxGuy deleted the conan branch February 2, 2024 17:02
@cryham
Copy link
Member

cryham commented Feb 2, 2024

This is great that is works.

But I don't see any Artifacts, produced during runtime. Like we had before e.g.:
https://github.com/stuntrally/stuntrally/actions/runs/7400808998
Now there aren't and there is some warning there too at bottom:
https://github.com/stuntrally/stuntrally3/actions/runs/7758953597

I am okay if we only pack binaries (would be cool if for Linux too, since there isn't a release yet) as build result. So that getting data and rest from git would be required (isn't easiest but much less size to pack and download).

@AnotherFoxGuy
Copy link
Contributor Author

But I don't see any Artifacts, produced during runtime.

That is because stuntrally3 doesn't have an install target yet, I will open a PR for that soon

@cryham
Copy link
Member

cryham commented Feb 3, 2024

Right okay so I can't build with CMake and conan now after merge on Debian 12.
I think I could with conan before.
Anyway here is what I get first:

[main] Configuring project: _sr3 
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -S/home/ch/_sr/_sr3 -B/home/ch/_sr/_sr3/buildRelease -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Adding Bullet::Bullet target
[cmake] CMake Error at CMake/DependenciesConfig.cmake:7 (find_package):
[cmake]   By not providing "Findenet.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "enet", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "enet" with any of
[cmake]   the following names:
[cmake] 
[cmake]     enetConfig.cmake
[cmake]     enet-config.cmake
[cmake] 
[cmake]   Add the installation prefix of "enet" to CMAKE_PREFIX_PATH or set
[cmake]   "enet_DIR" to a directory containing one of the above files.  If "enet"
[cmake]   provides a separate development package or SDK, be sure it has been
[cmake]   installed.
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:77 (include)

I changed FindENet.cmake to Findenet.cmake, IDK probably bad, but got further to this:

[cmake] --   static     : OFF
[cmake] --   components : Bites;Bullet;MeshLodGenerator;Overlay;Paging;Property;RTShaderSystem;Terrain;Volume
[cmake] --   plugins    : Plugin_BSPSceneManager;Plugin_OctreeSceneManager;Plugin_PCZSceneManager;Plugin_ParticleFX;RenderSystem_GL;RenderSystem_GLES2;RenderSystem_GL3Plus;Codec_STBI;Codec_FreeImage
[cmake] --   media      : /usr/local/share/OGRE-14.1/Media
[cmake] CMake Error at CMake/DependenciesConfig.cmake:12 (find_package):
[cmake]   By not providing "FindRapidJSON.cmake" in CMAKE_MODULE_PATH this project
[cmake]   has asked CMake to find a package configuration file provided by
[cmake]   "RapidJSON", but CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "RapidJSON" with
[cmake]   any of the following names:
[cmake] 
[cmake]     RapidJSONConfig.cmake
[cmake]     rapidjson-config.cmake
[cmake] 
[cmake]   Add the installation prefix of "RapidJSON" to CMAKE_PREFIX_PATH or set
[cmake]   "RapidJSON_DIR" to a directory containing one of the above files.  If
[cmake]   "RapidJSON" provides a separate development package or SDK, be sure it has
[cmake]   been installed.
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:77 (include)

Then I renamed to FindRapidjson.cmake to FindRapidJSON.cmake and
it now shows boost too:

[cmake] -- The following OPTIONAL packages have been found:
[cmake] 
[cmake]  * PkgConfig
[cmake] 
[cmake] -- The following REQUIRED packages have been found:
[cmake] 
[cmake]  * boost_headers (required version == 1.74.0)
[cmake]  * Boost
[cmake]  * Bullet
[cmake]  * enet
[cmake]  * MyGUI
[cmake]  * Ogg
[cmake]  * OGRE
[cmake]  * OpenAL
[cmake]  * Threads
[cmake]  * SDL2
[cmake]  * tinyxml2
[cmake]  * Vorbis
[cmake] 
[cmake] -- The following REQUIRED packages have not been found:
[cmake] 
[cmake]  * RapidJSON
[cmake] 
[cmake] -- Configuring done
[cmake] CMake Error at CMakeLists.txt:176 (target_link_libraries):
[cmake]   Target "stuntrally3" links to:
[cmake] 
[cmake]     boost::boost
[cmake] 
[cmake]   but the target was not found.  Possible reasons include:
[cmake] 
[cmake]     * There is a typo in the target name.
[cmake]     * A find_package call is missing for an IMPORTED target.
[cmake]     * An ALIAS target is missing.
[cmake] 
[cmake] 
[cmake] 
[cmake] CMake Error at CMakeLists.txt:176 (target_link_libraries):
[cmake]   Target "sr-editor3" links to:
[cmake] 
[cmake]     boost::boost
[cmake] 
[cmake]   but the target was not found.  Possible reasons include:
[cmake] 
[cmake]     * There is a typo in the target name.
[cmake]     * A find_package call is missing for an IMPORTED target.
[cmake]     * An ALIAS target is missing.
[cmake] 
[cmake] 

@cryham
Copy link
Member

cryham commented Feb 3, 2024

IDK no idea. I'm adding my old CMakeLists.txt as CMakeLists-Debian.txt and
restoring /CMake/Dependencies/OGRE.cmake since it's needed for it too.
I mean even if conan worked after fixes, this is still another option to build.

Also I think the worst is that it finds my system Ogre 14, not OgreNext.
IDK how to fix it. Should I specify paths or something? Do I need to install it, I can't since then I couldn't use Ogre 14 for other project(s)?

Lastly I think you had older CMakeLists.txt and didn't merge with my changes
since I see now

        #  not really sources
        Media/gui
        Media/materials
        Media/particles

instead of data/

And the whole bottom part is gone that had
## Translations tool
another small binary tool setup to build.

@cryham
Copy link
Member

cryham commented Feb 3, 2024

Ugh okay, actually it's not that simple. Need to restore like whole CMake dir to build like before.

@AnotherFoxGuy
Copy link
Contributor Author

Yeah, this PR wasn't quite complete yet
I will make some more PRs to fix all of those issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants