Help with building Player on Windows

So I’d like to mess around with the source to the Player and then compile it, for the purpose of experimenting with it for my own project.

But I’m having a hell of a time building the thing.

I’ve been following both the Visual Studio guide and the CMake guide on the wiki and keep running into problems. I’m wondering if these guides are out of date, but there is the fact I’ve never tried building something from source before.

A lot of things I keep running into seem to be more effort than necessary, however I have the definite feeling that Linux is a much smoother development platform than Windows.

So to go over some of the things I’ve been doing:

  • Installed probably way too many packages for Visual Studio 2019 until things seemed to run.
    • Concern: Is VS2019 is different enough to 2015 to be causing problems?
  • Installed CMake for Windows, which comes with a GUI.
  • Messed around trying to build LIBLCF (re the wiki) until I ended up with liblcf.pc and liblcf-config.cmake files.
    • That said, those “.in” versions seemed to already exist, which I wasn’t entirely sure were the files I was after.
  • Downloaded the buildscripts, ran build.cmd, which iirc downloaded the packages for all the libraries. (I’ve messed around with so many things I don’t know where I’m at…)
  • Concern: I’ve set the environment variable EASYDEV_MSVC to the directory containing buildscripts-master\windows\vcpkg\buildtrees (i.e the full address), because “buildscripts/windows/build” doesn’t seem like it would mean anything to any program looking for the libraries. However I’m still not sure if this has done anything.
  • Attempted to run powershell .\setup.ps1 build v140 in VS, but always get The term '.\setup.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. The cmd windows starts in c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools>, and there is no setup.ps1 in the VS directory or the repositories I have. (Player, liblcf-0.6.2, buildscripts.)
  • Attempted to setup the cmake settings in VS. After specifying locations of SDL2 stuff (buildtrees/sdl2/, which I get the feeling should be automated re: the environment variable), the setup then asks for the locations of LCF things.
    • I am able to set liblcf_DIR to [parent dirs]liblcf-0.6.2\builds, and LIBLCF_INCLUDE_DIR to liblcf-0.6.2\src.
    • However I am then stumped by Could NOT find liblcf (missing: LIBLCF_LIBRARY) (found version "0.6.2") with no way to specify it.
  • I have also attempted to cmake… via Cmake itself. I specify VS2019, the toolchain in the buildscripts directory, and do some similar things to the above.
    • However I am then able to add LIBLCF_LIBRARY (pointed to the repository root).
    • It then asks about ICU. Instead of inputting the things its after, I set ICU_ROOT after finding this page. It gives me errors when I refresh it after this, but this variable populates the numerous exe references, so I can then delete it.
    • … I then tell every subsequent library it asks for that it’s under [etc]\buildscripts-master\windows\vcpkg\buildtrees, until it seems to have found everything. After PIXMAN, it asks for the rest of the libraries in bulk. (Before this it would throw an error after SDL2, LCF, ICU, ZLIB, PNG, maybe others, before continuing.)
    • So once again, I send every _LIBRARY and _INCLUDE_DIR at [etc]\buildscripts-master\windows\vcpkg\buildtrees.
    • Some libraries don’t seem to be under buildtrees (eg. XMP), so I simply point at the directory in general until things pass through without an error. “Freetype” inexplicably decides it can no longer be found at some point, so I point it at its directory again.
    • I get the warning Using SDL2_mixer directly for playback or resampling is not recommended..
  • Once configuration completes without a problem, I hit generate…
  • … and get VS2019 project files. No exe. (I’ve even include some arguments from buildscripts-master\windows\ - VCPKG_TARGET_TRIPLET=x64-windows-static - just to be sure, but nope.)
  • So I start up VS2019 in the build directory. I try building ALL_BUILD, INSTALL, and ZERO_CHECK, but they all fail, notably with the output error fatal error LNK1104: cannot open file 'Debug\EasyRPG_Player.lib'.
  • Trying “Build solution” with the root of the project also seems to fail, with numerous errors about the source code as it does so.

There’s probably other information in the output as I’m attempting to build but I would have no idea where to begin. As I mentioned, I’m pretty sure I’m doing something wrong if I’m having to manually point CMake at each. and every. library. to get it to build a VS project.

It should also be noted that trying to run cmake from cmd as per this page gives me The token '&&' is not a valid statement separator in this version.. That’s a bust too.

This is all clear as mud to me and any help to make building smoother/actually work (perhaps clarify the wiki pages) would be wonderful.

After all this, toying with C++ code is going to be a cakewalk, frankly.

Yeah the wiki is outdated/stale. EASYDEV_MSVC is not needed anymore. When you already ran build.cmd this is good. then you can skip this step and move directly over to cmake invocation (Step 2). I recommend that you delete the Player folder and start from zero.

  1. Get the latest buildscripts from the repo and follow the instructions: (the requirements are wrong, you need VS2019). Basicly just invoke “build.cmd”
  2. Use the CMake command listed under “After compiling” to build liblcf and Player. For development purposes you can ask Player to build liblcf for you. This is possible with (-DPLAYER_BUILD_LIBLCF=ON)

Hi, thanks for the tips.

Following your suggestion (and using PLAYER_BUILD_LIBLCF because I remember being stumped as to where it wanted me to put liblcf within the Player dir) appears to be much smoother, since it’s not asking me to fill in everything, aha.

I remember trying to use the line in that, but because it asked about liblcf and I wasn’t sure where to put it, I went on to try other methods.

