Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

[EU] Custom libraries and sources

Madman10K edited this page Aug 10, 2023 · 5 revisions

The UVKBuildTool now outputs custom CMakeLists.txt files to enable adding additional libraries and sources into the projects defined.

Getting started

GUI

Open the settings menu, located on the top header bar, select the Game Settings option and use the Add library button, then follow the steps

Manual

Open up your uvproj.yaml file to edit it

Adding include directories

Example:

additional-include-directories:
  msvc:
    - test/include
  unix:
    - test/include

Under the additional-include-directories we specify the target compilers and under each compiler we list the paths as strings

Adding subdirectories

If a library you're linking contains a CMakeLists.txt file, you can add it as a subdirectory using the following syntax

additional-subdirectories:
  msvc:
    - "test/cmake"
  unix:
    - "test/cmake"

Here, we again use the syntax of specifying the compilers and listing the path for each compiler

Link libraries

To add a library name to be linked to a target, we use the following syntax

additional-link-libraries:
  msvc:
    - target: test
      engine: false
      wrapper: true
      modded-wrapper: true
  unix:
    - target: test
      engine: false
      wrapper: true
      modded-wrapper: true

Here, under every compiler, a target with a name is defined, the name of the target should be the name of the library you're trying to link with. The remaining options are the targets to link the library to. The engine tag also includes the game because they are 1 library.

Source and header libraries

Here is an example:

additional-source-libraries:
  msvc:
    engine:
      glob:
      - test/src/*.cpp
      individual:
      - test/includes/als.cpp
  unix:
    engine:
      glob:
        - test/src/*.cpp
      individual:
        - test/includes/als.cpp
additional-header-libraries:
  msvc:
    engine:
      glob:
        - test/include/*.hpp
      individual:
        - test/includes/als.hpp
  unix:
    engine:
      glob:
        - test/include/*.hpp
      individual:
        - test/includes/als.hpp

Syntactically they work in the exact same way, the only difference is that the header tag and where each type of file should go. Here we define our compilers as listed in the previous points, but under the compiler we add a target, there are 4 possible targets:

engine:
wrapper:
modded-wrapper:

Under each target, we define 2 types, glob and individual, the glob type can take a string with a wildcard, while the individual cannot, these files are then evaluated and added to a source, which gets compiled into its respective target.

The engine tag is used for both the game and the engine, since they are compiled together.

Clone this wiki locally