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

Enable move to VCPKG #142

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

Enable move to VCPKG #142

wants to merge 5 commits into from

Conversation

Holt59
Copy link
Member

@Holt59 Holt59 commented Jul 8, 2024

PR Content

This PR contains the change for mob to use VCPKG instead of custom stuff to build third-party dependencies. The only things that should be build by mob after this are:

  • USVFS
  • Everything that was under modorganizer_super except cmake_common
  • TBD the third-party stylesheets

Aside from removing the tasks for third-party dependencies, the main changes for mob is the use of the CMake presets from the various MO2 repository and the use of cmake itself to build install (prior to this mob would call msbuild).

VCPKG

Most dependencies are fetch from the official VCPKG registry, but some are built from MO2 registry.

The dependencies that are prefixed with mo2- are specific to MO2:

  • mo2-dds-header - this is a very small port that make the DDS.h header from DirectXTex available. This header is private and not part of DirectXTex official port, maybe there is a reason for that...
  • mo2-bsatk, mo2-esptk - these are ports to build bsatk/esptk when building in standalone mode (see below), these are not prebuilt
  • mo2-cmake - this is the port for cmake_common, all MO2 repositories (except USVFS) depend on this, even when building with mob
  • mo2-libbsarch - this is the port for libbsarch, using prebuilt libbsarch, and used when building MO2 (including build with mob)
  • mo2-uibase - this is a port for uibase that is used when building in standalone mode (see below)

The other dependencies are either not part of MO2 directly but either not available on the official registry (e.g. libloot) or require slight changes.

  • libloot - this is a port for libloot using prebuilt (same as before), building libloot requires way too many dependencies to build it within the port
  • asmjit - adaptation of the official port to use an old commit instead of the current one
  • pybind11 - official port without the Python dependency
  • spdlog - official port customized to remove the fmt dependency (force std::format)
  • 7zip - custom port that uses the official CMakeLists.txt but forces dynamic linking (see below)
    • Most of MO2 dependencies are statically linked, so the VCPKG triplet used is x64-windows-static-md. I was not able to adapt MO2 code (or even a very small example) to work with a statically built 7zip. One could use a custom triplet to build 7zip in dynamic mode and everything else statically, but using a custom triplet prevents VCPKG from sharing the build between components that have different triplets. Since the main repository needs 7zip (for archive) and has many Boost dependencies, it means re-compiling most of Boost because of this. I found it much simpler to use a custom port and force 7zip to dynamic mode.

cmake_common

The cmake_common utilities are now available as a VCPKG port called mo2-cmake. I made a lot of refactoring to remove not very useful stuff and allow more flexibility when using the available functions:

  • removed most of mo2_configure_xxx stuff to keep only mo2_configure_target and mo2_configure_plugin, the other functions (uibase, executable, library, etc.) where not very useful,
  • removed mo2_install_target for mo2_install_plugin
    • does the same as before for plugins (install plugin itself + pdb)
    • for library-like targets, this is done directly by the CMake install(TARGETS ...) stuff (.lib, .dll, etc.)
    • for executable, this is done by adding CMake instalL(FILES) use generator expression $<TARGET_FILE:xxx> and $<TARGET_FILE_PDB:xxx>.
  • split cmake_configure_target into multiple functions so you can either use cmake_configure_target or the independent functions for more control, also added options to cmake_configure_target
    • in particular, it is possible to use cmake_configure_target without having the sources added automatically, to allow more control and avoid automatic use of GLOB_RECURSE + CONFIGURE_DEPENDS
  • updated the Python stuff for external Python + added way to automatically get access to PyQt when required

To-Do List

  • Use CMake preset when available (presence of CMakePresets.json).
  • Combine Bethesda game plugins into a single one.
  • Remove stuff not useful anymore:
    • Gamebryo related stuff.
    • Nuget stuff (not required anymore).
  • Move mob dependencies to VCPKG itself.
  • Remove all third-party tasks - TBD what to do exactly.
  • Choose what to do with the explorerpp task.
  • Choose what to do with the licenses task.
  • Choose what to do with the stylesheets task.
  • Fix translations task.
  • Check/fix that dev builds and releases generation work properly.

@Holt59 Holt59 changed the title Enable move to VCPKG WIP: Enable move to VCPKG Jul 8, 2024
@Holt59 Holt59 changed the title WIP: Enable move to VCPKG Enable move to VCPKG Jul 13, 2024
* Use CMake with presets to generate USVFS solution.
* Use preset when building super repository.
* Allow overriding VCPKG_ROOT with [paths] entry.
* Remove gamebryo and nuget specific stuff.
* Remove cmake command. Add done log.
* Use VCPKG from VS if no VCPKG_ROOT or path setting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant