-
Notifications
You must be signed in to change notification settings - Fork 252
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
Use vcpkg on all presets #469
Conversation
877e1ac
to
9cad348
Compare
I added it into the main CMakeLists right at the top. That accomplishes two
things: it removes the burden of specifying it on the invocation (or on
specifying a preset) and it lets us tie in to vcpkg's toolchain-chaining
capability, which will be critical for Android.
…On Wed, Jun 26, 2024 at 12:51 PM Louis Gombert ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In CMakePresets.json
<#469 (comment)>
:
> @@ -39,8 +21,7 @@
"architecture": {
"strategy": "external",
"value": "x64"
- },
- "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
I think you still need that to load the toolchain, especially locally
—
Reply to this email directly, view it on GitHub
<#469 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPB6RKC76GU7MYXKHKS5RLZJL5S7AVCNFSM6AAAAABJ5B7LOKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCNBSGU4DKMZQHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Oh right, I did not notice, that's fine |
9cad348
to
719e461
Compare
9b38257
to
828f903
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds additional required dependency vcpkg for users on Linux and macOS, which on some cases undesirable (Linux distribution enforces using external dependencies from thier repositories for security reasons). We should keep ability to install external dependencies without using vcpkg.
@winterheart I'd be happy with a solution that accepted either system-installed libraries or vcpkg ones. I would assume that a system-packaged library should take precedence over a vcpkg-provided one? Is there a pre-existing convention to use for buildscript parameters ( |
I don’t think that the system-packaged library should take precedence over a vcpkg-provided one. I want to be able to easily test two scenarios:
If system packages took precedence over vcpkg packages, then it would be more difficult to test that first scenario.
I don’t know if there’s a pre-existing convention, but I do know that GZDoom has options like |
I think -DUSE_VCPKG (with default OFF) option would be OK. I don't think, that we'll need to install different dependencies from different sources. |
Why not try to use VCPKG if available (ie VCPKG_ROOT env variable set) and fallback to system libs if not found? With a clear message during configuration that tells you what's being used. I agree though that mixing VCPKG and systems libs is a bad idea |
Went with a combination of @Jayman2000's and @Lgt2x's ideas: The system will use vcpkg by default if Something I've noticed is that if the build has already been configured, it will continue using that configuration's settings even if different ones are specified. Is that normal CMake behavior? This feels like either a bug or a misunderstanding on my part. |
Can you give an example of the commands you've tried? Needs a warning or error message when USE_VCPKG is ON and VCPKG_ROOT cannot be found |
https://gist.github.com/tophyr/2f8df17c6a46c3a9157ac73f69de1939#file-gistfile1-txt-L104-L110 I think this is intended behavior due to CMake's CMakeCache.txt file. Doing this:
ends up storing
.... in short, i hate cmake |
e27f6fe
to
c5c4815
Compare
e665464
to
ab9e0b1
Compare
All @Jayman2000 feedback incorporated, and build instructions for both Ubuntu and Fedora, with and without vcpkg, tested from absolute fresh in VMs (Fedora 40 and Ubuntu 22.04 LTS). Should be ready to merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this PR and got it to work in these situations:
-
Windows 10 x86_64
-
Ubuntu 24.04 x86_64 without vcpkgs
-
Fedora 40 x86_64 without vcpkgs.
I was not able to get it to work in these situations:
-
Ubuntu 24.04 x86_64 with vcpkgs. The game compiles fine, but when I run it, I get this error:
SDL: SDL_Init() failed! rc == (-1). SDL_GetError() reports "dsp: No such audio device".
-
Fedora 40 x86_64 with vcpkgs. When I run
cmake --preset linux
, it fails with several error messages. The most important one seems to be:error: building libsystemd:x64-linux failed with: BUILD_FAILED
83b21c4
to
d5aa7bb
Compare
Incorporated @Jayman2000 README feedback |
d5aa7bb
to
7377ffd
Compare
One thing worth noting is that the mouse behavior is wonky, in both of my Linux builds. But, I only have Linux VMs - I'd appreciate anyone with a bare-metal Linux machine testing this and running the binary and checking if the mouse is usable (both in the GUI and in the game). |
I don't have such a problem on my machine (not a VM) The code looks mostly good to me now, very good job. After the last comment is addressed we're all set. I'll let @Jayman2000 approve additionally |
@@ -5,21 +5,41 @@ if(NOT CMAKE_BUILD_TYPE AND NOT DEFINED ENV{CMAKE_BUILD_TYPE}) | |||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "default build type") | |||
endif() | |||
|
|||
project(Descent3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should still be on top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this PR and got it to work in these situations:
-
Windows 10 x86_64 using an “x64 Native Tools Command Prompt for VS 2022”
-
Ubuntu 24.04 x86_64 with vcpkg.
-
Ubuntu 24.04 x86_64 without vcpkg.
-
Fedora 40 x86_64 with vcpkg.
-
Fedora 40 x86_64 without vcpkg.
I was not able to get it to work in these situations:
-
Windows 10 x86_64 using a “Developer Command Prompt for VS 2022”. When I try to run
cmake --preset win
, it fails with this error:Could not find a configuration file for package "SDL2" that is compatible with requested version "".
Incorporated @Jayman2000 README feedback
I noticed that the README still mentions Android. Do you think that it would be better if the README mentioned Android even though we don’t support it yet?
One thing worth noting is that the mouse behavior is wonky, in both of my Linux builds. But, I only have Linux VMs - I'd appreciate anyone with a bare-metal Linux machine testing this and running the binary and checking if the mouse is usable (both in the GUI and in the game).
I get the same problem when I run the main
branch in a VM, so I don’t think that it’s related to the changes in this PR.
README.md
Outdated
|
||
Open a Developer Command Prompt (or Developer PowerShell, x64 Native Tools Command Prompt, etc if you want a specific environment) and run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we switch from telling people to use an x64 Native Tools Command Prompt to telling people to use any of the “-for VS 2022” command prompts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hubris! I wanted to make sure it was clear that PowerShell would work as well, and overreached. I've switched the README back to saying
Open a "x64 Native Tools Command Prompt" or "x64 Native Tools PowerShell" and run:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7377ffd
to
e5dcce3
Compare
Updated, hopefully for the final time, to address @Jayman2000's Developer Command Prompt for VS 2022 failure - README now excludes that configuration, like it probably should've from the start. Also added SDL2, gtest and zlib back to Brewfile, to support non-vcpkg building there as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for completing this :)
Pull Request Type
Description
Uses vcpkg for all platforms and removes platform-specific installation methods for ZLib, SDL and GTest. Still allows system-provided libraries.
Related Issues
Effectively a rebased and simplified reboot of @Arcnor's #242
Checklist