Skip to content

Commit

Permalink
feat: switch to xmake
Browse files Browse the repository at this point in the history
Xmake is a nicer build system, which doesn't require as much effort to
add new build configurations in that work with every generator. Xmake
also allows to interface with CMake projects which allows us to easily
use existing CMake external dependencies.

All internal dependencies were converted to use xmake.

Xmake also has a nice package manager which doesn't require any
configuration on the user's side, allowing us to use packages from that
if needed.
  • Loading branch information
localcc committed Apr 6, 2024
1 parent d2f8578 commit 4ea0fb4
Show file tree
Hide file tree
Showing 96 changed files with 4,935 additions and 8,074 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ jobs:
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest

- name: Build
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Game__Shipping__Win64
cmake --build build
xmake f -m "Game__Shipping__Win64"
xmake build
- name: Package
run: python tools/buildscripts/build.py package -e
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ jobs:
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest

- name: Release Commit
id: release_commit
Expand All @@ -41,8 +43,8 @@ jobs:

- name: Build
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Game__Shipping__Win64
cmake --build build
xmake f -m "Game__Shipping__Win64"
xmake build
- name: Package
run: python tools/buildscripts/build.py package
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ VS_Solution/vendor/
VS_Solution/Dependencies/
/VS_Solution/cppsdk/
Releases/
Binaries/
Intermediates/

# standard cmake build directory
/build
Expand Down Expand Up @@ -68,3 +70,6 @@ _ReSharper*/
# clangd cache
.cache
.xwin-cache

# xmake generated projects
vsxmake2022
247 changes: 0 additions & 247 deletions CMakeLists.txt

This file was deleted.

60 changes: 43 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ If you are planning on doing mod development using UE4SS, you can do the same as
- Visual Studio 2019 (recent versions), and Visual Studio 2022 will work.
- More compilers will hopefully be supported in the future.
- Rust toolchain 1.73.0 or greater
- [xmake](https://xmake.io/#/)


## Build instructions
Expand All @@ -64,26 +65,51 @@ If you are planning on doing mod development using UE4SS, you can do the same as
Make sure your Github account is linked to your Epic Games account for UE source access.
Do not use the `--remote` option because that will force third-party dependencies to update to the latest commit, and that can break things.
You will need your github account to be linked to an Epic games account to pull the Unreal pseudo code submodule.
3. There are three different ways you can build UE4SS.
1. Execute this command: `build_auto.bat <BuildMode> <Target>`, example: `build_auto.bat Release ue4ss`
Valid build modes are `Release` and `Debug`, and valid targets are `ue4ss` and `xinput1_3`.
Parallel compilation is enabled for this build method.
2. Open the root UE4SS directory in CLion, select `ue4ss` or `xinput1_3` from the target list and hit the build button.
Parallel compilation is **NOT** enabled for this build method.
3. Execute `VS_Solution/generate_vs_solution.bat` to generate a Visual Studio solution file.
Open the solution with Visual Studio 2019 or Visual Studio 2022, select the build type and build the `ue4ss` project.
Parallel compilation is enabled for this build method.

## Updating dependencies

If you want to update dependencies, you do so one of three ways:
1. You can execute `remote_update_first_party_submodules.bat` to update all first-party dependencies.
2. You can also choose to update dependencies one by one, by executing `git submodule update --init --recursive vendor/<RepoOwner>/<Repo>`.
Remember to not use the `--remote` option unless you actually want to update to the latest commit.
3. If you would rather pick a specific commit or branch to update a dependency to then `cd` into the submodule directory for that dependency and execute `git checkout <branch name or commit>`.

There are several different ways you can build UE4SS.

### Building from cli

Configure the project using this command: `xmake f -m "<BuildMode>"`

The build modes are structured as follows: `<Target>__<Config>__<Platform>`

Currently supported options for these are:

* `Target`
* `Game` - for regular games
* `CasePreserving` - for games built with case preserving enabled

* `Config`
* `Dev` - development build
* `Debug` - debug build
* `Shipping` - shipping(release) build
* `Test` - build for tests

* `Platform`
* `Win64` - 64-bit windows


Now to build it, just run `xmake`

### Opening in an IDE

#### Visual Studio / Rider

To generate Visual Studio project files, run the `xmake project -k vsxmake2022` command.

Afterwards open the generated `.sln` file inside of the `vsxmake2022` directory

Note that you should also commit & push the submodules that you've updated if the reason why you updated was not because someone else pushed an update, and you're just catching up to it.

## Updating git submodules

If you want to update git submodules, you do so one of three ways:
1. You can execute `git submodule update --init --recursive` to update all submodules.
2. You can also choose to update submodules one by one, by executing `git submodule update --init --recursive deps/<first-or-third>/<Repo>`.
Do not use the `--remote` option unless you actually want to update to the latest commit.
3. If you would rather pick a specific commit or branch to update a submodule to then `cd` into the submodule directory for that dependency and execute `git checkout <branch name or commit>`.
The main dependency you might want to update from time to time is `deps/first/Unreal`.
## Credits

All contributors since the project became open source: https://github.com/UE4SS-RE/RE-UE4SS/graphs/contributors
Expand Down
Loading

0 comments on commit 4ea0fb4

Please sign in to comment.