So trying that, similar to previous experiences, it stops when it struggles to find Freetype… despite already finding it.

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.18363.
-- Windows: Using static runtime library (/MT)
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "")
Cloning into '[snip]/Player-master/lib/liblcf'...
-- Windows: Using static runtime library (/MT)
-- Found Doxygen: C:/Program Files/doxygen/bin/doxygen.exe (found version "1.8.18 (a1b07ad0e92e4526c9ba1711d39f06b58c2a7459)") found components: doxygen missing components: dot
-- Found the following ICU libraries:
--   i18n (required)
--   uc (required)
--   data (required)
--   data (required)
-- Found ICU: [snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/include (found version "65.1")
-- Found EXPAT: [snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/lib/expat.lib (found version "2.2.7")
-- Found ZLIB: optimized;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/lib/zlib.lib;debug;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/debug/lib/zlibd.lib (found version "1.2.11")
-- Found PNG: optimized;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/lib/libpng16.lib;debug;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/debug/lib/libpng16d.lib (found version "1.6.37")
-- Found Pixman: optimized;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/lib/pixman-1.lib;debug;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/debug/lib/pixman-1d.lib
-- Found Freetype: optimized;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/lib/freetype.lib;debug;[snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/debug/lib/freetyped.lib (found version "2.10.2")
CMake Error at builds/cmake/Modules/FindHarfbuzz.cmake:58 (find_library):
  Could not find Freetype using the following names:
Call Stack (most recent call first):
  [snip]/buildscripts-master/windows/vcpkg/scripts/buildsystems/vcpkg.cmake:415 (_find_package)
  builds/cmake/Modules/FindFreetype.cmake:177 (find_package)
  [snip]/buildscripts-master/windows/vcpkg/installed/x64-windows-static/share/freetype/vcpkg-cmake-wrapper.cmake:1 (_find_package)
  [snip]/buildscripts-master/windows/vcpkg/scripts/buildsystems/vcpkg.cmake:370 (include)
  builds/cmake/Modules/PlayerFindPackage.cmake:53 (find_package)
  CMakeLists.txt:520 (player_find_package)

The problem area appears to be the following in FindHarfbuzz.cmake in the Player repo:

	if(NOT TARGET Harfbuzz::Harfbuzz)
		add_library(Harfbuzz::Harfbuzz UNKNOWN IMPORTED)
		find_library(Freetype REQUIRED)
		set_target_properties(Harfbuzz::Harfbuzz PROPERTIES

EDIT: Altering find_library to provide it with names and re-running the build seems to do something.

		find_library(Freetype     NAMES

I run cmake again, end up with VS files again, do Build Solution, and finally appear to get a Player.exe under Player-master\Debug.
… something about this seems not quite right though. hm.

The freetype error is strange and shouldn’t happen. Need to check this :thinking:
But great that it works

Progress: after being confused about C++'s quirks for a bit, hey I manage to show a custom actor name in the save screen. i.e. one dedicated to a location name. (oops then I forgot about name lengths.)
… I then try out face graphics in the battle status. (And fix some misalignment I mention in an issue.) Neat.

… less fun, is inexplicable lag in medium-to-large maps, lag that doesn’t exist if I download the latest official build. Either I’m building off of an older version, or I broke something somewhere when running cmake…

… on a more C++ side, I wonder if there’s a way I can make a dedicated file for my edits (since they’ll be 99% window stuff) that I just append to repo downloads? That way I can download the latest version and update things as they come, without having to paste in my changes to various files…

Cool :slight_smile:

This is likely caused by the build type. “Debug” is extremely slow (but you will need it for fixing bugs). For releases you should use “RelWithDbgInfo”.
Note that you must run the CMake generator again with “-DCMAKE_BUILD_TYPE=RelWithDbgInfo”. In a perfect world one Visual Studio solution would work for both but… well… :confused:

You should read about “git”. This is a source code management tool we use. It also supports the “get the latest code and integrate mine” step but this only works when the change is “conflict free”. This means that the upstream (upstream = The main repository of EasyRPG Player) does not change lines you changed. Maintaining such a patch set can be sometimes annoying.

The workflow is basicly.

  1. click the “Fork” button on github
  2. git clone that repo and run:
    git clone
    git remote add upstream
  3. Create a branch:
    git checkout -b mychanges (replace mychanges with any branch name)
  4. Copy your changes over to this branch. Then use “git add” or a GUI to add your files. Use “git commit” to store your changes.
  5. To sync with upstream do:
    git fetch upstream
    git rebase upstream/master
    The rebase step can fail with a “Conflict” in that case you have to read about conflict resolution.

I thought for sure I did cmake with something other than Debug, hence I was not sure why I got debug folders when building.
… yep, brings up CMAKE_BUILD_TYPE, and I used -DCMAKE_BUILD_TYPE=Release based on my saved pile of command lines. So RelWithDbgInfo is prefered?

RelWithDbgInfo enables debug symbols. So when it crashes you can at least do some debugging, with Release it will just tell you “No Symbols”. But otherwise is the same.

You have to configure with Release AND select Release in Visual Studio. When you select Debug in Visual Studio it will link against (some) debug libraries.

That’s a technical issue with some libraries. When you run CMake you see stuff like “Found ZLIB: optimized;debug;” When a lib reports optimized;debug it supports this multi-project mode (Debug & Release at once). If not it will only use Debug & Release for both depending on the BUILD_TYPE.