mas-bandwidth / yojimbo

A network library for client/server games written in C++
BSD 3-Clause "New" or "Revised" License
2.45k stars 238 forks source link

Fixing the vcpkg port Vol 2. #165

Closed McKillroy closed 2 years ago

McKillroy commented 2 years ago

Signed-off-by: Yorlik mckillroy@gmail.com

gafferongames commented 2 years ago

Is this ready to go?

McKillroy commented 2 years ago

Basically yes, but I'd like to have someone else besides me test it. Maybe @r4stered can give it a shot? OTOH - if it's broken I'll fix it again - I just can say my latest test worked (for me). Overall it is somewhat hack because I have to provide the Config Files for mbetdtls and libsodium. But - well - lets take it as the next iteration in the process. Fundamentally I think the vcpkg port should go into it's own repository, separate from the main repo because it doesn't need the sources at all to work - they are pulled automagically in the process - like with any other vcpkg port. However it could make sense to put the CMakeLists.txt (maybe after a little tweak) into the main repos root, but that would require working a bit on it and the overall structure, because then we have no config files for mbedtls and libsodium. It kinda depends on what you wish for the project. For now the solution is kinda self contained (except it needs vcpkg) and not interfering with anything.

gafferongames commented 2 years ago

Cool, lets get a second test verifying this is ready to go and I'll merge it. -- thanks all

r4stered commented 2 years ago

I can verify that this works on WSL / Linux. I am running into an issue on windows. This happens after I run ./vcpkg install yojimbo --overlay-ports=../yojimbo/vcpkg/ports/yojimbo

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
-- Up-to-date: C:/Users/willi/dev/yojimbo-test/vcpkg/packages/yojimbo_x86-windows/debug/share/yojimbo/libsodiumConfig.cmake
-- Up-to-date: C:/Users/willi/dev/yojimbo-test/vcpkg/packages/yojimbo_x86-windows/debug/share/yojimbo/mbedtlsConfig.cmake
CMAKE_BUILD_TYPE               = Debug
Skipping header installation.
-- ******  Yojimbo -- DONE --
*********************************************************************
-- Configuring done
CMake Error in CMakeLists.txt:
  Imported target "sodium" includes non-existent path

    "C:/Users/willi/dev/yojimbo-test/vcpkg/packages/libsodium_x64-windows-static/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.
McKillroy commented 2 years ago

@r4stered Does it work if you explicitly request the static build on windows like: vcpkg install yojimbo:x64-windows-static --overlay ....... ?

r4stered commented 2 years ago

You can get past that command, however when I run cmake it can't seem to find any of the cmake config files anymore. I manually set the location of the sodium and mbedtls cmake config files as well as passing -DVCPKG_TARGET_TRIPLET=x64-windows-static to the cmake configure command to force it to use static libs. Then when I tried to build, I got a linker error.

yojimbo.lib(yojimbo.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj [C:\Users\willi\dev\yojimbo-test\build\yojim 
bo-test.vcxproj]
McKillroy commented 2 years ago

OK - seems I need to do a more thorough test here. I realized having a regular installation of vcpkg elsewhere also interfered with this - It seems there are side effects I didn't see before. I'll have a look at it.

McKillroy commented 2 years ago

My tests on Windows and Windows WSL all worked, including a smallish use-yojimbo testcase. I guess we should give it a go and not have this linger around any longer. Any upcoming issues can be solved later.