ShikyoKira / Project-New-Reign---Nemesis-Main

Animation Behavior Patching Tool
GNU General Public License v3.0
466 stars 183 forks source link

Rewrite the outdated build instructions in README.md and redo the CMakeLists.txt files to fix errors. #711

Open ClementineAccount opened 2 years ago

ClementineAccount commented 2 years ago

The following issues must be addressed for the project to be maintainable by other contributors in its current state.

  1. Instructions for the README.md should be rewritten to be clearer and easy to follow, leaving no room for ambiguity.
  2. The CMakeList.txt should be as 'plug and play' as possible. Simply running it from Visual Code or Visual Studio on Windows while following the README.md instructions should be enough to get a working build running as soon as possible. The least time is wasted attempting to get the project to build, the more time can be spent on fixing other issues, bugs or adding features.

The rest of this post is a write up of the varius concerns that I have noticed about the current state of the project when it comes to building. As of writing this issue, I am still unable to successfully build Nemesis for my own development.


Note that this issue is similar to the following opened issues:

Resolving this issue will resolve these three other issues automatically.

README.md is outdated

The README.md references a version of the repo that was dependant on Visual Studios and a different version of CPython. This is no longer the case, making the Readme unhelpful for new contributors.


The current CMakeLists files references Python 3.8.2 while the README.md references Python 3.5.6 (Inconsistent Python versions)

image

image


Qt5 5.14.1 is not as easily accessible

The version of Qt5 set by the current CMakeLists.txt is not easily accessible using the Qt Online Installer. There are also no instructions on obtaining the correct Qt5 version for the project. image

image

Boost.cmake is broken

Boost.cmake leads to a now dead page.. This link must be replaced with one to a publicly accessible repo. image


This creates several, very difficult to resolve build errors with CMake, predictably, as developers have to make guesses and assumptions as to how the project is intended to be built. The following are examples of Build errors I have encountered in my attempt to build Nemesis, which require non-trivial fixes and research from the developer to modify.

image image

(libftfi-7.lib is likely caused by Python.cmake)


ClementineAccount commented 2 years ago

Note for anyone reading from the bounty

I will do the payout even if the issue is resolved by replacing CMakeLists.txt entirely with a different build method. Possiblities include reverting back to .Sln files (since the project makes one using CMake anyways) or Meson. As long as the project can be built easily with the revised instructions and methods.

Akira13641 commented 2 years ago

A bigger problem TBH is the fact that this thing links directly against the 32-bit 2010 Havok SDK. I don't even understand how he was managing that with VS2019, let alone how anyone would manage it with VS2022.

Feel like it can't be really necessary given there's no way FNIS was doing that for example.

I wouldn't expect expect a response for Shiyko anytime soon though. Dude doesn't care enough to even bother showing up to fix absolute gems such as this and also this.

SARDONYX-sard commented 11 months ago

I managed to build Nemesis on the master branch after a difficult hundred hours of work.

Even with local my PC VS2022, I was able to generate an exe by installing what I needed and modifying some code.

I'm using VS2019 with GitHub Action because I need the v140 feature for the Cpython 3.8.2 build, but if I can check the v140 feature in the GUI on VS2022 which I did locally in some way and install it windows-latest. and install it, it should be possible to build with windows-latest.

CI Result

Remain unknown

How to fix

Change Diff

Dependencies

param (
  [switch]
  $Verbose,
  [switch]
  $Deploy
)

#! NOTE: VS2022 gives me a syntax error when I try to compile 5.14.2. Therefore, use the one for VS2019.
# If GitHub CI definition, then ignore.
if (!$env:Qt5_DIR) {
  $env:Qt5_DIR = Join-Path -Path $(Get-Location) -ChildPath "build/5.15.2/msvc2019/lib/cmake"
  if (!$(Test-Path $env:Qt5_DIR)) {
    Write-Host "Not found aqt(Qt install command). Try to install with Python3..." -ForegroundColor Cyan
    if (Get-Command rye -ErrorAction SilentlyContinue) { rye install apt }
    elseif (Get-Command python3 -ErrorAction SilentlyContinue) { pip install aqt }
    else { throw "Couldn't found Python3" }
    aqt install-qt windows desktop 5.15.2 win32_msvc2019 -O ./build
  }
}

$local:IsVerbose = if ($Verbose) { 1 } else { 0 }

# -S: source path
# -B: build path
# -A Win32: Need IA-32(32bit) mode for `hkxcmd`
cmake -S . -B ./build -A Win32 -D CMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE="$IsVerbose"
cmake --build ./build -j $Env:NUMBER_OF_PROCESSORS --config Release

if ($Deploy) {
  Copy-Item -Path ./build/Release/NemesisUnlimitedBehaviorEngine.exe -Destination './test environment' -Force
  Copy-Item -Path './build/_deps/cpython-src/PCbuild/win32/python38.dll' -Destination './test environment' -Force

  # This command will copy the dlls needed to run
  if (Test-Path './build/5.15.2/msvc2019/bin/windeployqt') {
    ./build/5.15.2/msvc2019/bin/windeployqt './test environment/NemesisUnlimitedBehaviorEngine.exe'
  }
  elseif (Get-Command windeployqt -ErrorAction SilentlyContinue) {
    windeployqt './test environment/NemesisUnlimitedBehaviorEngine.exe'
  }
  else { throw "Couldn't find windeployqt.exe" }

  Compress-Archive -Path './test environment/*' -DestinationPath './NemesisUnlimitedBehaviorEngine-x86-windows-msvc'
}

Execute the following PowerShell command.

./build.ps1

The current code in the master branch has so many errors in the build that I have no idea how it was built.