Skip to content

Commit

Permalink
build: add optional test build
Browse files Browse the repository at this point in the history
  • Loading branch information
futrime committed Dec 1, 2023
1 parent 349c441 commit 5d4da7c
Showing 1 changed file with 79 additions and 48 deletions.
127 changes: 79 additions & 48 deletions xmake.lua
Original file line number Diff line number Diff line change
@@ -1,70 +1,101 @@
add_rules("mode.debug", "mode.release")

includes("scripts/localbdslibrary.lua")

add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")

if not has_config("vs_runtime") then
set_runtimes("MD")
end

option("localbdslibrary")
set_default(false)
set_showmenu(true)
set_description("Use local bdslibrary")
option_end()

-- xmake-repo
add_requires("entt v3.12.2")
add_requires("gsl v4.0.0")
add_requires("leveldb 1.23")
add_requires("rapidjson v1.1.0")

-- ^^^ for mc / for ll vvv

-- Dependencies from xmake-repo.
add_requires("entt 3.12.2")
add_requires("fmt 10.1.1")
add_requires("magic_enum v0.9.0")
add_requires("nlohmann_json v3.11.2")
add_requires("gtest 1.12.1")
add_requires("gsl 4.0.0")
add_requires("leveldb 1.23")
add_requires("magic_enum 0.9.0")
add_requires("nlohmann_json 3.11.2")
add_requires("rapidjson 1.1.0")

-- liteldev-repo
add_requires("pcg_cpp v1.0.0")
add_requires("preloader v1.3.0")
add_requires("symbolprovider v1.1.0")
-- Dependencies from liteldev-repo.
add_requires("ctre 3.8.1")
add_requires("pcg_cpp 1.0.0")
add_requires("pfr 2.1.1")
add_requires("preloader 1.3.0")
add_requires("symbolprovider 1.1.0")

if has_config("tests") then
add_requires("gtest 1.12.1")
end

if has_config("localbdslibrary") then
add_requires("localbdslibrary")
else
add_requires("bdslibrary 1.20.41.02")
end

if not has_config("vs_runtime") then
set_runtimes("MD")
end

option("tests")
set_default(false)
set_showmenu(true)
set_description("Enable tests")

option("localbdslibrary")
set_default(false)
set_showmenu(true)
set_description("Use local bdslibrary")

target("LeviLamina")
set_license("LGPL-3")
set_kind("shared")
set_languages("c++23")
set_symbols("debug")
set_exceptions("none")
set_pcxxheader("src/mc/_HeaderOutputPredefine.h")
set_configdir("$(buildir)/config")
add_configfiles("src/(**.in)")
set_configvar("LL_WORKSPACE_FOLDER", "$(projectdir)")
add_headerfiles("src/(**.h)")
add_includedirs("./src", "$(buildir)/config")
add_cxflags("/utf-8", "/permissive-", "/EHa", "/W4")
add_defines(
"UNICODE", "LL_EXPORT", "WIN32_LEAN_AND_MEAN",
"CPPHTTPLIB_OPENSSL_SUPPORT", "_AMD64_", "NOMINMAX",
"_CRT_SECURE_NO_WARNINGS", "_ENABLE_CONSTEXPR_MUTEX_CONSTRUCTOR"
"_AMD64_",
"_CRT_SECURE_NO_WARNINGS",
"_ENABLE_CONSTEXPR_MUTEX_CONSTRUCTOR",
"CPPHTTPLIB_OPENSSL_SUPPORT",
"LL_EXPORT",
"NOMINMAX",
"UNICODE",
"WIN32_LEAN_AND_MEAN"
)
add_shflags("/DELAYLOAD:bedrock_server.dll")
add_files("src/**.cpp","src/**.rc")
add_packages("entt", "fmt", "gsl", "gtest", "leveldb",
"magic_enum", "nlohmann_json", "rapidjson",
"pcg_cpp", "symbolprovider", "ctre", "pfr",
"preloader", { public = true }
add_files(
"src/ll/api/**.cpp",
"src/ll/core/**.cpp",
"src/ll/core/**.rc",
"src/mc/**.cpp"
)
-- add_headerfiles("src/(**.h)")
add_includedirs(
"./src",
"$(buildir)/config"
)
add_packages(
"entt",
"fmt",
"gsl",
"leveldb",
"magic_enum",
"nlohmann_json",
"rapidjson",
"ctre",
"pcg_cpp",
"pfr",
"preloader",
"symbolprovider",
{ public = true }
)
add_rules("mode.debug", "mode.release")
add_shflags("/DELAYLOAD:bedrock_server.dll")
set_configdir("$(buildir)/config")
set_configvar("LL_WORKSPACE_FOLDER", "$(projectdir)")
set_exceptions("none")
set_kind("shared")
set_languages("c++23")
set_pcxxheader("src/mc/_HeaderOutputPredefine.h")
set_symbols("debug")

if has_config("tests") then
add_packages("gtest")
add_files("src/ll/test/**.cpp")
end

if has_config("localbdslibrary") then
add_packages("localbdslibrary")
else
Expand All @@ -75,8 +106,8 @@ target("LeviLamina")
local tag = os.iorun("git describe --tags --abbrev=0 --always")
local major, minor, patch, suffix = tag:match("v(%d+)%.(%d+)%.(%d+)(.*)")
if not major then
print("Failed to parse version tag, using 0.1.0")
major, minor, patch = 0, 1, 0
print("Failed to parse version tag, using 0.0.0")
major, minor, patch = 0, 0, 0
end
if suffix then
prerelease = suffix:match("-(.*)")
Expand Down

0 comments on commit 5d4da7c

Please sign in to comment.