Skip to content

Commit

Permalink
Update premake5.lua
Browse files Browse the repository at this point in the history
- Support arm architecture
- Add ability to use system libraries
- Add options to use custom paths for edge cases
- Remove redundant --std=c++20 buildoption
  • Loading branch information
forgee committed Dec 28, 2024
1 parent ceaeb5c commit 9d12fdb
Showing 1 changed file with 68 additions and 9 deletions.
77 changes: 68 additions & 9 deletions premake5.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
workspace "Black-Tek-Server"
configurations { "Debug", "Release"}
platforms { "64", "ARM64" }
platforms { "64", "ARM64", "ARM" }
location ""
editorintegration "On"

Expand All @@ -17,6 +17,47 @@ workspace "Black-Tek-Server"
intrinsics "On"
editandcontinue "Off"

newoption {
trigger = "lua",
description = "Specific Lua library to use. For example lua5.4. Useful if the packaged lua does not provide a symbolic liblua.so",
value = "libname",
category = "BlackTek", -- Group options together
default = "lua",
allowed = {
{"lua", "Default"},
{"lua5.4", "Use Lua 5.4"},
{"lua5.3", "Use Lua 5.3"},
}
}

newoption {
trigger = "custom-includes",
description = "A comma separated list of custom include paths.",
value = "include paths",
category = "BlackTek", -- Group options together
}

newoption {
trigger = "custom-libs",
description = "A comma separated list of custom library paths.",
value = "library paths",
category = "BlackTek", -- Group options together
}

newoption {
trigger = "verbose",
description = "Show warnings during compilation.",
category = "BlackTek" -- Group options together
}

if _OPTIONS["custom-includes"] then
includedirs { string.explode(_OPTIONS["custom-includes"], ",") }
end

if _OPTIONS["custom-libs"] then
libdirs { string.explode(_OPTIONS["custom-libs"], ",") }
end

filter "configurations:Debug"
defines { "DEBUG" }
runtime "Debug"
Expand All @@ -31,7 +72,7 @@ workspace "Black-Tek-Server"
symbols "Off"
optimize "Full"
filter {}

filter "platforms:64"
architecture "x86_64"
filter {}
Expand All @@ -40,6 +81,10 @@ workspace "Black-Tek-Server"
architecture "ARM64"
filter {}

filter "platforms:ARM"
architecture "ARM"
filter {}

filter "system:not windows"
buildoptions { "-Wall", "-Wextra", "-pedantic", "-pipe", "-fvisibility=hidden", "-Wno-unused-local-typedefs" }
linkoptions{"-flto=auto"}
Expand All @@ -59,28 +104,42 @@ workspace "Black-Tek-Server"
vectorextensions "AVX"
filter{}

filter {"system:linux"}
linkoptions { "-v" }
filter {"system:linux", "options:verbose"}
linkoptions { "-v" }
warnings "Extra"
filter {}

filter { "system:linux", "not options:verbose" }
warnings "Off"
filter {}

filter { "system:linux", "architecture:ARM" }
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/arm-linux/lib", "/usr/arm-linux-gnueabihf" }
includedirs { "vcpkg_installed/arm-linux/include", "/usr/arm-linux-gnueabihf" }
filter{}

filter { "system:linux", "architecture:ARM64" }
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/arm64-linux/lib" }
includedirs { "vcpkg_installed/arm64-linux/include" }
links { "pugixml", "lua", "fmt", "mariadb", "cryptopp", "boost_iostreams", "zstd", "z", "curl", "tomlplusplus", "ssl", "crypto" }
libdirs { "vcpkg_installed/arm64-linux/lib", "/usr/arm-linux-gnueabi" }
includedirs { "vcpkg_installed/arm64-linux/include", "/usr/arm-linux-gnueabi" }
filter{}

filter { "system:linux", "architecture:amd64" }
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/x64-linux/lib" }
includedirs { "vcpkg_installed/x64-linux/include" }
links { "pugixml", "lua", "fmt", "mariadb", "cryptopp", "boost_iostreams", "zstd", "z", "curl", "tomlplusplus", "ssl", "crypto" }
filter{}

filter "system:linux"
-- Common Linux paths
libdirs { "/usr/lib" }
includedirs { "/usr/include", "/usr/include/lua5.*" }
links { "pugixml", _OPTIONS["lua"], "fmt", "mariadb", "cryptopp", "boost_iostreams", "zstd", "z", "curl", "ssl", "crypto" }
filter{}

filter "toolset:gcc"
buildoptions { "-fno-strict-aliasing" }
buildoptions {"-std=c++20"}
filter {}

filter "toolset:clang"
Expand Down

0 comments on commit 9d12fdb

Please sign in to comment.