-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compiling on Windows (vcpkg)
If you want to compile 1.6+ in Debug mode with .sln (not cmake), then you have to apply the following patch (or change it by hand)
Patch
diff --git a/src/http/cacheinfo.cpp b/src/http/cacheinfo.cpp
index 3e7b8f32..0a4d918a 100644
--- a/src/http/cacheinfo.cpp
+++ b/src/http/cacheinfo.cpp
@@ -1,8 +1,8 @@
-#include "../otpch.h"
+#include "otpch.h"
#include "cacheinfo.h"
-#include "../database.h"
+#include "database.h"
#include "error.h"
namespace beast = boost::beast;
diff --git a/src/http/error.cpp b/src/http/error.cpp
index bb5ff177..16229eb7 100644
--- a/src/http/error.cpp
+++ b/src/http/error.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
#include "error.h"
namespace beast = boost::beast;
diff --git a/src/http/http.cpp b/src/http/http.cpp
index cd4fb999..348da0a8 100644
--- a/src/http/http.cpp
+++ b/src/http/http.cpp
@@ -1,5 +1,5 @@
#define BOOST_ASIO_NO_DEPRECATED
-
+#include "otpch.h"
#include "http.h"
#include "listener.h"
diff --git a/src/http/listener.cpp b/src/http/listener.cpp
index 9228beb8..67ad4b38 100644
--- a/src/http/listener.cpp
+++ b/src/http/listener.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
#include "listener.h"
#include "session.h"
diff --git a/src/http/login.cpp b/src/http/login.cpp
index bd224589..feb77482 100644
--- a/src/http/login.cpp
+++ b/src/http/login.cpp
@@ -1,9 +1,9 @@
-#include "../otpch.h"
+#include "otpch.h"
#include "login.h"
-#include "../base64.h"
-#include "../game.h"
+#include "base64.h"
+#include "game.h"
#include "error.h"
#include <fmt/format.h>
diff --git a/src/http/router.cpp b/src/http/router.cpp
index 3614419d..abbb0763 100644
--- a/src/http/router.cpp
+++ b/src/http/router.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
#include "router.h"
#include "cacheinfo.h"
diff --git a/src/http/session.cpp b/src/http/session.cpp
index dcaa1fdf..ee7f32f9 100644
--- a/src/http/session.cpp
+++ b/src/http/session.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
#include "session.h"
#include "router.h"
diff --git a/vc17/theforgottenserver.vcxproj b/vc17/theforgottenserver.vcxproj
index 888e01ac..b8b79a90 100644
--- a/vc17/theforgottenserver.vcxproj
+++ b/vc17/theforgottenserver.vcxproj
@@ -95,7 +95,7 @@
<Optimization>Disabled</Optimization>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
- <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
@@ -110,7 +110,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
- <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
@@ -128,7 +128,7 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
- <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
@@ -150,7 +150,7 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
- <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
To compile on Windows, you will need to download and install:
- Git
- Visual Studio 2022 Community (compiler, make sure to install with the English language pack)
- vcpkg (package manager)
Make sure to follow full installation of vcpkg, per Official Quickstart execute the following in cmd or Powershell:
To open Powershell navigate to your desired directory and choose Open PowerShell window here
(shift + right click).
If you prefer cmd
(command prompt) click on your Start
windows button or just use the windows key on your keyboard and search for cmd
then navigate to your desired directory using cd
e.g. you want to have your vcpkg folder on root of your C drive:
cd C:\
then you can safely proceed with configuring vcpkg (may require administrator elevation)
git clone https://github.com/Microsoft/vcpkg && cd vcpkg && .\bootstrap-vcpkg.bat && .\vcpkg integrate install
git clone --recursive https://github.com/otland/forgottenserver.git
Choose one set of libraries, depending on the target platform and execute the following in Git Bash or Powershell:
Note: boost-filesystem is only needed from 4b800b2 or older
-
For 64-bit (x64) build:
.\vcpkg install --triplet x64-windows boost-iostreams boost-asio boost-system boost-variant boost-lockfree boost-locale boost-beast boost-json luajit libmariadb pugixml openssl fmt zlib
-
For 32-bit (Win32) build:
.\vcpkg install boost-iostreams boost-asio boost-system boost-variant boost-lockfree boost-locale boost-beast boost-json luajit libmariadb pugixml openssl fmt zlib
-
Open
vc17/theforgottenserver.vcxproj
. This should launch Visual Studio. -
Choose build configuration from the drop downs (Debug or Release and Win32 or x64). For best performance choose Release & x64.
-
To start compiling press F7.