Adding lsp / linter rules for clangd / clang-format
This commit is contained in:
159
premake5.lua
159
premake5.lua
@@ -2,9 +2,9 @@
|
||||
VERSION = "1.0.0"
|
||||
|
||||
-- Override with specific platform if necessary
|
||||
PLATFORM = os.target()
|
||||
PLATFORM = os.target()
|
||||
|
||||
-- architecture.
|
||||
-- architecture.
|
||||
ARCH = "x86_64"
|
||||
|
||||
-- SSE options:
|
||||
@@ -15,8 +15,7 @@ ARCH = "x86_64"
|
||||
-- None: Automatically detect SSE during build
|
||||
SSE = "None"
|
||||
|
||||
|
||||
phanesRoot = path.getabsolute(".")
|
||||
phanesRoot = path.getabsolute(".")
|
||||
phanesBin = path.join(phanesRoot, "bin")
|
||||
phanesInt = path.join(phanesRoot, ".int")
|
||||
phanesBuildFiles = path.join(phanesRoot, "build")
|
||||
@@ -25,107 +24,103 @@ PhanesEngine = path.join(phanesRoot, "Engine")
|
||||
PhanesRuntime = path.join(PhanesEngine, "Source/Runtime")
|
||||
PhanesThirdParty = path.join(PhanesEngine, "Source/ThirdParty")
|
||||
|
||||
workspace("PhanesEngine")
|
||||
cppdialect("C++20")
|
||||
architecture(ARCH)
|
||||
toolset("gcc")
|
||||
flags({ "MultiProcessorCompile" })
|
||||
clangtidy("On")
|
||||
debugger("gdb")
|
||||
startproject("MathTestFPU")
|
||||
configurations({ "Debug", "Release" })
|
||||
|
||||
|
||||
workspace "PhanesEngine"
|
||||
cppdialect "C++20"
|
||||
architecture (ARCH)
|
||||
toolset "gcc"
|
||||
flags { "MultiProcessorCompile" }
|
||||
clangtidy "On"
|
||||
debugger "gdb"
|
||||
startproject "MathTestFPU"
|
||||
configurations { "Debug", "Release" }
|
||||
|
||||
|
||||
function linux_sse()
|
||||
if SSE == "SSE" then
|
||||
defines {"P_SSE__"}
|
||||
buildoptions {"-msse4", "-msse2", "-msse3"}
|
||||
elseif SSE == "AVX" then
|
||||
defines { "P_AVX__" }
|
||||
buildoptions {"-mavx", "-msse4", "-msse2", "-msse3"}
|
||||
elseif SSE == "AVX2" then
|
||||
defines { "P_AVX2__" }
|
||||
buildoptions {"-mavx2", "-mavx", "-msse4", "-msse2", "-msse3"}
|
||||
elseif SSE == "FPU" then
|
||||
defines { "P_FORCE_FPU" }
|
||||
end
|
||||
|
||||
function linux_sse()
|
||||
if SSE == "SSE" then
|
||||
defines({ "P_SSE__" })
|
||||
buildoptions({ "-msse4", "-msse2", "-msse3" })
|
||||
elseif SSE == "AVX" then
|
||||
defines({ "P_AVX__" })
|
||||
buildoptions({ "-mavx", "-msse4", "-msse2", "-msse3" })
|
||||
elseif SSE == "AVX2" then
|
||||
defines({ "P_AVX2__" })
|
||||
buildoptions({ "-mavx2", "-mavx", "-msse4", "-msse2", "-msse3" })
|
||||
elseif SSE == "FPU" then
|
||||
defines({ "P_FORCE_FPU" })
|
||||
end
|
||||
end
|
||||
|
||||
function boilerplate()
|
||||
language "C++"
|
||||
language("C++")
|
||||
|
||||
location (phanesBuildFiles .. "/%{prj.name}")
|
||||
targetdir (phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
objdir (phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
location(phanesBuildFiles .. "/%{prj.name}")
|
||||
targetdir(phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
objdir(phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
|
||||
if PLATFORM == "linux" then
|
||||
defines { "P_LINUX_BUILD" }
|
||||
buildoptions {"-Wall", "-Wextra", "-Werror"}
|
||||
linux_sse()
|
||||
buildoptions { "-Wno-unused-parameter" , "-fms-extensions" }
|
||||
end
|
||||
if PLATFORM == "linux" then
|
||||
defines({ "P_LINUX_BUILD" })
|
||||
buildoptions({ "-Wall", "-Wextra", "-Werror" })
|
||||
linux_sse()
|
||||
buildoptions({ "-Wno-unused-parameter", "-fms-extensions" })
|
||||
end
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG", "TRACE", "P_DEBUG"}
|
||||
symbols "On"
|
||||
buildmessage("Building %{prj.name} in debug mode")
|
||||
filter("configurations:Debug")
|
||||
defines({ "DEBUG", "TRACE", "P_DEBUG" })
|
||||
symbols("On")
|
||||
buildmessage("Building %{prj.name} in debug mode")
|
||||
|
||||
filter "configurations:Release"
|
||||
defines { "NDEBUG", "P_RELEASE" }
|
||||
linktimeoptimization "On"
|
||||
optimize "On"
|
||||
intrinsics "On"
|
||||
buildmessage("Building %{prj.name} in release mode")
|
||||
filter("configurations:Release")
|
||||
defines({ "NDEBUG", "P_RELEASE" })
|
||||
linktimeoptimization("On")
|
||||
optimize("On")
|
||||
intrinsics("On")
|
||||
buildmessage("Building %{prj.name} in release mode")
|
||||
|
||||
filter{}
|
||||
filter({})
|
||||
end
|
||||
|
||||
function third_party_boilerplate()
|
||||
language "C++"
|
||||
language("C++")
|
||||
|
||||
location (phanesBuildFiles .. "/%{prj.name}")
|
||||
targetdir (phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
objdir (phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
location(phanesBuildFiles .. "/%{prj.name}")
|
||||
targetdir(phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
objdir(phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
||||
|
||||
if PLATFORM == "linux" then
|
||||
buildoptions {"-Wall", "-Wextra", "-Werror"}
|
||||
linux_sse()
|
||||
end
|
||||
if PLATFORM == "linux" then
|
||||
buildoptions({ "-Wall", "-Wextra", "-Werror" })
|
||||
linux_sse()
|
||||
end
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG", "TRACE", "P_DEBUG"}
|
||||
symbols "On"
|
||||
buildmessage("Building %{prj.name} in debug mode")
|
||||
filter("configurations:Debug")
|
||||
defines({ "DEBUG", "TRACE", "P_DEBUG" })
|
||||
symbols("On")
|
||||
buildmessage("Building %{prj.name} in debug mode")
|
||||
|
||||
filter "configurations:Release"
|
||||
defines { "NDEBUG", "P_RELEASE" }
|
||||
linktimeoptimization "On"
|
||||
optimize "On"
|
||||
intrinsics "On"
|
||||
buildmessage("Building %{prj.name} in release mode")
|
||||
filter("configurations:Release")
|
||||
defines({ "NDEBUG", "P_RELEASE" })
|
||||
linktimeoptimization("On")
|
||||
optimize("On")
|
||||
intrinsics("On")
|
||||
buildmessage("Building %{prj.name} in release mode")
|
||||
|
||||
filter{}
|
||||
filter({})
|
||||
end
|
||||
|
||||
-- actions
|
||||
|
||||
function action_clean()
|
||||
os.rmdir(phanesBin)
|
||||
os.rmdir(phanesInt)
|
||||
os.rmdir(phanesBuildFiles)
|
||||
os.remove(phanesRoot .. "/Makefile")
|
||||
os.rmdir(phanesBin)
|
||||
os.rmdir(phanesInt)
|
||||
os.rmdir(phanesBuildFiles)
|
||||
os.remove(phanesRoot .. "/Makefile")
|
||||
end
|
||||
|
||||
newaction {
|
||||
trigger = "clean",
|
||||
description = "Clean the build",
|
||||
execute = action_clean,
|
||||
}
|
||||
newaction({
|
||||
trigger = "clean",
|
||||
description = "Clean the build",
|
||||
execute = action_clean,
|
||||
})
|
||||
|
||||
-- includeProjects here
|
||||
include (phanesRoot .. "/Engine/Source/Runtime/Core/premake5.lua")
|
||||
include (phanesRoot .. "/DevPlayground/premake5.lua")
|
||||
include (PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/premake5.lua")
|
||||
include(phanesRoot .. "/Engine/Source/Runtime/Core/premake5.lua")
|
||||
include(phanesRoot .. "/DevPlayground/premake5.lua")
|
||||
include(PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/premake5.lua")
|
||||
|
Reference in New Issue
Block a user