Build system using vcpkg #736
Replies: 9 comments 25 replies
-
Note: I was trying to use vcpkg to experiment with a 64-bit build yesterday, and found microsoft/vcpkg#14545 is also necessary for libvpx to compile properly from the manifest file |
Beta Was this translation helpful? Give feedback.
-
Question: vcpkg supports Windows, macOS, and Linux. If we integrate it in our CMake process, will it be used by default on those platforms even ahead of system libraries? Most of Plasma's dependencies are available through package managers on Linux, and the preference there (for development anyways) is to dynamically link against those libraries rather than compiling and statically linking them yourself. It would be great if we could use the system library if it exists, but still rely on vcpkg for stuff that's not commonly in package managers (string-theory, physX, etc.) |
Beta Was this translation helpful? Give feedback.
-
Question: Including vcpkg as a git submodule is currently recommended as the best way to "lock" dependencies to certain versions. It sounds like there are future plans to allow specifying version requirements in the manifest file. The upside of a local vcpkg copy is that we can be sure the CMake toolchain file is in a known location. The downside of a local vcpkg copy is that you have to clone the git submodule and all of vcpkg's history. |
Beta Was this translation helpful? Give feedback.
-
#733 is also a requirement for this, I think. |
Beta Was this translation helpful? Give feedback.
-
Related... I did a significant amount of tinkering to get a fairly "working" OOB experience with the client from CI on Windows/Visual Studio with vcpkg. Here is a build that should "just-work" if you drop in the assets from moul-assets. One sticking point that we have there and in the instructions included in README.md is that there is either a lot of manual moving of files or hackery at the cmake level required to get to this point. To fix this, I propose that we create an
We may also want to consider adding a submodule to moul-assets to further this goal, but that is less urgent, I think. |
Beta Was this translation helpful? Give feedback.
-
The first half of the vcpkg Python work got merged today, and I'll be submitting the second half in the next few days. PhysX 4.1 is in master, the DirectX SDK is dead, and we have a nice install target now. Yay progress! On the topic of concerns... One desired workflow was brought up in the OpenUru Discord that may be worth considering. Namely, that in Visual Studio 2019, there is baked-in support for git and GitHub. So, it should be very easy to open Visual Studio 2019 and clone our repository. Ideally, we could use this and bake in some vcpkg bootstrapping into our default CMake on Windows to provide a rather seamless experience. This would make prepare_env.ps1 rather redundant in that everything now happens in the IDE. So the workflow would look something like:
As a reminder, the current workflow is to download the repository's zip file, run prepare_env.bat, build the solution's install project, and download the resource.dat. Our documentation all currently points to Visual Studio 2017, which does not have such seamless git integration from what I can tell. It does support CMake projects, though, I believe. If we were to bump to requiring Visual Studio 2019, then we would be irrevocably dropping support for Windows XP, which we constantly hear whining about. This means that anyone using Visual Studio 2017, the current recommended compiler, would need to:
Assuming an official adoption of vcpkg and removal of the "devlibs" concept... Another issue we may see, assuming we use our CI system to provide cached libraries, is the libraries built on CI under Visual Studio 2017 may not restore properly on systems with Visual Studio 2019 as the most recent compiler. IIRC the compiler hash is part of each cached library's hash in vcpkg. This isn't a critical error, it just means that it's more likely that folks could wind up building the dependencies in vcpkg -- the only hardship this represents is time, however. I suppose all this is to just say that I think we should consider "officially" bumping to Visual Studio 2019 if we want to really adopt vcpkg on Windows with a submodule. |
Beta Was this translation helpful? Give feedback.
-
Just fired up an old VM, and it appears MOULa does not support Windows XP. Attempting to run the MOULInstaller.exe from mystonline.com on WinXP 32-bit gives the common "this is not a valid Win32 application" error. Copying an existing installation (version Uru.Live.1.918.OpenUru#173) over also does not work. It throws "The procedure entry point WakeAllConditionVariable could not be located in the dynamic link library KERNEL32.DLL" when UruLauncher tries to launch UruExplorer.exe. According to Microsoft, that function is only in Windows 7 and above. |
Beta Was this translation helpful? Give feedback.
-
OK, I have a working prototype of this ready for experimenting. You can see the code here and the working CI output here. The CI now outputs clients and tools that work once you supply the game assets. For reasons enumerated below, we need to look at this here before I open a pull request. So, what this does... By default on Windows, we now use an in-repo vcpkg submodule to manage dependencies. This way we are locked into a known working set of dependencies. Further, these dependencies are now built in the Plasma repo's CI and our cmake+vcpkg are responsible for fetching the "devlibs", effectively obsoleting the H-uru/PlasmaPrefix repo. This uses the GitHub Packages to manage everything. This approach has some drawbacks. Foremost is that GitHub Packages has no anonymous access. Meaning that in order for this to work, we will need to generate a token on the H-uru organization with the scope read:packages and include it in-repo. Right now, everything is pointed to my fork and account. For the actual PR, this will need to be changed to a H-uru token. Also, because of the security scoping, testing this in PR form once that is done may be challenging... Pull requests won't be able to write to the H-uru packages store, but everyone will be reading from the H-uru package store. In orther words, test it now ^_^. On the plus side... We are now using GitHub Actions instead of AppVeyor, so we get plenty of CI parallelism. No more need to wait 1 hour for each Windows CI run 😄 If you insist on not using the vcpkg submodule, you can avoid it by passing |
Beta Was this translation helpful? Give feedback.
-
Currently, our build instructions rely on downloading a zip file of pre-compiled dependencies. While this is much easier than finding the right versions of dependencies and compiling them in the right configurations yourself, it's also less than ideal for testing changes to those dependencies or non-standard build configurations.
vcpkg is a Microsoft-developed package manager for C++ libraries that supports (almost) all of our dependencies. It has a feature to declare dependencies in a JSON-based manifest file, and also integrates as a CMake toolchain to automatically install those dependencies as part of the build step (Docs).
Many of us have been using vcpkg manually for over a year to compile dependencies for local development, and @Hoikas has been leading efforts to get it set up as part of our standard build system.
The goal is to simplify our entire build process to the following for both development, and continuous integration:
Both CMake and vcpkg have some built-in support in Visual Studio, but as of December 2020 it's not quite at a point where it works smoothly.
Prerequisites
vcpkg.json
manifest fileKnown Limitations
Beta Was this translation helpful? Give feedback.
All reactions