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

🚀 Replace vcpkg with conan #641

Open
wants to merge 123 commits into
base: master
Choose a base branch
from

Conversation

AnotherFoxGuy
Copy link
Contributor

@AnotherFoxGuy AnotherFoxGuy commented Sep 24, 2023

This PR is still a work in progress, but the interface should built and run on both Windows and Linux

TODO

  • Fix broken avatars
  • Replace cmake/externals with conan packages
  • Update GitHub actions to use conan
  • Fix other components
  • Fix Debug build
  • Fix tests build
  • Fix manual tests build
  • Fix tools build
  • Fix and test WebRTC

How to build on Windows with conan
Add the remote
conan remote add overte https://artifactory.overte.org/artifactory/api/conan/overte
Install the deps with conan
conan install . -b missing -pr:b=tools/conan-profiles/vs-19-release -pr=tools/conan-profiles/vs-19-release -of build
Generate the VS project files
cmake --preset conan-default
(Note: Currently only the Release build can be built)

How to build on Linux with conan
Let conan detect the build environment
conan profile detect
Add the remote
conan remote add overte https://artifactory.overte.org/artifactory/api/conan/overte
Install the deps with conan
conan install . -s build_type=Release -b missing -of build
Generate the make files
cmake --preset conan-default
Build the interface
cd build && make

@AnotherFoxGuy

This comment was marked as resolved.

@AnotherFoxGuy AnotherFoxGuy force-pushed the conan branch 2 times, most recently from 1f6bfe1 to 705a375 Compare September 27, 2023 11:55
@AnotherFoxGuy AnotherFoxGuy marked this pull request as ready for review September 27, 2023 14:04
Copy link
Member

@JulianGro JulianGro left a comment

Choose a reason for hiding this comment

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

A little comment on vhacd-util: As far as I know this is somewhat legacy. Our engine will automatically generate collision hulls and doesn't use vhacd-util for that. vhacd-util could be very useful for generating performant collision hulls for more complicated objects, but I don't think anyone does that. In fact, I have never even tried using it, and don't even know if it works.

tc.variables["BUILD_TOOLS"] = "OFF"
tc.variables["USE_CUDA"] = "OFF"
if self.settings.os == "Linux":
tc.variables["CMAKE_CXX_FLAGS"] = "-march=msse3 -fPIC"
Copy link
Member

Choose a reason for hiding this comment

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

This would break on aarch64, which technically Overte can currently run on.

Copy link
Member

Choose a reason for hiding this comment

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

Apparently, the -march=msse3 just gets ignored on aarch64 without even throwing a warning.

"qt*:qtxmlpatterns": "True",
"glad*:spec": "gl",
"glad*:gl_profile": "core",
"glad*:gl_version": "4.6",
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if you know, but Overte supports multiple OpenGL versions. For example, it will fall back to OpenGL 4.1 if OpenGL 4.6 is not available. It can also be built for OpenGL ES 3.2.
I don't know how this part of the Conan code works though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just the targeted version for glad, I just copied the settings from the vcpkg package

@@ -0,0 +1,8 @@
[settings]
os=Windows
arch=x86_64
Copy link
Member

Choose a reason for hiding this comment

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

We don't currently have any plans for an aarch64 Windows version, but would it make sense to have the profile name reflect the architecture?

@@ -217,7 +217,7 @@ def processCommand(line):
executeSubprocess(scribeArgs)

# Generate the un-optimized output
executeSubprocess([glslangExec, '-V110', '-o', upoptSpirvFile, unoptGlslFile])
executeSubprocess([glslangExec, '-V100', '-o', upoptSpirvFile, unoptGlslFile])
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain what this change is doing? Looking it up online it seems like this switches to an older Visual Studio toolchain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The glslangValidator from the conan package is too old to support that version, it needs to be updated

@JulianGro
Copy link
Member

A comment on building this on Linux:
Since Conan is not available as a distribution package (at least not on Debian), but rather a pip package, the installation procedure is not that trivial.

# Install python3 virtual environment
sudo apt install python3-venv
# Create a virtual environment in the Overte codebase
python3 -m venv .venv
# Install pip dependencies
.venv/bin/pip3 install conan
# Now one can run conan
.venv/bin/conan profile detect

@JulianGro

This comment was marked as resolved.

@AnotherFoxGuy

This comment was marked as resolved.

@JulianGro
Copy link
Member

Am I understanding it right that Conan is supposed to only get dependencies of its own if the system doesn't already provide them?
If yes, we should probably always depend on a version range, from the oldest version that we know works, to the newest version that we know works. With libopus we would get version 1.3.1 from the system on Ubuntu 20.04.
Or does Conan "only" provide the tools for us to conditionally use system packages on our own?

@AnotherFoxGuy
Copy link
Contributor Author

Am I understanding it right that Conan is supposed to only get dependencies of its own if the system doesn't already provide them?

That is really dependent on how the conan recipes are written.
The recipes provided by the conan-center are always using conan packages to make packaging easier and more reproducible.
But it is possible to script conan to install system packages, for example the xorg recipe just installs the appropriate system packages https://github.com/conan-io/conan-center-index/blob/master/recipes/xorg/all/conanfile.py#L26

@JulianGro

This comment was marked as resolved.

@JulianGro
Copy link
Member

JulianGro commented Oct 2, 2023

It would be nice if you could put a README into the conan-recipes directory on how to consume those and how to update them.

It seems like I can build node for example using a command like

../../.venv/bin/conan create all/conanfile.py --version 18.17.1

@JulianGro

This comment was marked as resolved.

@AnotherFoxGuy

This comment was marked as resolved.

@JulianGro

This comment was marked as outdated.

@JulianGro
Copy link
Member

Building libnode through conan fails on Ubuntu 20.04.
profile detect seems to have chosen C++14, while libnode seems to require C++17 or higher to build.
Log: https://bin.linux.pizza/?3ad49c3deaebf232#5NxEbsMUNagxtaMvnFJxm3dpWXTt2Ja5CJQrYio89wAR

@JulianGro
Copy link
Member

Just tried on aarch64 postmarketOS. (I cannot select text or pipe it to file for some reason.)
Screenshot_20231007_202237
It looks like it is trying to install gl through the Alpine Package manager, which is not a valid package name. Unfortunately, Conan Center is having issues, so I don't know how to take a look at the source code.

@AnotherFoxGuy
Copy link
Contributor Author

I don't know how to take a look at the source code.

The source for the package is here:
https://github.com/conan-io/conan-center-index/blob/master/recipes/opengl/all/conanfile.py

@JulianGro
Copy link
Member

Installing a bunch of packages fixed the gl issue.
Screenshot_20231007_221300

self.requires("artery-font-format/1.0.1")
self.requires("bullet3/3.25")
self.requires("cgltf/1.14@overte/stable")
# self.requires("crashpad/cci.20220219" ) # Broken
Copy link
Member

Choose a reason for hiding this comment

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

Since we barely use Crashpad, and it is a huge pain to build, I think we should just leave it disabled for now. We can take a look at it again once Conan is merged.

@JulianGro
Copy link
Member

Building on Ubuntu 20.04 currently fails due to conan-io/conan-center-index#26806

@JulianGro

This comment was marked as resolved.

@JulianGro

This comment was marked as resolved.

@JulianGro JulianGro force-pushed the conan branch 2 times, most recently from 6caebac to a2591ab Compare March 21, 2025 17:34
@JulianGro

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs QA This pull request needs to be tested NLnet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

6 participants