C/C++ 预编译工具:premake5 生成编译配置文件格式参考。

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" }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值