Linux:
premake5 gmake
cd build
make –j[n] config=release #编译Release版
make –j[n] #编译Debug版
Windows:
批处理文件:
premake.bat
premake5 vs2019
脚本配置文件:
premake5.lua
workspace "Server"
configurations { "Debug", "Release" }
--rtti "Off"
floatingpoint "Fast"
location "build"
flags { "MultiProcessorCompile", "NoPCH", "Symbols" }
filter { "system:windows" }
architecture "x86"
defines { "_WIN32" }
filter { "system:linux" }
architecture "x86_64"
filter { "configurations:Debug" }
defines { "DEBUG" }
symbols "On"
filter { "configurations:Release" }
defines { "NDEBUG" }
staticruntime "On"
optimize "On"
symbols "On"
configuration "vs*"
disablewarnings { 4005, 4251, 4828, 4819, 4996 }
buildoptions { "/utf-8" }
startproject "GameServer"
group "lib"
project "Common"
language "C++"
cppdialect "C++17"
kind "StaticLib"
targetdir "../ServerEngine/lib/%{cfg.buildcfg}"
files { "Common/**.h", "Common/**.cpp" }
includedirs
{
"../3rdParty/fmt-9.1.0/include",
"../3rdParty/boost_1_81_0",
"../3rdParty/flatbuffers-23.3.3/include",
"../3rdParty/oneTBB-2020.1/include",
"../3rdParty/rapidjson/include",
"../3rdParty/openssl-1.1.1o/include",
"../ServerEngine/EngineCore/include",
"../ServerEngine/EngineNetwork/include",
"Common/fbs",
"Common/Effect",
}
group "server"
project "GameServer"
language "C++"
cppdialect "C++17"
kind "ConsoleApp"
targetdir "../../server/bin/%{cfg.buildcfg}"
debugdir "$(OutDir)"
files { "GameServer/**.h", "GameServer/**.cpp", "GameServer/**.c" }
defines { "WITH_GAME_SERVER" }
includedirs
{
"../3rdParty/fmt-9.1.0/include",
"../3rdParty/boost_1_81_0",
"../3rdParty/flatbuffers-23.3.3/include",
"../3rdParty/oneTBB-2020.1/include",
"../3rdParty/mysql-connector-c-6.1.11/include",
"../3rdParty/enet-1.3.15/include",
"../3rdParty/LuaJIT-2.1.0-beta3/src",
"../3rdParty/Simple-Web-Server",
"../3rdParty/openssl-1.1.1o/include",
"../3rdParty/rapidjson/include",
"../ServerEngine/EngineCore/include",
"../ServerEngine/EngineNetwork/include",
"../ServerEngine/EngineMysql/include",
"../ServerEngine/EngineRedis/include",
"Common",
"Common/fbs",
"Common/Effect",
"GameServer",
"GameServer/Utility/enet",
"GameServer/Utility/cjson",
"GameServer/Utility/LuaTinker",
"GameServer/Utility",
"GameServer/Utility/AttributeSet",
"GameServer/Utility/Save",
"GameServer/Services/Network",
"GameServer/Services/ClientSession",
"GameServer/Services/TestLogin",
"GameServer/Services/Mysql",
"GameServer/Services/StatisticsLog",
"GameServer/Services/Redis",
"GameServer/Services/Logic",
"GameServer/Services/Battle",
"GameServer/Services/HttpAccess",
"GameServer/Player",
"GameServer/Object",
"GameServer/Object/Hero",
"GameServer/Object/HeroSkin",
"GameServer/Object/Item",
"GameServer/Object/Equipment",
"GameServer/Object/Furniture",
"GameServer/Object/Task",
"GameServer/Object/Team",
"GameServer/Battle",
"GameServer/Recruit",
"GameServer/Shop",
"GameServer/Mail",
"GameServer/Notice",
"GameServer/Banner",
"GameServer/House",
"GameServer/MonthCard",
"GameServer/SignInBoard",
"GameServer/Arena",
"GameServer/Global/OfflinePlayerData",
"GameServer/Global/Guild",
"GameServer/Global/Arena",
"GameServer/Global/House",
}
libdirs
{
"../3rdParty/boost_1_81_0/stage/lib",
"../3rdParty/lib/%{cfg.buildcfg}",
"../3rdParty/lib",
"../3rdParty/openssl-1.1.1o/lib",
"../3rdParty/openssl-1.1.1o",
"../ServerEngine/lib/%{cfg.buildcfg}"
}
links { "Common", "EngineRedis", "EngineMysql", "EngineNetwork", "EngineCore", "flatbuffers", "lz4", "hiredis", "enet", "boost_coroutine", "boost_context" }
filter { "system:windows", "configurations:Debug" }
includedirs
{
"../3rdParty/redis-win-3.2.100/deps/hiredis",
}
links { "lua51", "libmysql", "libssl", "libcrypto", "tbb_debug", "tbbmalloc_debug", "Win32_Interop" }
filter { "system:windows", "configurations:Release" }
includedirs
{
"../3rdParty/redis-win-3.2.100/deps/hiredis",
}
links { "lua51", "libmysql", "libssl", "libcrypto", "tbb", "tbbmalloc", "Win32_Interop" }
filter { "system:linux" }
includedirs
{
"../3rdParty/hiredis-0.14.1",
}
links { "luajit", "mysqlclient", "ssl", "crypto", "tbb", "tbbmalloc_proxy", "tbbmalloc", "pthread", "stdc++fs", "dl" }
project "LoginServer"
language "C++"
cppdialect "C++17"
kind "ConsoleApp"
targetdir "../../server/bin/%{cfg.buildcfg}"
debugdir "$(OutDir)"
files { "LoginServer/**.h", "LoginServer/**.cpp" }
defines { "WITH_LOGIN_SERVER" }
includedirs
{
"../3rdParty/fmt-9.1.0/include",
"../3rdParty/boost_1_81_0",
"../3rdParty/flatbuffers-23.3.3/include",
"../3rdParty/oneTBB-2020.1/include",
"../3rdParty/mysql-connector-c-6.1.11/include",
"../3rdParty/Simple-Web-Server",
"../3rdParty/openssl-1.1.1o/include",
"../3rdParty/rapidjson/include",
"../ServerEngine/EngineCore/include",
"../ServerEngine/EngineNetwork/include",
"../ServerEngine/EngineMysql/include",
"../ServerEngine/EngineRedis/include",
"Common",
"Common/fbs",
"Common/Effect",
"LoginServer",
"LoginServer/Network",
"LoginServer/Mysql",
"LoginServer/Login",
"LoginServer/Redis",
"LoginServer/Wrapper",
}
libdirs
{
"../3rdParty/boost_1_81_0/stage/lib",
"../3rdParty/lib/%{cfg.buildcfg}",
"../3rdParty/lib",
"../3rdParty/openssl-1.1.1o/lib",
"../3rdParty/openssl-1.1.1o",
"../ServerEngine/lib/%{cfg.buildcfg}",
}
links { "Common", "EngineRedis", "EngineMysql", "EngineNetwork", "EngineCore", "flatbuffers", "lz4", "hiredis", "boost_coroutine", "boost_context" }
filter { "system:windows", "configurations:Debug" }
includedirs
{
"../3rdParty/redis-win-3.2.100/deps/hiredis",
}
links { "libmysql", "libssl", "libcrypto", "tbb_debug", "tbbmalloc_debug", "Win32_Interop" }
filter { "system:windows", "configurations:Release" }
includedirs
{
"../3rdParty/redis-win-3.2.100/deps/hiredis",
}
links { "libmysql", "libssl", "libcrypto", "tbb", "tbbmalloc", "Win32_Interop" }
filter { "system:linux" }
includedirs
{
"../3rdParty/hiredis-0.14.1",
}
links { "mysqlclient", "ssl", "crypto", "tbb", "tbbmalloc_proxy", "tbbmalloc", "pthread", "stdc++fs" }
project "GMServer"
language "C++"
cppdialect "C++17"
kind "ConsoleApp"
targetdir "../../server/bin/%{cfg.buildcfg}"
debugdir "$(OutDir)"
files { "GMServer/**.h", "GMServer/**.cpp" }
includedirs
{
"../3rdParty/fmt-9.1.0/include",
"../3rdParty/boost_1_81_0",
"../3rdParty/flatbuffers-23.3.3/include",
"../3rdParty/oneTBB-2020.1/include",
"../3rdParty/mysql-connector-c-6.1.11/include",
"../3rdParty/rapidjson/include",
"../ServerEngine/EngineCore/include",
"../ServerEngine/EngineNetwork/include",
"../ServerEngine/EngineMysql/include",
"../ServerEngine/EngineRedis/include",
"Common",
"Common/fbs",
"Common/Effect",
"GMServer",
"GMServer/Network",
"GMServer/Mysql",
"GMServer/Redis",
"GMServer/Login",
}
libdirs
{
"../3rdParty/boost_1_81_0/stage/lib",
"../3rdParty/lib/%{cfg.buildcfg}",
"../3rdParty/lib",
"../ServerEngine/lib/%{cfg.buildcfg}",
}
links { "Common", "EngineRedis", "EngineMysql", "EngineNetwork", "EngineCore", "flatbuffers", "lz4", "hiredis", "boost_coroutine", "boost_context" }
filter { "system:windows", "configurations:Debug" }
includedirs
{
"../3rdParty/redis-win-3.2.100/deps/hiredis",
}
links { "libmysql", "tbb_debug", "tbbmalloc_debug", "Win32_Interop" }
filter { "system:windows", "configurations:Release" }
includedirs
{
"../3rdParty/redis-win-3.2.100/deps/hiredis",
}
links { "libmysql", "tbb", "tbbmalloc", "Win32_Interop" }
filter { "system:linux" }
includedirs
{
"../3rdParty/hiredis-0.14.1",
}
links { "mysqlclient", "tbb", "tbbmalloc_proxy", "tbbmalloc", "pthread", "stdc++fs" }
group ""
project "Robot"
language "C++"
cppdialect "C++17"
kind "ConsoleApp"
targetdir "../../server/bin/%{cfg.buildcfg}"
debugdir "$(OutDir)"
files { "Robot/**.h", "Robot/**.cpp" }
defines { "WITH_ROBOT" }
includedirs
{
"../3rdParty/fmt-9.1.0/include",
"../3rdParty/boost_1_81_0",
"../3rdParty/flatbuffers-23.3.3/include",
"../3rdParty/oneTBB-2020.1/include",
"../3rdParty/openssl-1.1.1o/include",
"../ServerEngine/EngineCore/include",
"../ServerEngine/EngineNetwork/include",
"Common",
"Common/fbs",
"Common/Effect",
"Robot",
"Robot/Network",
}
libdirs
{
"../3rdParty/boost_1_81_0/stage/lib",
"../3rdParty/lib/%{cfg.buildcfg}",
"../3rdParty/lib",
"../3rdParty/openssl-1.1.1o/lib",
"../3rdParty/openssl-1.1.1o",
"../ServerEngine/lib/%{cfg.buildcfg}"
}
links { "Common", "EngineNetwork", "EngineCore", "flatbuffers", "lz4" }
filter { "system:windows", "configurations:Debug" }
links { "libssl", "libcrypto", "tbb_debug", "tbbmalloc_debug" }
filter { "system:windows", "configurations:Release" }
links { "libssl", "libcrypto", "tbb", "tbbmalloc" }
filter { "system:linux" }
links { "ssl", "crypto", "tbb", "tbbmalloc", "pthread", "stdc++fs" }
project "TestClient"
language "C++"
cppdialect "C++17"
kind "ConsoleApp"
targetdir "../../server/bin/%{cfg.buildcfg}"
debugdir "$(OutDir)"
files { "TestClient/**.h", "TestClient/**.cpp" }
includedirs
{
"../3rdParty/fmt-9.1.0/include",
"../3rdParty/boost_1_81_0",
"../3rdParty/flatbuffers-23.3.3/include",
"../3rdParty/oneTBB-2020.1/include",
"../3rdParty/Simple-Web-Server",
"../3rdParty/openssl-1.1.1o/include",
"../ServerEngine/EngineCore/include",
"../ServerEngine/EngineNetwork/include",
"Common",
"Common/fbs",
"TestClient",
"TestClient/Network",
}
libdirs
{
"../3rdParty/boost_1_81_0/stage/lib",
"../3rdParty/lib/%{cfg.buildcfg}",
"../3rdParty/lib",
"../3rdParty/openssl-1.1.1o/lib",
"../3rdParty/openssl-1.1.1o",
"../ServerEngine/lib/%{cfg.buildcfg}"
}
links { "Common", "EngineNetwork", "EngineCore", "flatbuffers", "lz4" }
filter { "system:windows", "configurations:Debug" }
links { "libssl", "libcrypto", "tbb_debug", "tbbmalloc_debug" }
filter { "system:windows", "configurations:Release" }
links { "libssl", "libcrypto", "tbb", "tbbmalloc" }
filter { "system:linux" }
links { "ssl", "crypto", "tbb", "tbbmalloc", "pthread", "stdc++fs" }