2015-12-31 00:52:49 +00:00
|
|
|
include("tools/build")
|
2015-12-31 08:37:13 +00:00
|
|
|
require("third_party/premake-export-compile-commands/export-compile-commands")
|
2015-07-18 23:00:01 +00:00
|
|
|
|
|
|
|
location(build_root)
|
|
|
|
targetdir(build_bin)
|
|
|
|
objdir(build_obj)
|
|
|
|
|
2017-05-09 03:21:43 +00:00
|
|
|
-- Define an ARCH variable
|
|
|
|
-- Only use this to enable architecture-specific functionality.
|
|
|
|
if os.is("linux") then
|
|
|
|
ARCH = os.outputof("uname -p")
|
|
|
|
else
|
|
|
|
ARCH = "unknown"
|
|
|
|
end
|
|
|
|
|
2015-07-18 23:00:01 +00:00
|
|
|
includedirs({
|
|
|
|
".",
|
|
|
|
"src",
|
|
|
|
"third_party",
|
|
|
|
})
|
|
|
|
|
|
|
|
defines({
|
|
|
|
"_UNICODE",
|
|
|
|
"UNICODE",
|
2016-01-01 06:01:22 +00:00
|
|
|
|
|
|
|
-- TODO(benvanik): find a better place for this stuff.
|
|
|
|
"GLEW_NO_GLU=1",
|
2015-07-18 23:00:01 +00:00
|
|
|
})
|
|
|
|
|
2017-05-07 21:21:44 +00:00
|
|
|
-- TODO(DrChat): Find a way to disable this on other architectures.
|
|
|
|
filter("architecture:x86_64")
|
|
|
|
vectorextensions("AVX")
|
|
|
|
filter({})
|
|
|
|
|
|
|
|
characterset("Unicode")
|
2015-07-18 23:00:01 +00:00
|
|
|
flags({
|
|
|
|
--"ExtraWarnings", -- Sets the compiler's maximum warning level.
|
|
|
|
"FatalWarnings", -- Treat warnings as errors.
|
|
|
|
})
|
|
|
|
|
|
|
|
filter("kind:StaticLib")
|
|
|
|
defines({
|
|
|
|
"_LIB",
|
|
|
|
})
|
|
|
|
|
|
|
|
filter("configurations:Checked")
|
|
|
|
runtime("Debug")
|
|
|
|
defines({
|
|
|
|
"DEBUG",
|
|
|
|
})
|
|
|
|
runtime("Debug")
|
2015-08-18 21:18:00 +00:00
|
|
|
filter({"configurations:Checked", "platforms:Windows"})
|
2015-07-18 23:00:01 +00:00
|
|
|
buildoptions({
|
|
|
|
"/RTCsu", -- Full Run-Time Checks.
|
|
|
|
})
|
|
|
|
|
|
|
|
filter("configurations:Debug")
|
|
|
|
runtime("Debug")
|
|
|
|
defines({
|
|
|
|
"DEBUG",
|
|
|
|
"_NO_DEBUG_HEAP=1",
|
|
|
|
})
|
|
|
|
runtime("Release")
|
2015-09-22 14:52:45 +00:00
|
|
|
filter({"configurations:Debug", "platforms:Windows"})
|
|
|
|
linkoptions({
|
|
|
|
"/NODEFAULTLIB:MSVCRTD",
|
|
|
|
})
|
2015-07-18 23:00:01 +00:00
|
|
|
|
|
|
|
filter("configurations:Release")
|
|
|
|
runtime("Release")
|
|
|
|
defines({
|
|
|
|
"NDEBUG",
|
|
|
|
"_NO_DEBUG_HEAP=1",
|
|
|
|
})
|
|
|
|
optimize("On")
|
|
|
|
flags({
|
|
|
|
"LinkTimeOptimization",
|
|
|
|
})
|
|
|
|
runtime("Release")
|
2015-09-22 14:52:45 +00:00
|
|
|
filter({"configurations:Release", "platforms:Windows"})
|
|
|
|
linkoptions({
|
|
|
|
"/NODEFAULTLIB:MSVCRTD",
|
|
|
|
})
|
2015-07-18 23:00:01 +00:00
|
|
|
|
2015-08-01 08:30:47 +00:00
|
|
|
filter("platforms:Linux")
|
|
|
|
system("linux")
|
|
|
|
toolset("clang")
|
|
|
|
buildoptions({
|
2017-05-07 21:21:44 +00:00
|
|
|
-- "-mlzcnt", -- (don't) Assume lzcnt is supported.
|
2015-08-01 08:30:47 +00:00
|
|
|
})
|
2017-02-06 06:24:06 +00:00
|
|
|
links({
|
|
|
|
"pthread",
|
|
|
|
})
|
2015-08-01 08:30:47 +00:00
|
|
|
|
2017-05-09 03:21:43 +00:00
|
|
|
filter({"platforms:Linux", "language:C++", "toolset:gcc"})
|
|
|
|
buildoptions({
|
|
|
|
"--std=c++11",
|
|
|
|
})
|
|
|
|
links({
|
|
|
|
})
|
|
|
|
|
2017-05-07 21:21:44 +00:00
|
|
|
filter({"platforms:Linux", "language:C++", "toolset:clang"})
|
2015-09-22 05:08:19 +00:00
|
|
|
buildoptions({
|
|
|
|
"-std=c++14",
|
2017-02-06 02:21:35 +00:00
|
|
|
"-stdlib=libc++",
|
2015-09-22 05:08:19 +00:00
|
|
|
})
|
2017-02-06 04:13:01 +00:00
|
|
|
links({
|
|
|
|
"c++",
|
|
|
|
})
|
2015-09-22 05:08:19 +00:00
|
|
|
|
2015-07-18 23:00:01 +00:00
|
|
|
filter("platforms:Windows")
|
|
|
|
system("windows")
|
|
|
|
toolset("msc")
|
2015-07-18 23:40:22 +00:00
|
|
|
buildoptions({
|
2015-07-19 06:04:21 +00:00
|
|
|
"/MP", -- Multiprocessor compilation.
|
|
|
|
"/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 23:40:22 +00:00
|
|
|
})
|
2015-07-18 23:00:01 +00:00
|
|
|
flags({
|
2015-07-18 23:40:22 +00:00
|
|
|
"NoMinimalRebuild", -- Required for /MP above.
|
2015-07-18 23:00:01 +00:00
|
|
|
})
|
2017-05-07 21:21:44 +00:00
|
|
|
|
|
|
|
symbols("On")
|
2015-07-18 23:00:01 +00:00
|
|
|
defines({
|
|
|
|
"_CRT_NONSTDC_NO_DEPRECATE",
|
|
|
|
"_CRT_SECURE_NO_WARNINGS",
|
|
|
|
"WIN32",
|
|
|
|
"_WIN64=1",
|
|
|
|
"_AMD64=1",
|
|
|
|
})
|
2015-09-22 05:09:40 +00:00
|
|
|
linkoptions({
|
|
|
|
"/ignore:4006", -- Ignores complaints about empty obj files.
|
|
|
|
"/ignore:4221",
|
|
|
|
})
|
2015-07-18 23:00:01 +00:00
|
|
|
links({
|
|
|
|
"ntdll",
|
|
|
|
"wsock32",
|
|
|
|
"ws2_32",
|
|
|
|
"xinput",
|
|
|
|
"xaudio2",
|
|
|
|
"glu32",
|
|
|
|
"opengl32",
|
|
|
|
"comctl32",
|
2017-08-04 00:03:26 +00:00
|
|
|
"shcore",
|
2015-07-18 23:00:01 +00:00
|
|
|
"shlwapi",
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Create scratch/ path and dummy flags file if needed.
|
|
|
|
if not os.isdir("scratch") then
|
|
|
|
os.mkdir("scratch")
|
2015-09-12 17:02:06 +00:00
|
|
|
local flags_file = io.open("scratch/flags.txt", "w")
|
2015-07-18 23:00:01 +00:00
|
|
|
flags_file:write("# Put flags, one on each line.\n")
|
|
|
|
flags_file:write("# Launch executables with --flags_file=scratch/flags.txt\n")
|
|
|
|
flags_file:write("\n")
|
|
|
|
flags_file:write("--cpu=x64\n")
|
|
|
|
flags_file:write("#--enable_haswell_instructions=false\n")
|
|
|
|
flags_file:write("\n")
|
|
|
|
flags_file:write("--debug\n")
|
|
|
|
flags_file:write("#--protect_zero=false\n")
|
|
|
|
flags_file:write("\n")
|
|
|
|
flags_file:write("#--mute\n")
|
|
|
|
flags_file:write("\n")
|
|
|
|
flags_file:write("--fast_stdout\n")
|
|
|
|
flags_file:write("#--flush_stdout=false\n")
|
|
|
|
flags_file:write("\n")
|
|
|
|
flags_file:write("#--vsync=false\n")
|
|
|
|
flags_file:write("#--gl_debug\n")
|
|
|
|
flags_file:write("#--gl_debug_output\n")
|
|
|
|
flags_file:write("#--gl_debug_output_synchronous\n")
|
|
|
|
flags_file:write("#--trace_gpu_prefix=scratch/gpu/gpu_trace_\n")
|
|
|
|
flags_file:write("#--trace_gpu_stream\n")
|
|
|
|
flags_file:write("#--disable_framebuffer_readback\n")
|
|
|
|
flags_file:write("\n")
|
|
|
|
flags_file:close()
|
|
|
|
end
|
|
|
|
|
|
|
|
solution("xenia")
|
|
|
|
uuid("931ef4b0-6170-4f7a-aaf2-0fece7632747")
|
|
|
|
startproject("xenia-app")
|
|
|
|
architecture("x86_64")
|
2015-08-01 17:05:01 +00:00
|
|
|
if os.is("linux") then
|
|
|
|
platforms({"Linux"})
|
|
|
|
elseif os.is("windows") then
|
|
|
|
platforms({"Windows"})
|
|
|
|
end
|
|
|
|
configurations({"Checked", "Debug", "Release"})
|
2015-07-18 23:00:01 +00:00
|
|
|
|
2015-08-22 16:10:16 +00:00
|
|
|
-- Include third party files first so they don't have to deal with gflags.
|
|
|
|
include("third_party/capstone.lua")
|
2015-12-31 00:52:49 +00:00
|
|
|
include("third_party/gflags.lua")
|
2015-08-22 16:10:16 +00:00
|
|
|
include("third_party/glew.lua")
|
2016-02-19 00:40:02 +00:00
|
|
|
include("third_party/glslang-spirv.lua")
|
2015-08-22 16:10:16 +00:00
|
|
|
include("third_party/imgui.lua")
|
|
|
|
include("third_party/libav.lua")
|
2015-12-31 04:29:12 +00:00
|
|
|
include("third_party/snappy.lua")
|
2015-11-23 01:41:39 +00:00
|
|
|
include("third_party/spirv-tools.lua")
|
2016-02-18 01:42:25 +00:00
|
|
|
include("third_party/vulkan/loader")
|
2015-08-22 16:10:16 +00:00
|
|
|
include("third_party/xxhash.lua")
|
2016-01-01 20:13:36 +00:00
|
|
|
include("third_party/yaml-cpp.lua")
|
2015-09-12 17:02:06 +00:00
|
|
|
|
2015-07-18 23:00:01 +00:00
|
|
|
include("src/xenia")
|
|
|
|
include("src/xenia/app")
|
|
|
|
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 14:50:13 +00:00
|
|
|
include("src/xenia/gpu/null")
|
2015-07-18 23:00:01 +00:00
|
|
|
include("src/xenia/gpu/gl4")
|
2016-02-18 05:17:12 +00:00
|
|
|
include("src/xenia/gpu/vulkan")
|
2015-07-18 23:00:01 +00:00
|
|
|
include("src/xenia/hid")
|
|
|
|
include("src/xenia/hid/nop")
|
|
|
|
include("src/xenia/kernel")
|
|
|
|
include("src/xenia/ui")
|
|
|
|
include("src/xenia/ui/gl")
|
2015-11-25 03:49:05 +00:00
|
|
|
include("src/xenia/ui/spirv")
|
2016-02-18 01:42:25 +00:00
|
|
|
include("src/xenia/ui/vulkan")
|
2015-07-18 23:00:01 +00:00
|
|
|
include("src/xenia/vfs")
|
|
|
|
|
2015-08-18 21:18:00 +00:00
|
|
|
if os.is("windows") then
|
|
|
|
include("src/xenia/apu/xaudio2")
|
|
|
|
include("src/xenia/hid/winkey")
|
|
|
|
include("src/xenia/hid/xinput")
|
|
|
|
end
|