-
Notifications
You must be signed in to change notification settings - Fork 181
Building MO2 & Plugins
ModOrganizer2 is made of multiple repositories that can be found under the ModOrganizer2 Github organization. There are various type of repository, the three most important ones being:
-
cmake_common
is a CMake-only repository that contains many useful functions used by many MO2 repositories. -
uibase
contains the ModOrganizer2 C++ API. -
modorganizer
contains the main code for ModOrganizer2.
Other repositories include either libraries used by MO2, MO2 plugins (games, installers, etc.) or small executable files that are shipped with MO2 (custom LOOT CLI, nxmhandler, etc.).
In order to build most of MO2 components you will need CMake, Visual Studio and Qt. See below for the exact list of components:
-
cmake
- All MO2 components are CMake based. -
Visual Studio
with the following components:-
Desktop development with C++
- Windows Universal C Runtime
- C++ ATL for latest v143 build Tools (x86 & x64)
- C++ /CLI support for v143 build Tools (Latest) (for OMOD and FOMOD installers)
- Windows 11 SDK (get latest)
- C++ Build Tools core features
-
[optional] For repositories using C++/CLI
- Desktop .NET desktop development (for repositories using C++/CLI).
- .Net Framework 4.8 SDK
- .Net Framework 4.7.2 targeting pack (OMOD targets 4.8 but VS still requires the package for other .Net components)
-
-
- Check
mob.ini
for the appropriate version. - Depending on which components you want to build, you may need the following components:
- Qt WebEngine (display nexus pages)
- Qt Image Formats (display images in image tab and preview)
- Qt Positioning (required by QtWebEngine)
- Qt Serial Port (required by Qt Core)
- Qt WebChannel (required by QtWebEngine)
- Qt WebSockets (Nexus api/download)
- Check
MO2 components can be build in standalone mode, i.e., without having to build their dependencies first. In order to do so, MO2 relies on VCPKG with its own registry. You can use the standalone mode to build MO2 official plugins, your own plugin or the main MO2 code.
⚠️ Thevs2022-windows-standalone
preset uses thestandalone
features defined for VCPKG. This will install dependencies from MO2 VCPKG registry using the baseline defined invcpkg.json
orvcpkg-configuration.json
. You need to make sure that the baseline matches your MO2 version, and if not, you should update it.⚠️ The code below can be used to builduibase
itself but modifying the API will most likely results in non-working plugins or MO2 itself. If you intend to modify the API, you should usemob
itself. But this can be used to modify internaluibase
code.
The instruction below can be used to build in standalone mode:
# choose the folder where you want the code to be
mkdir C:\dev\mo2
cd C:\dev\mo2
# clone the repository you want to build
git clone git@github.com:ModOrganizer2/modorganizer.git .
# use the standalone preset
# - PATH_TO_YOUR_MO2_INSTALL should point to your own MO2 installation
# - MO2_INSTALL_IS_BIN is necessary, otherwise the output installation will be wrong
cmake --preset vs2022-windows-standalone `
"-DCMAKE_PREFIX_PATH=C:\Qt\6.7.3\msvc2022_64" `
"-DMO2_INSTALL_IS_BIN=ON" `
"-DCMAKE_INSTALL_PREFIX=${PATH_TO_YOUR_MO2_INSTALL}"
# build and install
cmake --build --preset vs2022-windows-standalone --config RelWithDebInfo --parallel 16 --target INSTALL
In order to build MO2 components en standard mode, you need to build the MO2 dependencies before.
For most components, you will only need to build cmake_common
and uibase
first, but for the main MO2 code, you will need multiple dependencies
and we recommend using standalone mode or mob
in this case.
To build a plugin in standard mode:
# choose the folder where you want the code to be
mkdir C:\dev\mo2
cd C:\dev\mo2
# clone cmake_common
git clone git@github.com:ModOrganizer2/cmake_common.git
# clone uibase and build it
git clone git@github.com:ModOrganizer2/modorganizer-uibase.git uibase
cd uibase
cmake --preset vs2022-windows `
"-DCMAKE_PREFIX_PATH=C:\Qt\6.7.3\msvc2022_64;..\cmake_common" `
"-DCMAKE_INSTALL_PREFIX=.\install"
cmake --build --preset vs2022-windows --target INSTALL
# clone the plugin you want to build and build it
git clone git@github.com:ModOrganizer2/modorganizer-game_bethesda.git game_bethesda
cmake --preset vs2022-windows `
"-DCMAKE_PREFIX_PATH=C:\Qt\6.7.3\msvc2022_64;..\cmake_common;..\uibase\install\lib\cmake" `
"-DMO2_INSTALL_IS_BIN=ON" `
"-DCMAKE_INSTALL_PREFIX=.\install"
cmake --build --preset vs2022-windows --target INSTALL
See mob
for details.