Closed whocares0101 closed 5 years ago
The instructions are outdated, you have to use the one in the upstream repo. In short: You can't use these "baked in" libraries for MSVC (I discourage using them in general, but there buildbots need them....)
First you must install all dependencies through vcpkg:
Clone https://github.com/EasyRPG/buildscripts/ and run windows\build.cmd This will compile all dependencies except liblcf. Takes at least 1h, compiling this is slow.... (you can save some time by deleting the x86 or x64 build line from build.cmd, depending on what you don't need)
For compiling liblcf you can't currently use upstream because it is already again diverged too much. Use the bundled liblcf instead: builds/libretro/deps/libretro/liblcf/ When you copy-paste that liblcf folder to lib/liblcf it will work with -DPLAYER_BUILD_LIBLCF=ON btw.
The CMake configuration for Player:
cmake -DSHARED_RUNTIME=OFF -DVCPKG_TARGET_TRIPLET=x64-windows-static
-DCMAKE_TOOLCHAIN_FILE=[CHANGE_TO_VCPKG_PATH]\scripts\buildsystems\vcpkg.cmake
-DCMAKE_BUILD_TYPE=Release -DPLAYER_TARGET_PLATFORM=libretro
-DPLAYER_BUILD_LIBLCF=ON
for x86 it is x86-windows-static
This still doesn't work.
I used build.cmd, without the x86 part it took around 20 minutes. There was an error mentioning msys2 (build_log.txt) not sure if this is a real problem, the script continued anyway.
Cmake worked by the looks of it, it generated a VS solution and project files. cmake_log.txt
But VS generated 218 errors (vs_log.txt) for EasyRPG_Player. Also platform shows Win32 everywhere, not sure if this is ok or not.
The vcpkg and CMake logfiles look fine.
About the VS build errors: Right, these are also things that were fixed upstream already. Ensure first that you have the latest version of VS2015 (all updates installed, otherwise /utf-8 is unavailable).
Add these 4 lines to the CMakeLists.txt: https://github.com/EasyRPG/Player/blob/master/CMakeLists.txt#L388
# MSVC: Set UTF-8 encoding for all files (important for rtp table)
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE "/utf-8")
endif()
Delete the CMakeCache.txt afterwards before rerunning CMake to generate the Visual Studio project.
Also platform shows Win32 everywhere, not sure if this is ok or not.
No, this is wrong. Before generating the Visual Studio project with CMake open from the start menu a "Visual Studio command prompt". Select the x64 or x86_x64 cross tools one.
In the toolbar you should be able to switch to x64 and Release.
Even with VS2015 x64 Native Tools Command Prompt
I get Win32 in the configuration manager, no idea why, I changed this manually to x64.
The projects lcf, retro_common, and EasyRPG_Player have /machine:X86
set under additional options which needs to be changed manually for x64.
The default for EasyRPG_Player is to build a static library, I changed it to dynamic.
The project retro_common uses /MD(d), lcf and EasyRPG_Player use /MT(d), I changed it to /MT(d).
Needed to add the library path to the VC directories > C:\tmp\buildscripts\windows\vcpkg\installed\x64-windows-static\lib
Also needed to manually add the static libraries to EasyRPG_Player additional dependencies.
There are four instances of DEBUG_VALIDATE();
in scene.cpp which are undeclared, I just commented them.
scene.cpp(161): error C2065: '__PRETTY_FUNCTION__': undeclared identifier
The debug release does not compile
icuin.lib(csdetect.ao) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in async_handler.obj
according to https://stackoverflow.com/a/12950627/1373630 this is a mismatch between debug and release runtimes.
But I have set lcf, retro_common, and EasyRPG_Player to /MTd, maybe ICU uses /MT?
vs_debug_log.txt
The release build did compile however and can be loaded with RetroArch it also gets me to the title screen of VD2 and reliably crashes with command line arguments.
Here are the sln and project files created by cmake and the ones I have modified. vs_sln_cmake.zip vs_sln_mod.zip
I always use the built-in CMake support in Visual Studio 2017, therefore I sometimes forget some stuff.
Well "-DSHARED_RUNTIME=OFF" will use "/MT" (or /MTd) which matches the vcpkg configuration. To build a DLL use "-DBUILD_SHARED_LIBS=ON", I forgot this one.
When creating the project with CMake try generator '-G " Visual Studio 14 2015 Win64"'.
The library mismatch is a non fixable problem in the generator because it is a CMake limitation: The debug and release libraries are in different folders but some of them have the same name, therefore CMake will pick Debug even for Release (or Release for Debug).
That is the reason why you must specifiy the "-DCMAKE_BUILD_TYPE=Release" or "-DCMAKE_BUILD_TYPE=Debug" when generating the project. Is annoying but there is no way to solve it, even asked the vcpkg maintainers :/.
It also crashes with command line in Visual studio? Thats interesting, I assumed this is a MinGW problem.
Building this is far too complicated for my taste, I'm not really using VS or C++ normally. But I got a build reatroarch would load and this was enough as it seems. So thanks for the support.
The instructions in README.md don't work for me.
Software:
VS2015 Update3 community edition on win7 x64 cmake version 3.10.2
What I tried:
Adding
-DPLAYER_BUILD_LIBLCF=ON
didn't work either.