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 72 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://git.anotherfoxguy.com/api/packages/overte/conan
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://git.anotherfoxguy.com/api/packages/overte/conan
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
Copy link
Contributor Author

AnotherFoxGuy commented Sep 24, 2023

For some reason avatars are broken in this build, no idea why
Screenshot_20240213_223335

@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.

cmake/macros/AutoScribeShader.cmake Outdated Show resolved Hide resolved
set(QTAUDIO_PATH "$<TARGET_FILE_DIR:${TARGET_NAME}>/audio")
set(QTAUDIO_WIN7_PATH "$<TARGET_FILE_DIR:${TARGET_NAME}>/audioWin7/audio")
set(QTAUDIO_WIN8_PATH "$<TARGET_FILE_DIR:${TARGET_NAME}>/audioWin8/audio")
# TODO: Is this still needed? needs testing
Copy link
Member

Choose a reason for hiding this comment

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

Windows 7 and Windows 8(.1) are End Of Life and therefore also not supported by us anymore.

@@ -7,5 +7,9 @@
#
macro(TARGET_JSON)
# We use vcpkg for both json and glm, so we just re-use the target_glm macro here
Copy link
Member

Choose a reason for hiding this comment

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

We will have to remember to remove this.

CMakeLists.txt Outdated
@@ -15,67 +15,32 @@ endif()
# 3.14 is the minimum version that supports symlinks on Windows
cmake_minimum_required(VERSION 3.14)
Copy link
Member

Choose a reason for hiding this comment

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

Don't be shy about bumping this version if there is a reason to. VCPKG required a much higher CMake version than this anyway.

@@ -0,0 +1,3 @@
versions:
"2019.02":
Copy link
Member

Choose a reason for hiding this comment

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

Does this version the conan-recipe?

"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

@@ -68,8 +68,8 @@ foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
endif ()
endforeach()

find_package(Qt5LinguistTools REQUIRED)
find_package(Qt5LinguistToolsMacros)
# find_package(Qt5LinguistTools REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

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

As you might know, we would like to add (more) localization support to Overte, but this is currently unused.

@@ -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
Copy link
Member

Something to figure out later: The resulting binary seems to be searching for the Qt platform plugins in the wrong directory.

juliangro@x299-desktop:~/git/overte/build$ QT_DEBUG_PLUGINS=1 ./interface/interface --disable-displays "OpenVR (Vive)" --disable-inputs "OpenVR (Vive)","Sdl2" --allowMultipleInstances
[10/02 23:02:35] [DEBUG] [hifi.shared] Settings file: "/home/juliangro/.config/Overte - dev/Interface.json"
[10/02 23:02:35] [DEBUG] [settings.manager] Initializing settings write thread
[10/02 23:02:35] [WARNING] [default] QEventLoop: Cannot be used without QApplication
[10/02 23:02:35] [DEBUG] [default] UserActivityLogger is enabled: false
[10/02 23:02:35] [INFO] [default] Disabling following display plugins: ("OpenVR (Vive)")
[10/02 23:02:35] [WARNING] [default] DependencyManager::get(): No instance available for 13PluginManager
[10/02 23:02:35] [INFO] [default] Disabling following input plugins: ("OpenVR (Vive)", "Sdl2")
[10/02 23:02:35] [WARNING] [default] DependencyManager::get(): No instance available for 13PluginManager
[10/02 23:02:35] [DEBUG] [default] QFactoryLoader::QFactoryLoader() checking directory path "/home/juliangro/git/overte/build/interface/platforms" ...
[10/02 23:02:35] [WARNING] [qt.qpa.plugin] Could not find the Qt platform plugin "xcb" in ""
[10/02 23:02:35] [FATAL] [default] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
[10/02 23:02:35] [FATAL] [default] 
Abgebrochen (Speicherabzug geschrieben)
juliangro@x299-desktop:~/git/overte/build$ 

@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

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.

5 participants