2015-12-30 16:52:49 -08:00
|
|
|
include("tools/build")
|
2015-12-31 00:37:13 -08:00
|
|
|
require("third_party/premake-export-compile-commands/export-compile-commands")
|
2021-10-30 00:01:27 +03:00
|
|
|
require("third_party/premake-androidndk/androidndk")
|
2020-11-03 21:59:03 +01:00
|
|
|
require("third_party/premake-cmake/cmake")
|
2015-07-18 16:00:01 -07:00
|
|
|
|
|
|
|
location(build_root)
|
|
|
|
targetdir(build_bin)
|
|
|
|
objdir(build_obj)
|
|
|
|
|
2017-05-08 22:21:43 -05:00
|
|
|
-- Define an ARCH variable
|
|
|
|
-- Only use this to enable architecture-specific functionality.
|
2019-04-18 05:26:20 -05:00
|
|
|
if os.istarget("linux") then
|
2017-05-08 22:21:43 -05:00
|
|
|
ARCH = os.outputof("uname -p")
|
|
|
|
else
|
|
|
|
ARCH = "unknown"
|
|
|
|
end
|
|
|
|
|
2015-07-18 16:00:01 -07:00
|
|
|
includedirs({
|
|
|
|
".",
|
|
|
|
"src",
|
|
|
|
"third_party",
|
|
|
|
})
|
|
|
|
|
|
|
|
defines({
|
|
|
|
"_UNICODE",
|
|
|
|
"UNICODE",
|
|
|
|
})
|
|
|
|
|
2020-11-03 21:54:19 +01:00
|
|
|
cppdialect("C++17")
|
2020-11-21 23:40:34 +03:00
|
|
|
exceptionhandling("On")
|
2020-11-21 23:52:45 +03:00
|
|
|
rtti("On")
|
2020-11-03 21:54:19 +01:00
|
|
|
symbols("On")
|
|
|
|
|
2017-05-07 16:21:44 -05:00
|
|
|
-- TODO(DrChat): Find a way to disable this on other architectures.
|
2018-04-03 19:02:49 -05:00
|
|
|
if ARCH ~= "ppc64" then
|
|
|
|
filter("architecture:x86_64")
|
|
|
|
vectorextensions("AVX")
|
|
|
|
filter({})
|
|
|
|
end
|
2017-05-07 16:21:44 -05:00
|
|
|
|
|
|
|
characterset("Unicode")
|
2015-07-18 16:00:01 -07:00
|
|
|
flags({
|
|
|
|
"FatalWarnings", -- Treat warnings as errors.
|
|
|
|
})
|
|
|
|
|
|
|
|
filter("kind:StaticLib")
|
|
|
|
defines({
|
|
|
|
"_LIB",
|
|
|
|
})
|
|
|
|
|
|
|
|
filter("configurations:Checked")
|
|
|
|
runtime("Debug")
|
2020-11-03 21:54:19 +01:00
|
|
|
optimize("Off")
|
2015-07-18 16:00:01 -07:00
|
|
|
defines({
|
|
|
|
"DEBUG",
|
|
|
|
})
|
2015-08-18 14:18:00 -07:00
|
|
|
filter({"configurations:Checked", "platforms:Windows"})
|
2015-07-18 16:00:01 -07:00
|
|
|
buildoptions({
|
2020-11-03 21:54:19 +01:00
|
|
|
"/RTCsu", -- Full Run-Time Checks.
|
|
|
|
})
|
|
|
|
filter({"configurations:Checked", "platforms:Linux"})
|
|
|
|
defines({
|
|
|
|
"_GLIBCXX_DEBUG", -- libstdc++ debug mode
|
2015-07-18 16:00:01 -07:00
|
|
|
})
|
|
|
|
|
|
|
|
filter("configurations:Debug")
|
2020-11-03 21:54:19 +01:00
|
|
|
runtime("Release")
|
|
|
|
optimize("Off")
|
2015-07-18 16:00:01 -07:00
|
|
|
defines({
|
|
|
|
"DEBUG",
|
|
|
|
"_NO_DEBUG_HEAP=1",
|
|
|
|
})
|
2018-01-08 14:53:27 -07:00
|
|
|
filter({"configurations:Debug", "platforms:Linux"})
|
2020-11-03 21:54:19 +01:00
|
|
|
defines({
|
|
|
|
"_GLIBCXX_DEBUG", -- make dbg symbols work on some distros
|
2018-01-08 14:53:27 -07:00
|
|
|
})
|
|
|
|
|
2015-07-18 16:00:01 -07:00
|
|
|
filter("configurations:Release")
|
|
|
|
runtime("Release")
|
|
|
|
defines({
|
|
|
|
"NDEBUG",
|
|
|
|
"_NO_DEBUG_HEAP=1",
|
|
|
|
})
|
2020-11-03 21:54:19 +01:00
|
|
|
optimize("Speed")
|
2019-05-12 12:49:23 -04:00
|
|
|
inlining("Auto")
|
2015-07-18 16:00:01 -07:00
|
|
|
flags({
|
|
|
|
"LinkTimeOptimization",
|
|
|
|
})
|
2020-11-19 21:28:02 +03:00
|
|
|
-- Not using floatingpoint("Fast") - NaN checks are used in some places
|
|
|
|
-- (though rarely), overall preferable to avoid any functional differences
|
|
|
|
-- between debug and release builds, and to have calculations involved in GPU
|
|
|
|
-- (especially anything that may affect vertex position invariance) and CPU
|
|
|
|
-- (such as constant propagation) emulation as predictable as possible,
|
|
|
|
-- including handling of specials since games make assumptions about them.
|
2015-08-01 01:30:47 -07:00
|
|
|
filter("platforms:Linux")
|
|
|
|
system("linux")
|
|
|
|
toolset("clang")
|
|
|
|
buildoptions({
|
2017-05-07 16:21:44 -05:00
|
|
|
-- "-mlzcnt", -- (don't) Assume lzcnt is supported.
|
2015-08-01 01:30:47 -07:00
|
|
|
})
|
2021-05-22 01:44:28 +02:00
|
|
|
pkg_config.all("gtk+-x11-3.0")
|
2017-02-06 00:24:06 -06:00
|
|
|
links({
|
2020-03-02 09:37:11 -06:00
|
|
|
"stdc++fs",
|
2017-07-09 16:00:00 -06:00
|
|
|
"dl",
|
2017-07-08 02:33:12 -06:00
|
|
|
"lz4",
|
2020-03-02 09:37:11 -06:00
|
|
|
"pthread",
|
2017-12-19 19:29:30 -06:00
|
|
|
"rt",
|
2017-07-08 02:33:12 -06:00
|
|
|
})
|
2015-08-01 01:30:47 -07:00
|
|
|
|
2017-04-26 02:25:12 -04:00
|
|
|
filter({"platforms:Linux", "kind:*App"})
|
|
|
|
linkgroups("On")
|
|
|
|
|
2018-04-03 19:21:17 -05:00
|
|
|
filter({"platforms:Linux", "language:C++", "toolset:gcc"})
|
2018-06-02 17:40:30 -05:00
|
|
|
disablewarnings({
|
|
|
|
"unused-result"
|
|
|
|
})
|
2018-04-03 19:21:17 -05:00
|
|
|
|
|
|
|
filter({"platforms:Linux", "toolset:gcc"})
|
2018-04-03 19:02:49 -05:00
|
|
|
if ARCH == "ppc64" then
|
|
|
|
buildoptions({
|
|
|
|
"-m32",
|
|
|
|
"-mpowerpc64"
|
|
|
|
})
|
|
|
|
linkoptions({
|
|
|
|
"-m32",
|
|
|
|
"-mpowerpc64"
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2018-04-03 19:21:17 -05:00
|
|
|
filter({"platforms:Linux", "language:C++", "toolset:clang"})
|
2017-12-19 19:29:30 -06:00
|
|
|
disablewarnings({
|
|
|
|
"deprecated-register"
|
|
|
|
})
|
2018-11-24 21:32:19 -06:00
|
|
|
filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp"})
|
|
|
|
buildoptions({
|
|
|
|
"-stdlib=libstdc++",
|
|
|
|
})
|
2015-09-22 01:08:19 -04:00
|
|
|
|
2021-10-30 00:01:27 +03:00
|
|
|
filter("platforms:Android-*")
|
2020-11-21 23:40:34 +03:00
|
|
|
system("android")
|
2021-10-30 00:01:27 +03:00
|
|
|
systemversion("24")
|
|
|
|
cppstl("c++")
|
|
|
|
staticruntime("On")
|
2020-11-22 16:37:31 +03:00
|
|
|
links({
|
|
|
|
"android",
|
|
|
|
"dl",
|
2021-10-30 00:01:27 +03:00
|
|
|
"log",
|
2020-11-22 16:37:31 +03:00
|
|
|
})
|
2020-11-21 23:40:34 +03:00
|
|
|
|
2015-07-18 16:00:01 -07:00
|
|
|
filter("platforms:Windows")
|
|
|
|
system("windows")
|
|
|
|
toolset("msc")
|
2015-07-18 16:40:22 -07:00
|
|
|
buildoptions({
|
2020-02-22 23:19:10 -06:00
|
|
|
"/utf-8", -- 'build correctly on systems with non-Latin codepages'.
|
|
|
|
-- Mark warnings as severe
|
2020-11-03 21:54:19 +01:00
|
|
|
"/w14839", -- non-standard use of class 'type' as an argument to a variadic function
|
|
|
|
"/w14840", -- non-portable use of class 'type' as an argument to a variadic function
|
2020-02-22 23:19:10 -06:00
|
|
|
-- Disable warnings
|
2015-07-18 23:04:21 -07:00
|
|
|
"/wd4100", -- Unreferenced parameters are ok.
|
|
|
|
"/wd4201", -- Nameless struct/unions are ok.
|
|
|
|
"/wd4512", -- 'assignment operator was implicitly defined as deleted'.
|
|
|
|
"/wd4127", -- 'conditional expression is constant'.
|
|
|
|
"/wd4324", -- 'structure was padded due to alignment specifier'.
|
|
|
|
"/wd4189", -- 'local variable is initialized but not referenced'.
|
2015-07-18 16:40:22 -07:00
|
|
|
})
|
2015-07-18 16:00:01 -07:00
|
|
|
flags({
|
2020-11-03 21:54:19 +01:00
|
|
|
"MultiProcessorCompile", -- Multiprocessor compilation.
|
|
|
|
"NoMinimalRebuild", -- Required for /MP above.
|
2015-07-18 16:00:01 -07:00
|
|
|
})
|
2017-05-07 16:21:44 -05:00
|
|
|
|
2015-07-18 16:00:01 -07:00
|
|
|
defines({
|
|
|
|
"_CRT_NONSTDC_NO_DEPRECATE",
|
|
|
|
"_CRT_SECURE_NO_WARNINGS",
|
|
|
|
"WIN32",
|
|
|
|
"_WIN64=1",
|
|
|
|
"_AMD64=1",
|
|
|
|
})
|
2015-09-22 01:09:40 -04:00
|
|
|
linkoptions({
|
|
|
|
"/ignore:4006", -- Ignores complaints about empty obj files.
|
|
|
|
"/ignore:4221",
|
|
|
|
})
|
2015-07-18 16:00:01 -07:00
|
|
|
links({
|
|
|
|
"ntdll",
|
|
|
|
"wsock32",
|
|
|
|
"ws2_32",
|
|
|
|
"xinput",
|
|
|
|
"comctl32",
|
2017-08-03 19:03:26 -05:00
|
|
|
"shcore",
|
2015-07-18 16:00:01 -07:00
|
|
|
"shlwapi",
|
2018-07-18 11:42:51 +03:00
|
|
|
"dxguid",
|
2021-01-01 09:40:17 +00:00
|
|
|
"bcrypt",
|
2015-07-18 16:00:01 -07:00
|
|
|
})
|
|
|
|
|
2021-08-28 19:38:24 +03:00
|
|
|
-- Embed the manifest for things like dependencies and DPI awareness.
|
|
|
|
filter({"platforms:Windows", "kind:ConsoleApp or WindowedApp"})
|
|
|
|
files({
|
|
|
|
"src/xenia/base/app_win32.manifest"
|
|
|
|
})
|
|
|
|
|
2019-04-18 00:08:59 +02:00
|
|
|
-- Create scratch/ path
|
2015-07-18 16:00:01 -07:00
|
|
|
if not os.isdir("scratch") then
|
|
|
|
os.mkdir("scratch")
|
|
|
|
end
|
|
|
|
|
2021-05-04 00:36:39 +02:00
|
|
|
workspace("xenia")
|
2015-07-18 16:00:01 -07:00
|
|
|
uuid("931ef4b0-6170-4f7a-aaf2-0fece7632747")
|
|
|
|
startproject("xenia-app")
|
2020-11-21 17:14:40 +03:00
|
|
|
if os.istarget("android") then
|
2021-10-30 00:01:27 +03:00
|
|
|
platforms({"Android-ARM64", "Android-x86_64"})
|
|
|
|
filter("platforms:Android-ARM64")
|
|
|
|
architecture("ARM64")
|
|
|
|
filter("platforms:Android-x86_64")
|
|
|
|
architecture("x86_64")
|
|
|
|
filter({})
|
2020-11-21 17:14:40 +03:00
|
|
|
else
|
|
|
|
architecture("x86_64")
|
|
|
|
if os.istarget("linux") then
|
|
|
|
platforms({"Linux"})
|
2021-10-06 14:55:58 -07:00
|
|
|
elseif os.istarget("macosx") then
|
|
|
|
platforms({"Mac"})
|
|
|
|
xcodebuildsettings({
|
|
|
|
["ARCHS"] = "x86_64"
|
|
|
|
})
|
2020-11-21 17:14:40 +03:00
|
|
|
elseif os.istarget("windows") then
|
|
|
|
platforms({"Windows"})
|
|
|
|
-- 10.0.15063.0: ID3D12GraphicsCommandList1::SetSamplePositions.
|
|
|
|
-- 10.0.19041.0: D3D12_HEAP_FLAG_CREATE_NOT_ZEROED.
|
|
|
|
filter("action:vs2017")
|
|
|
|
systemversion("10.0.19041.0")
|
|
|
|
filter("action:vs2019")
|
|
|
|
systemversion("10.0")
|
|
|
|
filter({})
|
|
|
|
end
|
2015-08-01 10:05:01 -07:00
|
|
|
end
|
|
|
|
configurations({"Checked", "Debug", "Release"})
|
2015-07-18 16:00:01 -07:00
|
|
|
|
2019-04-14 18:08:07 +03:00
|
|
|
include("third_party/aes_128.lua")
|
2015-08-22 11:10:16 -05:00
|
|
|
include("third_party/capstone.lua")
|
2018-08-27 15:18:30 +03:00
|
|
|
include("third_party/dxbc.lua")
|
2019-08-02 09:06:02 -05:00
|
|
|
include("third_party/discord-rpc.lua")
|
2019-04-16 18:36:30 +02:00
|
|
|
include("third_party/cxxopts.lua")
|
2018-11-25 16:39:14 +01:00
|
|
|
include("third_party/cpptoml.lua")
|
2020-06-19 22:32:40 +02:00
|
|
|
include("third_party/FFmpeg/premake5.lua")
|
2020-03-02 09:37:11 -06:00
|
|
|
include("third_party/fmt.lua")
|
2016-02-18 16:40:02 -08:00
|
|
|
include("third_party/glslang-spirv.lua")
|
2015-08-22 11:10:16 -05:00
|
|
|
include("third_party/imgui.lua")
|
2018-11-23 15:32:14 -06:00
|
|
|
include("third_party/mspack.lua")
|
2015-12-30 20:29:12 -08:00
|
|
|
include("third_party/snappy.lua")
|
2015-11-22 17:41:39 -08:00
|
|
|
include("third_party/spirv-tools.lua")
|
2015-08-22 11:10:16 -05:00
|
|
|
include("third_party/xxhash.lua")
|
2015-09-12 10:02:06 -07:00
|
|
|
|
2021-05-04 00:36:39 +02:00
|
|
|
if not os.istarget("android") then
|
|
|
|
-- SDL2 requires sdl2-config, and as of November 2020 isn't high-quality on
|
|
|
|
-- Android yet, most importantly in game controllers - the keycode and axis
|
|
|
|
-- enums are being ruined during conversion to SDL2 enums resulting in only
|
|
|
|
-- one controller (Nvidia Shield) being supported, digital triggers are also
|
|
|
|
-- not supported; lifecycle management (especially surface loss) is also
|
|
|
|
-- complicated.
|
|
|
|
include("third_party/SDL2.lua")
|
|
|
|
end
|
|
|
|
|
2021-08-28 19:38:24 +03:00
|
|
|
-- Disable treating warnings as fatal errors for all third party projects, as
|
|
|
|
-- well as other things relevant only to Xenia itself.
|
2021-05-04 00:36:39 +02:00
|
|
|
for _, prj in ipairs(premake.api.scope.current.solution.projects) do
|
|
|
|
project(prj.name)
|
2021-08-28 19:38:24 +03:00
|
|
|
removefiles({
|
|
|
|
"src/xenia/base/app_win32.manifest"
|
|
|
|
})
|
2021-05-04 00:36:39 +02:00
|
|
|
removeflags({
|
|
|
|
"FatalWarnings",
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2015-07-18 16:00:01 -07:00
|
|
|
include("src/xenia")
|
2019-08-02 09:06:02 -05:00
|
|
|
include("src/xenia/app/discord")
|
2015-07-18 16:00:01 -07:00
|
|
|
include("src/xenia/apu")
|
|
|
|
include("src/xenia/apu/nop")
|
|
|
|
include("src/xenia/base")
|
|
|
|
include("src/xenia/cpu")
|
|
|
|
include("src/xenia/cpu/backend/x64")
|
|
|
|
include("src/xenia/debug/ui")
|
|
|
|
include("src/xenia/gpu")
|
2016-08-04 09:50:13 -05:00
|
|
|
include("src/xenia/gpu/null")
|
2016-02-17 21:17:12 -08:00
|
|
|
include("src/xenia/gpu/vulkan")
|
2015-07-18 16:00:01 -07:00
|
|
|
include("src/xenia/hid")
|
|
|
|
include("src/xenia/hid/nop")
|
|
|
|
include("src/xenia/kernel")
|
|
|
|
include("src/xenia/ui")
|
2015-11-24 19:49:05 -08:00
|
|
|
include("src/xenia/ui/spirv")
|
2016-02-17 17:42:25 -08:00
|
|
|
include("src/xenia/ui/vulkan")
|
2015-07-18 16:00:01 -07:00
|
|
|
include("src/xenia/vfs")
|
|
|
|
|
2020-11-21 17:14:40 +03:00
|
|
|
if not os.istarget("android") then
|
|
|
|
include("src/xenia/apu/sdl")
|
|
|
|
include("src/xenia/helper/sdl")
|
|
|
|
include("src/xenia/hid/sdl")
|
|
|
|
|
|
|
|
-- TODO(Triang3l): src/xenia/app has a dependency on xenia-helper-sdl, bring
|
|
|
|
-- it back later.
|
|
|
|
include("src/xenia/app")
|
|
|
|
end
|
|
|
|
|
2019-04-18 05:26:20 -05:00
|
|
|
if os.istarget("windows") then
|
2015-08-18 14:18:00 -07:00
|
|
|
include("src/xenia/apu/xaudio2")
|
2018-07-18 11:42:51 +03:00
|
|
|
include("src/xenia/gpu/d3d12")
|
2015-08-18 14:18:00 -07:00
|
|
|
include("src/xenia/hid/winkey")
|
|
|
|
include("src/xenia/hid/xinput")
|
2018-07-18 15:02:37 +03:00
|
|
|
include("src/xenia/ui/d3d12")
|
2015-08-18 14:18:00 -07:00
|
|
|
end
|