Folding build_tools back into the main repo for simplicity.
This commit is contained in:
parent
214532a3e8
commit
952d35911c
|
@ -76,26 +76,20 @@ node_modules/**/build/
|
||||||
node_modules/.bin/
|
node_modules/.bin/
|
||||||
|
|
||||||
# coverage/etc
|
# coverage/etc
|
||||||
scratch/
|
/scratch/
|
||||||
|
|
||||||
.anvil-cache
|
/build/
|
||||||
.build-cache/
|
|
||||||
build/
|
|
||||||
build-out/
|
|
||||||
build-gen/
|
|
||||||
build-bin/
|
|
||||||
build-test/
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Local-only paths
|
# Local-only paths
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
.vagrant
|
.vagrant
|
||||||
attic/
|
/attic/
|
||||||
content/
|
/content/
|
||||||
third_party/binutils/binutils-2.24.tar.gz
|
/third_party/binutils/binutils-2.24.tar.gz
|
||||||
third_party/binutils/bin/
|
/third_party/binutils/bin/
|
||||||
third_party/binutils/powerpc-none-elf/
|
/third_party/binutils/powerpc-none-elf/
|
||||||
third_party/binutils/share/
|
/third_party/binutils/share/
|
||||||
third_party/binutils/binutils*
|
/third_party/binutils/binutils*
|
||||||
third_party/vasm/
|
/third_party/vasm/
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
[submodule "third_party/capstone"]
|
[submodule "third_party/capstone"]
|
||||||
path = third_party/capstone
|
path = third_party/capstone
|
||||||
url = https://github.com/xenia-project/capstone.git
|
url = https://github.com/xenia-project/capstone.git
|
||||||
[submodule "build_tools"]
|
|
||||||
path = build_tools
|
|
||||||
url = https://github.com/xenia-project/build-tools.git
|
|
||||||
[submodule "third_party/libav"]
|
[submodule "third_party/libav"]
|
||||||
path = third_party/libav
|
path = third_party/libav
|
||||||
url = https://github.com/xenia-project/libav.git
|
url = https://github.com/xenia-project/libav.git
|
||||||
|
@ -22,3 +19,12 @@
|
||||||
[submodule "third_party/spirv-tools"]
|
[submodule "third_party/spirv-tools"]
|
||||||
path = third_party/spirv-tools
|
path = third_party/spirv-tools
|
||||||
url = https://github.com/xenia-project/SPIRV-Tools.git
|
url = https://github.com/xenia-project/SPIRV-Tools.git
|
||||||
|
[submodule "third_party/catch"]
|
||||||
|
path = third_party/catch
|
||||||
|
url = https://github.com/philsquared/Catch.git
|
||||||
|
[submodule "third_party/gflags"]
|
||||||
|
path = third_party/gflags
|
||||||
|
url = https://github.com/benvanik/gflags.git
|
||||||
|
[submodule "third_party/premake-core"]
|
||||||
|
path = third_party/premake-core
|
||||||
|
url = https://github.com/premake/premake-core.git
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 8b40c477f7036a35c2918e3931e0110f7d3da5c0
|
|
|
@ -1,4 +1,4 @@
|
||||||
include("build_tools")
|
include("tools/build")
|
||||||
|
|
||||||
location(build_root)
|
location(build_root)
|
||||||
targetdir(build_bin)
|
targetdir(build_bin)
|
||||||
|
@ -159,13 +159,13 @@ solution("xenia")
|
||||||
|
|
||||||
-- Include third party files first so they don't have to deal with gflags.
|
-- Include third party files first so they don't have to deal with gflags.
|
||||||
include("third_party/capstone.lua")
|
include("third_party/capstone.lua")
|
||||||
|
include("third_party/gflags.lua")
|
||||||
include("third_party/glew.lua")
|
include("third_party/glew.lua")
|
||||||
include("third_party/imgui.lua")
|
include("third_party/imgui.lua")
|
||||||
include("third_party/libav.lua")
|
include("third_party/libav.lua")
|
||||||
include("third_party/spirv-tools.lua")
|
include("third_party/spirv-tools.lua")
|
||||||
include("third_party/xxhash.lua")
|
include("third_party/xxhash.lua")
|
||||||
include("third_party/zlib.lua")
|
include("third_party/zlib.lua")
|
||||||
include("build_tools/third_party/gflags.lua")
|
|
||||||
|
|
||||||
include("src/xenia")
|
include("src/xenia")
|
||||||
include("src/xenia/app")
|
include("src/xenia/app")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-app")
|
project("xenia-app")
|
||||||
|
@ -32,7 +32,7 @@ project("xenia-app")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
files({
|
files({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-apu-nop")
|
project("xenia-apu-nop")
|
||||||
|
@ -13,6 +13,6 @@ project("xenia-apu-nop")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-apu")
|
project("xenia-apu")
|
||||||
|
@ -14,7 +14,7 @@ project("xenia-apu")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
project_root.."/third_party/libav/",
|
project_root.."/third_party/libav/",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-apu-xaudio2")
|
project("xenia-apu-xaudio2")
|
||||||
|
@ -13,6 +13,6 @@ project("xenia-apu-xaudio2")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
project("xenia-base")
|
project("xenia-base")
|
||||||
uuid("aeadaf22-2b20-4941-b05f-a802d5679c11")
|
uuid("aeadaf22-2b20-4941-b05f-a802d5679c11")
|
||||||
|
@ -8,7 +8,7 @@ project("xenia-base")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
removefiles({"main_*.cc"})
|
removefiles({"main_*.cc"})
|
||||||
|
@ -18,7 +18,7 @@ project("xenia-base")
|
||||||
|
|
||||||
test_suite("xenia-base-tests", project_root, ".", {
|
test_suite("xenia-base-tests", project_root, ".", {
|
||||||
includedirs = {
|
includedirs = {
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
},
|
},
|
||||||
links = {
|
links = {
|
||||||
"xenia-base",
|
"xenia-base",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../../.."
|
project_root = "../../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-cpu-backend-x64")
|
project("xenia-cpu-backend-x64")
|
||||||
|
@ -21,6 +21,6 @@ project("xenia-cpu-backend-x64")
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/third_party/capstone/include",
|
project_root.."/third_party/capstone/include",
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -178,6 +178,6 @@ test_divdu_11:
|
||||||
#_ REGISTER_IN r3 0xFFFFFFFF
|
#_ REGISTER_IN r3 0xFFFFFFFF
|
||||||
divdu. r0, r0, r3
|
divdu. r0, r0, r3
|
||||||
blr
|
blr
|
||||||
#_ REGISTER_OUT r0 0xFFFFFFFF
|
#_ REGISTER_OUT r0 0
|
||||||
#_ REGISTER_OUT r3 0xFFFFFFFF
|
#_ REGISTER_OUT r3 0xFFFFFFFF
|
||||||
#_ REGISTER_OUT cr 0x0000000020000000
|
#_ REGISTER_OUT cr 0x0000000020000000
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../../.."
|
project_root = "../../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("tests")
|
group("tests")
|
||||||
project("xenia-cpu-ppc-tests")
|
project("xenia-cpu-ppc-tests")
|
||||||
|
@ -25,7 +25,7 @@ project("xenia-cpu-ppc-tests")
|
||||||
"*.s",
|
"*.s",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
filter("files:*.s")
|
filter("files:*.s")
|
||||||
flags({"ExcludeFromBuild"})
|
flags({"ExcludeFromBuild"})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-cpu")
|
project("xenia-cpu")
|
||||||
|
@ -11,7 +11,7 @@ project("xenia-cpu")
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/third_party/llvm/include",
|
project_root.."/third_party/llvm/include",
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
local_platform_files("backend")
|
local_platform_files("backend")
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
test_suite("xenia-cpu-tests", project_root, ".", {
|
test_suite("xenia-cpu-tests", project_root, ".", {
|
||||||
includedirs = {
|
includedirs = {
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
},
|
},
|
||||||
links = {
|
links = {
|
||||||
"xenia-base",
|
"xenia-base",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-debug")
|
project("xenia-debug")
|
||||||
|
@ -13,6 +13,6 @@ project("xenia-debug")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-debug-ui")
|
project("xenia-debug-ui")
|
||||||
|
@ -20,6 +20,6 @@ project("xenia-debug-ui")
|
||||||
"GLEW_MX=1",
|
"GLEW_MX=1",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-gpu-gl4")
|
project("xenia-gpu-gl4")
|
||||||
|
@ -19,7 +19,7 @@ project("xenia-gpu-gl4")
|
||||||
"GLEW_MX=1",
|
"GLEW_MX=1",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ project("xenia-gpu-gl4-trace-viewer")
|
||||||
"GLEW_MX=1",
|
"GLEW_MX=1",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
files({
|
files({
|
||||||
"gl4_trace_viewer_main.cc",
|
"gl4_trace_viewer_main.cc",
|
||||||
|
@ -110,7 +110,7 @@ project("xenia-gpu-gl4-trace-dump")
|
||||||
"GLEW_MX=1",
|
"GLEW_MX=1",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
files({
|
files({
|
||||||
"gl4_trace_dump_main.cc",
|
"gl4_trace_dump_main.cc",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-gpu")
|
project("xenia-gpu")
|
||||||
|
@ -18,7 +18,7 @@ project("xenia-gpu")
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/third_party/spirv-tools/external/include",
|
project_root.."/third_party/spirv-tools/external/include",
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ project("xenia-gpu-shader-compiler")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
files({
|
files({
|
||||||
"shader_compiler_main.cc",
|
"shader_compiler_main.cc",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-hid-nop")
|
project("xenia-hid-nop")
|
||||||
|
@ -13,6 +13,6 @@ project("xenia-hid-nop")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-hid")
|
project("xenia-hid")
|
||||||
|
@ -12,7 +12,7 @@ project("xenia-hid")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
removefiles({"*_demo.cc"})
|
removefiles({"*_demo.cc"})
|
||||||
|
@ -40,7 +40,7 @@ project("xenia-hid-demo")
|
||||||
"GLEW_MX=1",
|
"GLEW_MX=1",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
files({
|
files({
|
||||||
"hid_demo.cc",
|
"hid_demo.cc",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-hid-winkey")
|
project("xenia-hid-winkey")
|
||||||
|
@ -14,6 +14,6 @@ project("xenia-hid-winkey")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-hid-xinput")
|
project("xenia-hid-xinput")
|
||||||
|
@ -13,6 +13,6 @@ project("xenia-hid-xinput")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-kernel")
|
project("xenia-kernel")
|
||||||
|
@ -18,7 +18,7 @@ project("xenia-kernel")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
recursive_platform_files()
|
recursive_platform_files()
|
||||||
files({
|
files({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../.."
|
project_root = "../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-core")
|
project("xenia-core")
|
||||||
|
@ -12,6 +12,6 @@ project("xenia-core")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
files({"*.h", "*.cc"})
|
files({"*.h", "*.cc"})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-ui-gl")
|
project("xenia-ui-gl")
|
||||||
|
@ -16,7 +16,7 @@ project("xenia-ui-gl")
|
||||||
"GLEW_MX=1",
|
"GLEW_MX=1",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
removefiles({"*_demo.cc"})
|
removefiles({"*_demo.cc"})
|
||||||
|
@ -42,7 +42,7 @@ project("xenia-ui-window-gl-demo")
|
||||||
"GLEW_MX=1",
|
"GLEW_MX=1",
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
files({
|
files({
|
||||||
"../window_demo.cc",
|
"../window_demo.cc",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-ui")
|
project("xenia-ui")
|
||||||
|
@ -12,7 +12,7 @@ project("xenia-ui")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
removefiles({"*_demo.cc"})
|
removefiles({"*_demo.cc"})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../../.."
|
project_root = "../../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-ui-spirv")
|
project("xenia-ui-spirv")
|
||||||
|
@ -13,7 +13,7 @@ project("xenia-ui-spirv")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
project_root.."/third_party/spirv-tools/external/include",
|
project_root.."/third_party/spirv-tools/external/include",
|
||||||
})
|
})
|
||||||
local_platform_files()
|
local_platform_files()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project_root = "../../.."
|
project_root = "../../.."
|
||||||
include(project_root.."/build_tools")
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
group("src")
|
group("src")
|
||||||
project("xenia-vfs")
|
project("xenia-vfs")
|
||||||
|
@ -12,6 +12,6 @@ project("xenia-vfs")
|
||||||
defines({
|
defines({
|
||||||
})
|
})
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/build_tools/third_party/gflags/src",
|
project_root.."third_party/gflags/src",
|
||||||
})
|
})
|
||||||
recursive_platform_files()
|
recursive_platform_files()
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 7424b23bfb4423fd1213141633844f09faaff8bc
|
|
@ -0,0 +1,120 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
|
||||||
|
#
|
||||||
|
# The LLVM Compiler Infrastructure
|
||||||
|
#
|
||||||
|
# This file is distributed under the University of Illinois Open Source
|
||||||
|
# License. See LICENSE.TXT for details.
|
||||||
|
#
|
||||||
|
#===------------------------------------------------------------------------===#
|
||||||
|
|
||||||
|
r"""
|
||||||
|
ClangFormat Diff Reformatter
|
||||||
|
============================
|
||||||
|
|
||||||
|
This script reads input from a unified diff and reformats all the changed
|
||||||
|
lines. This is useful to reformat all the lines touched by a specific patch.
|
||||||
|
Example usage for git/svn users:
|
||||||
|
|
||||||
|
git diff -U0 HEAD^ | clang-format-diff.py -p1 -i
|
||||||
|
svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import difflib
|
||||||
|
import re
|
||||||
|
import string
|
||||||
|
import subprocess
|
||||||
|
import StringIO
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
# Change this to the full path if clang-format is not on the path.
|
||||||
|
binary = 'clang-format'
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=
|
||||||
|
'Reformat changed lines in diff. Without -i '
|
||||||
|
'option just output the diff that would be '
|
||||||
|
'introduced.')
|
||||||
|
parser.add_argument('-i', action='store_true', default=False,
|
||||||
|
help='apply edits to files instead of displaying a diff')
|
||||||
|
parser.add_argument('-p', metavar='NUM', default=0,
|
||||||
|
help='strip the smallest prefix containing P slashes')
|
||||||
|
parser.add_argument('-regex', metavar='PATTERN', default=None,
|
||||||
|
help='custom pattern selecting file paths to reformat '
|
||||||
|
'(case sensitive, overrides -iregex)')
|
||||||
|
parser.add_argument('-iregex', metavar='PATTERN', default=
|
||||||
|
r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc|js|proto'
|
||||||
|
r'|protodevel|java)',
|
||||||
|
help='custom pattern selecting file paths to reformat '
|
||||||
|
'(case insensitive, overridden by -regex)')
|
||||||
|
parser.add_argument('-v', '--verbose', action='store_true',
|
||||||
|
help='be more verbose, ineffective without -i')
|
||||||
|
parser.add_argument(
|
||||||
|
'-style',
|
||||||
|
help=
|
||||||
|
'formatting style to apply (LLVM, Google, Chromium, Mozilla, WebKit)')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Extract changed lines for each file.
|
||||||
|
filename = None
|
||||||
|
lines_by_file = {}
|
||||||
|
for line in sys.stdin:
|
||||||
|
match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
|
||||||
|
if match:
|
||||||
|
filename = match.group(2)
|
||||||
|
if filename == None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if args.regex is not None:
|
||||||
|
if not re.match('^%s$' % args.regex, filename):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
|
||||||
|
continue
|
||||||
|
|
||||||
|
match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
|
||||||
|
if match:
|
||||||
|
start_line = int(match.group(1))
|
||||||
|
line_count = 1
|
||||||
|
if match.group(3):
|
||||||
|
line_count = int(match.group(3))
|
||||||
|
if line_count == 0:
|
||||||
|
continue
|
||||||
|
end_line = start_line + line_count - 1;
|
||||||
|
lines_by_file.setdefault(filename, []).extend(
|
||||||
|
['-lines', str(start_line) + ':' + str(end_line)])
|
||||||
|
|
||||||
|
# Reformat files containing changes in place.
|
||||||
|
for filename, lines in lines_by_file.iteritems():
|
||||||
|
if args.i and args.verbose:
|
||||||
|
print 'Formatting', filename
|
||||||
|
command = [binary, filename]
|
||||||
|
if args.i:
|
||||||
|
command.append('-i')
|
||||||
|
command.extend(lines)
|
||||||
|
if args.style:
|
||||||
|
command.extend(['-style', args.style])
|
||||||
|
p = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||||
|
stderr=None, stdin=subprocess.PIPE)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
if p.returncode != 0:
|
||||||
|
sys.exit(p.returncode);
|
||||||
|
|
||||||
|
if not args.i:
|
||||||
|
with open(filename) as f:
|
||||||
|
code = f.readlines()
|
||||||
|
formatted_code = StringIO.StringIO(stdout).readlines()
|
||||||
|
diff = difflib.unified_diff(code, formatted_code,
|
||||||
|
filename, filename,
|
||||||
|
'(before formatting)', '(after formatting)')
|
||||||
|
diff_string = string.join(diff, '')
|
||||||
|
if len(diff_string) > 0:
|
||||||
|
sys.stdout.write(diff_string)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -0,0 +1,58 @@
|
||||||
|
# This file is a minimal clang-format sublime-integration. To install:
|
||||||
|
# - Change 'binary' if clang-format is not on the path (see below).
|
||||||
|
# - Put this file into your sublime Packages directory, e.g. on Linux:
|
||||||
|
# ~/.config/sublime-text-2/Packages/User/clang-format-sublime.py
|
||||||
|
# - Add a key binding:
|
||||||
|
# { "keys": ["ctrl+shift+c"], "command": "clang_format" },
|
||||||
|
#
|
||||||
|
# With this integration you can press the bound key and clang-format will
|
||||||
|
# format the current lines and selections for all cursor positions. The lines
|
||||||
|
# or regions are extended to the next bigger syntactic entities.
|
||||||
|
#
|
||||||
|
# It operates on the current, potentially unsaved buffer and does not create
|
||||||
|
# or save any files. To revert a formatting, just undo.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
import sublime
|
||||||
|
import sublime_plugin
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
# Change this to the full path if clang-format is not on the path.
|
||||||
|
binary = 'clang-format'
|
||||||
|
|
||||||
|
# Change this to format according to other formatting styles. See the output of
|
||||||
|
# 'clang-format --help' for a list of supported styles. The default looks for
|
||||||
|
# a '.clang-format' or '_clang-format' file to indicate the style that should be
|
||||||
|
# used.
|
||||||
|
style = 'file'
|
||||||
|
|
||||||
|
class ClangFormatCommand(sublime_plugin.TextCommand):
|
||||||
|
def run(self, edit):
|
||||||
|
encoding = self.view.encoding()
|
||||||
|
if encoding == 'Undefined':
|
||||||
|
encoding = 'utf-8'
|
||||||
|
regions = []
|
||||||
|
command = [binary, '-style', style]
|
||||||
|
for region in self.view.sel():
|
||||||
|
regions.append(region)
|
||||||
|
region_offset = min(region.a, region.b)
|
||||||
|
region_length = abs(region.b - region.a)
|
||||||
|
command.extend(['-offset', str(region_offset),
|
||||||
|
'-length', str(region_length),
|
||||||
|
'-assume-filename', str(self.view.file_name())])
|
||||||
|
old_viewport_position = self.view.viewport_position()
|
||||||
|
buf = self.view.substr(sublime.Region(0, self.view.size()))
|
||||||
|
p = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||||
|
output, error = p.communicate(buf.encode(encoding))
|
||||||
|
if error:
|
||||||
|
print(error)
|
||||||
|
self.view.replace(
|
||||||
|
edit, sublime.Region(0, self.view.size()),
|
||||||
|
output.decode(encoding))
|
||||||
|
self.view.sel().clear()
|
||||||
|
for region in regions:
|
||||||
|
self.view.sel().add(region)
|
||||||
|
# FIXME: Without the 10ms delay, the viewport sometimes jumps.
|
||||||
|
sublime.set_timeout(lambda: self.view.set_viewport_position(
|
||||||
|
old_viewport_position, False), 10)
|
|
@ -0,0 +1,484 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
#===- git-clang-format - ClangFormat Git Integration ---------*- python -*--===#
|
||||||
|
#
|
||||||
|
# The LLVM Compiler Infrastructure
|
||||||
|
#
|
||||||
|
# This file is distributed under the University of Illinois Open Source
|
||||||
|
# License. See LICENSE.TXT for details.
|
||||||
|
#
|
||||||
|
#===------------------------------------------------------------------------===#
|
||||||
|
|
||||||
|
r"""
|
||||||
|
clang-format git integration
|
||||||
|
============================
|
||||||
|
|
||||||
|
This file provides a clang-format integration for git. Put it somewhere in your
|
||||||
|
path and ensure that it is executable. Then, "git clang-format" will invoke
|
||||||
|
clang-format on the changes in current files or a specific commit.
|
||||||
|
|
||||||
|
For further details, run:
|
||||||
|
git clang-format -h
|
||||||
|
|
||||||
|
Requires Python 2.7
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import collections
|
||||||
|
import contextlib
|
||||||
|
import errno
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
usage = 'git clang-format [OPTIONS] [<commit>] [--] [<file>...]'
|
||||||
|
|
||||||
|
desc = '''
|
||||||
|
Run clang-format on all lines that differ between the working directory
|
||||||
|
and <commit>, which defaults to HEAD. Changes are only applied to the working
|
||||||
|
directory.
|
||||||
|
|
||||||
|
The following git-config settings set the default of the corresponding option:
|
||||||
|
clangFormat.binary
|
||||||
|
clangFormat.commit
|
||||||
|
clangFormat.extension
|
||||||
|
clangFormat.style
|
||||||
|
'''
|
||||||
|
|
||||||
|
# Name of the temporary index file in which save the output of clang-format.
|
||||||
|
# This file is created within the .git directory.
|
||||||
|
temp_index_basename = 'clang-format-index'
|
||||||
|
|
||||||
|
|
||||||
|
Range = collections.namedtuple('Range', 'start, count')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
config = load_git_config()
|
||||||
|
|
||||||
|
# In order to keep '--' yet allow options after positionals, we need to
|
||||||
|
# check for '--' ourselves. (Setting nargs='*' throws away the '--', while
|
||||||
|
# nargs=argparse.REMAINDER disallows options after positionals.)
|
||||||
|
argv = sys.argv[1:]
|
||||||
|
try:
|
||||||
|
idx = argv.index('--')
|
||||||
|
except ValueError:
|
||||||
|
dash_dash = []
|
||||||
|
else:
|
||||||
|
dash_dash = argv[idx:]
|
||||||
|
argv = argv[:idx]
|
||||||
|
|
||||||
|
default_extensions = ','.join([
|
||||||
|
# From clang/lib/Frontend/FrontendOptions.cpp, all lower case
|
||||||
|
'c', 'h', # C
|
||||||
|
'm', # ObjC
|
||||||
|
'mm', # ObjC++
|
||||||
|
'cc', 'cp', 'cpp', 'c++', 'cxx', 'hpp', # C++
|
||||||
|
# Other languages that clang-format supports
|
||||||
|
'proto', 'protodevel', # Protocol Buffers
|
||||||
|
'js', # JavaScript
|
||||||
|
])
|
||||||
|
|
||||||
|
p = argparse.ArgumentParser(
|
||||||
|
usage=usage, formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
|
description=desc)
|
||||||
|
p.add_argument('--binary',
|
||||||
|
default=config.get('clangformat.binary', 'clang-format'),
|
||||||
|
help='path to clang-format'),
|
||||||
|
p.add_argument('--commit',
|
||||||
|
default=config.get('clangformat.commit', 'HEAD'),
|
||||||
|
help='default commit to use if none is specified'),
|
||||||
|
p.add_argument('--diff', action='store_true',
|
||||||
|
help='print a diff instead of applying the changes')
|
||||||
|
p.add_argument('--extensions',
|
||||||
|
default=config.get('clangformat.extensions',
|
||||||
|
default_extensions),
|
||||||
|
help=('comma-separated list of file extensions to format, '
|
||||||
|
'excluding the period and case-insensitive')),
|
||||||
|
p.add_argument('-f', '--force', action='store_true',
|
||||||
|
help='allow changes to unstaged files')
|
||||||
|
p.add_argument('-p', '--patch', action='store_true',
|
||||||
|
help='select hunks interactively')
|
||||||
|
p.add_argument('-q', '--quiet', action='count', default=0,
|
||||||
|
help='print less information')
|
||||||
|
p.add_argument('--style',
|
||||||
|
default=config.get('clangformat.style', None),
|
||||||
|
help='passed to clang-format'),
|
||||||
|
p.add_argument('-v', '--verbose', action='count', default=0,
|
||||||
|
help='print extra information')
|
||||||
|
# We gather all the remaining positional arguments into 'args' since we need
|
||||||
|
# to use some heuristics to determine whether or not <commit> was present.
|
||||||
|
# However, to print pretty messages, we make use of metavar and help.
|
||||||
|
p.add_argument('args', nargs='*', metavar='<commit>',
|
||||||
|
help='revision from which to compute the diff')
|
||||||
|
p.add_argument('ignored', nargs='*', metavar='<file>...',
|
||||||
|
help='if specified, only consider differences in these files')
|
||||||
|
opts = p.parse_args(argv)
|
||||||
|
|
||||||
|
opts.verbose -= opts.quiet
|
||||||
|
del opts.quiet
|
||||||
|
|
||||||
|
commit, files = interpret_args(opts.args, dash_dash, opts.commit)
|
||||||
|
changed_lines = compute_diff_and_extract_lines(commit, files)
|
||||||
|
if opts.verbose >= 1:
|
||||||
|
ignored_files = set(changed_lines)
|
||||||
|
filter_by_extension(changed_lines, opts.extensions.lower().split(','))
|
||||||
|
if opts.verbose >= 1:
|
||||||
|
ignored_files.difference_update(changed_lines)
|
||||||
|
if ignored_files:
|
||||||
|
print 'Ignoring changes in the following files (wrong extension):'
|
||||||
|
for filename in ignored_files:
|
||||||
|
print ' ', filename
|
||||||
|
if changed_lines:
|
||||||
|
print 'Running clang-format on the following files:'
|
||||||
|
for filename in changed_lines:
|
||||||
|
print ' ', filename
|
||||||
|
if not changed_lines:
|
||||||
|
print 'no modified files to format'
|
||||||
|
return
|
||||||
|
# The computed diff outputs absolute paths, so we must cd before accessing
|
||||||
|
# those files.
|
||||||
|
cd_to_toplevel()
|
||||||
|
old_tree = create_tree_from_workdir(changed_lines)
|
||||||
|
new_tree = run_clang_format_and_save_to_tree(changed_lines,
|
||||||
|
binary=opts.binary,
|
||||||
|
style=opts.style)
|
||||||
|
if opts.verbose >= 1:
|
||||||
|
print 'old tree:', old_tree
|
||||||
|
print 'new tree:', new_tree
|
||||||
|
if old_tree == new_tree:
|
||||||
|
if opts.verbose >= 0:
|
||||||
|
print 'clang-format did not modify any files'
|
||||||
|
elif opts.diff:
|
||||||
|
print_diff(old_tree, new_tree)
|
||||||
|
else:
|
||||||
|
changed_files = apply_changes(old_tree, new_tree, force=opts.force,
|
||||||
|
patch_mode=opts.patch)
|
||||||
|
if (opts.verbose >= 0 and not opts.patch) or opts.verbose >= 1:
|
||||||
|
print 'changed files:'
|
||||||
|
for filename in changed_files:
|
||||||
|
print ' ', filename
|
||||||
|
|
||||||
|
|
||||||
|
def load_git_config(non_string_options=None):
|
||||||
|
"""Return the git configuration as a dictionary.
|
||||||
|
|
||||||
|
All options are assumed to be strings unless in `non_string_options`, in which
|
||||||
|
is a dictionary mapping option name (in lower case) to either "--bool" or
|
||||||
|
"--int"."""
|
||||||
|
if non_string_options is None:
|
||||||
|
non_string_options = {}
|
||||||
|
out = {}
|
||||||
|
for entry in run('git', 'config', '--list', '--null').split('\0'):
|
||||||
|
if entry:
|
||||||
|
name, value = entry.split('\n', 1)
|
||||||
|
if name in non_string_options:
|
||||||
|
value = run('git', 'config', non_string_options[name], name)
|
||||||
|
out[name] = value
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def interpret_args(args, dash_dash, default_commit):
|
||||||
|
"""Interpret `args` as "[commit] [--] [files...]" and return (commit, files).
|
||||||
|
|
||||||
|
It is assumed that "--" and everything that follows has been removed from
|
||||||
|
args and placed in `dash_dash`.
|
||||||
|
|
||||||
|
If "--" is present (i.e., `dash_dash` is non-empty), the argument to its
|
||||||
|
left (if present) is taken as commit. Otherwise, the first argument is
|
||||||
|
checked if it is a commit or a file. If commit is not given,
|
||||||
|
`default_commit` is used."""
|
||||||
|
if dash_dash:
|
||||||
|
if len(args) == 0:
|
||||||
|
commit = default_commit
|
||||||
|
elif len(args) > 1:
|
||||||
|
die('at most one commit allowed; %d given' % len(args))
|
||||||
|
else:
|
||||||
|
commit = args[0]
|
||||||
|
object_type = get_object_type(commit)
|
||||||
|
if object_type not in ('commit', 'tag'):
|
||||||
|
if object_type is None:
|
||||||
|
die("'%s' is not a commit" % commit)
|
||||||
|
else:
|
||||||
|
die("'%s' is a %s, but a commit was expected" % (commit, object_type))
|
||||||
|
files = dash_dash[1:]
|
||||||
|
elif args:
|
||||||
|
if disambiguate_revision(args[0]):
|
||||||
|
commit = args[0]
|
||||||
|
files = args[1:]
|
||||||
|
else:
|
||||||
|
commit = default_commit
|
||||||
|
files = args
|
||||||
|
else:
|
||||||
|
commit = default_commit
|
||||||
|
files = []
|
||||||
|
return commit, files
|
||||||
|
|
||||||
|
|
||||||
|
def disambiguate_revision(value):
|
||||||
|
"""Returns True if `value` is a revision, False if it is a file, or dies."""
|
||||||
|
# If `value` is ambiguous (neither a commit nor a file), the following
|
||||||
|
# command will die with an appropriate error message.
|
||||||
|
run('git', 'rev-parse', value, verbose=False)
|
||||||
|
object_type = get_object_type(value)
|
||||||
|
if object_type is None:
|
||||||
|
return False
|
||||||
|
if object_type in ('commit', 'tag'):
|
||||||
|
return True
|
||||||
|
die('`%s` is a %s, but a commit or filename was expected' %
|
||||||
|
(value, object_type))
|
||||||
|
|
||||||
|
|
||||||
|
def get_object_type(value):
|
||||||
|
"""Returns a string description of an object's type, or None if it is not
|
||||||
|
a valid git object."""
|
||||||
|
cmd = ['git', 'cat-file', '-t', value]
|
||||||
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
if p.returncode != 0:
|
||||||
|
return None
|
||||||
|
return stdout.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def compute_diff_and_extract_lines(commit, files):
|
||||||
|
"""Calls compute_diff() followed by extract_lines()."""
|
||||||
|
diff_process = compute_diff(commit, files)
|
||||||
|
changed_lines = extract_lines(diff_process.stdout)
|
||||||
|
diff_process.stdout.close()
|
||||||
|
diff_process.wait()
|
||||||
|
if diff_process.returncode != 0:
|
||||||
|
# Assume error was already printed to stderr.
|
||||||
|
sys.exit(2)
|
||||||
|
return changed_lines
|
||||||
|
|
||||||
|
|
||||||
|
def compute_diff(commit, files):
|
||||||
|
"""Return a subprocess object producing the diff from `commit`.
|
||||||
|
|
||||||
|
The return value's `stdin` file object will produce a patch with the
|
||||||
|
differences between the working directory and `commit`, filtered on `files`
|
||||||
|
(if non-empty). Zero context lines are used in the patch."""
|
||||||
|
cmd = ['git', 'diff-index', '-p', '-U0', commit, '--']
|
||||||
|
cmd.extend(files)
|
||||||
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
p.stdin.close()
|
||||||
|
return p
|
||||||
|
|
||||||
|
|
||||||
|
def extract_lines(patch_file):
|
||||||
|
"""Extract the changed lines in `patch_file`.
|
||||||
|
|
||||||
|
The return value is a dictionary mapping filename to a list of (start_line,
|
||||||
|
line_count) pairs.
|
||||||
|
|
||||||
|
The input must have been produced with ``-U0``, meaning unidiff format with
|
||||||
|
zero lines of context. The return value is a dict mapping filename to a
|
||||||
|
list of line `Range`s."""
|
||||||
|
matches = {}
|
||||||
|
for line in patch_file:
|
||||||
|
match = re.search(r'^\+\+\+\ [^/]+/(.*)', line)
|
||||||
|
if match:
|
||||||
|
filename = match.group(1).rstrip('\r\n')
|
||||||
|
match = re.search(r'^@@ -[0-9,]+ \+(\d+)(,(\d+))?', line)
|
||||||
|
if match:
|
||||||
|
start_line = int(match.group(1))
|
||||||
|
line_count = 1
|
||||||
|
if match.group(3):
|
||||||
|
line_count = int(match.group(3))
|
||||||
|
if line_count > 0:
|
||||||
|
matches.setdefault(filename, []).append(Range(start_line, line_count))
|
||||||
|
return matches
|
||||||
|
|
||||||
|
|
||||||
|
def filter_by_extension(dictionary, allowed_extensions):
|
||||||
|
"""Delete every key in `dictionary` that doesn't have an allowed extension.
|
||||||
|
|
||||||
|
`allowed_extensions` must be a collection of lowercase file extensions,
|
||||||
|
excluding the period."""
|
||||||
|
allowed_extensions = frozenset(allowed_extensions)
|
||||||
|
for filename in dictionary.keys():
|
||||||
|
base_ext = filename.rsplit('.', 1)
|
||||||
|
if len(base_ext) == 1 or base_ext[1].lower() not in allowed_extensions:
|
||||||
|
del dictionary[filename]
|
||||||
|
|
||||||
|
|
||||||
|
def cd_to_toplevel():
|
||||||
|
"""Change to the top level of the git repository."""
|
||||||
|
toplevel = run('git', 'rev-parse', '--show-toplevel')
|
||||||
|
os.chdir(toplevel)
|
||||||
|
|
||||||
|
|
||||||
|
def create_tree_from_workdir(filenames):
|
||||||
|
"""Create a new git tree with the given files from the working directory.
|
||||||
|
|
||||||
|
Returns the object ID (SHA-1) of the created tree."""
|
||||||
|
return create_tree(filenames, '--stdin')
|
||||||
|
|
||||||
|
|
||||||
|
def run_clang_format_and_save_to_tree(changed_lines, binary='clang-format',
|
||||||
|
style=None):
|
||||||
|
"""Run clang-format on each file and save the result to a git tree.
|
||||||
|
|
||||||
|
Returns the object ID (SHA-1) of the created tree."""
|
||||||
|
def index_info_generator():
|
||||||
|
for filename, line_ranges in changed_lines.iteritems():
|
||||||
|
mode = oct(os.stat(filename).st_mode)
|
||||||
|
blob_id = clang_format_to_blob(filename, line_ranges, binary=binary,
|
||||||
|
style=style)
|
||||||
|
yield '%s %s\t%s' % (mode, blob_id, filename)
|
||||||
|
return create_tree(index_info_generator(), '--index-info')
|
||||||
|
|
||||||
|
|
||||||
|
def create_tree(input_lines, mode):
|
||||||
|
"""Create a tree object from the given input.
|
||||||
|
|
||||||
|
If mode is '--stdin', it must be a list of filenames. If mode is
|
||||||
|
'--index-info' is must be a list of values suitable for "git update-index
|
||||||
|
--index-info", such as "<mode> <SP> <sha1> <TAB> <filename>". Any other mode
|
||||||
|
is invalid."""
|
||||||
|
assert mode in ('--stdin', '--index-info')
|
||||||
|
cmd = ['git', 'update-index', '--add', '-z', mode]
|
||||||
|
with temporary_index_file():
|
||||||
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
|
||||||
|
for line in input_lines:
|
||||||
|
p.stdin.write('%s\0' % line)
|
||||||
|
p.stdin.close()
|
||||||
|
if p.wait() != 0:
|
||||||
|
die('`%s` failed' % ' '.join(cmd))
|
||||||
|
tree_id = run('git', 'write-tree')
|
||||||
|
return tree_id
|
||||||
|
|
||||||
|
|
||||||
|
def clang_format_to_blob(filename, line_ranges, binary='clang-format',
|
||||||
|
style=None):
|
||||||
|
"""Run clang-format on the given file and save the result to a git blob.
|
||||||
|
|
||||||
|
Returns the object ID (SHA-1) of the created blob."""
|
||||||
|
clang_format_cmd = [binary, filename]
|
||||||
|
if style:
|
||||||
|
clang_format_cmd.extend(['-style='+style])
|
||||||
|
clang_format_cmd.extend([
|
||||||
|
'-lines=%s:%s' % (start_line, start_line+line_count-1)
|
||||||
|
for start_line, line_count in line_ranges])
|
||||||
|
try:
|
||||||
|
clang_format = subprocess.Popen(clang_format_cmd, stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno == errno.ENOENT:
|
||||||
|
die('cannot find executable "%s"' % binary)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
clang_format.stdin.close()
|
||||||
|
hash_object_cmd = ['git', 'hash-object', '-w', '--path='+filename, '--stdin']
|
||||||
|
hash_object = subprocess.Popen(hash_object_cmd, stdin=clang_format.stdout,
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
clang_format.stdout.close()
|
||||||
|
stdout = hash_object.communicate()[0]
|
||||||
|
if hash_object.returncode != 0:
|
||||||
|
die('`%s` failed' % ' '.join(hash_object_cmd))
|
||||||
|
if clang_format.wait() != 0:
|
||||||
|
die('`%s` failed' % ' '.join(clang_format_cmd))
|
||||||
|
return stdout.rstrip('\r\n')
|
||||||
|
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def temporary_index_file(tree=None):
|
||||||
|
"""Context manager for setting GIT_INDEX_FILE to a temporary file and deleting
|
||||||
|
the file afterward."""
|
||||||
|
index_path = create_temporary_index(tree)
|
||||||
|
old_index_path = os.environ.get('GIT_INDEX_FILE')
|
||||||
|
os.environ['GIT_INDEX_FILE'] = index_path
|
||||||
|
try:
|
||||||
|
yield
|
||||||
|
finally:
|
||||||
|
if old_index_path is None:
|
||||||
|
del os.environ['GIT_INDEX_FILE']
|
||||||
|
else:
|
||||||
|
os.environ['GIT_INDEX_FILE'] = old_index_path
|
||||||
|
os.remove(index_path)
|
||||||
|
|
||||||
|
|
||||||
|
def create_temporary_index(tree=None):
|
||||||
|
"""Create a temporary index file and return the created file's path.
|
||||||
|
|
||||||
|
If `tree` is not None, use that as the tree to read in. Otherwise, an
|
||||||
|
empty index is created."""
|
||||||
|
gitdir = run('git', 'rev-parse', '--git-dir')
|
||||||
|
path = os.path.join(gitdir, temp_index_basename)
|
||||||
|
if tree is None:
|
||||||
|
tree = '--empty'
|
||||||
|
run('git', 'read-tree', '--index-output='+path, tree)
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def print_diff(old_tree, new_tree):
|
||||||
|
"""Print the diff between the two trees to stdout."""
|
||||||
|
# We use the porcelain 'diff' and not plumbing 'diff-tree' because the output
|
||||||
|
# is expected to be viewed by the user, and only the former does nice things
|
||||||
|
# like color and pagination.
|
||||||
|
subprocess.check_call(['git', 'diff', old_tree, new_tree, '--'])
|
||||||
|
|
||||||
|
|
||||||
|
def apply_changes(old_tree, new_tree, force=False, patch_mode=False):
|
||||||
|
"""Apply the changes in `new_tree` to the working directory.
|
||||||
|
|
||||||
|
Bails if there are local changes in those files and not `force`. If
|
||||||
|
`patch_mode`, runs `git checkout --patch` to select hunks interactively."""
|
||||||
|
changed_files = run('git', 'diff-tree', '-r', '-z', '--name-only', old_tree,
|
||||||
|
new_tree).rstrip('\0').split('\0')
|
||||||
|
if not force:
|
||||||
|
unstaged_files = run('git', 'diff-files', '--name-status', *changed_files)
|
||||||
|
if unstaged_files:
|
||||||
|
print >>sys.stderr, ('The following files would be modified but '
|
||||||
|
'have unstaged changes:')
|
||||||
|
print >>sys.stderr, unstaged_files
|
||||||
|
print >>sys.stderr, 'Please commit, stage, or stash them first.'
|
||||||
|
sys.exit(2)
|
||||||
|
if patch_mode:
|
||||||
|
# In patch mode, we could just as well create an index from the new tree
|
||||||
|
# and checkout from that, but then the user will be presented with a
|
||||||
|
# message saying "Discard ... from worktree". Instead, we use the old
|
||||||
|
# tree as the index and checkout from new_tree, which gives the slightly
|
||||||
|
# better message, "Apply ... to index and worktree". This is not quite
|
||||||
|
# right, since it won't be applied to the user's index, but oh well.
|
||||||
|
with temporary_index_file(old_tree):
|
||||||
|
subprocess.check_call(['git', 'checkout', '--patch', new_tree])
|
||||||
|
index_tree = old_tree
|
||||||
|
else:
|
||||||
|
with temporary_index_file(new_tree):
|
||||||
|
run('git', 'checkout-index', '-a', '-f')
|
||||||
|
return changed_files
|
||||||
|
|
||||||
|
|
||||||
|
def run(*args, **kwargs):
|
||||||
|
stdin = kwargs.pop('stdin', '')
|
||||||
|
verbose = kwargs.pop('verbose', True)
|
||||||
|
strip = kwargs.pop('strip', True)
|
||||||
|
for name in kwargs:
|
||||||
|
raise TypeError("run() got an unexpected keyword argument '%s'" % name)
|
||||||
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
stdin=subprocess.PIPE)
|
||||||
|
stdout, stderr = p.communicate(input=stdin)
|
||||||
|
if p.returncode == 0:
|
||||||
|
if stderr:
|
||||||
|
if verbose:
|
||||||
|
print >>sys.stderr, '`%s` printed to stderr:' % ' '.join(args)
|
||||||
|
print >>sys.stderr, stderr.rstrip()
|
||||||
|
if strip:
|
||||||
|
stdout = stdout.rstrip('\r\n')
|
||||||
|
return stdout
|
||||||
|
if verbose:
|
||||||
|
print >>sys.stderr, '`%s` returned %s' % (' '.join(args), p.returncode)
|
||||||
|
if stderr:
|
||||||
|
print >>sys.stderr, stderr.rstrip()
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
|
def die(message):
|
||||||
|
print >>sys.stderr, 'error:', message
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 78b15171a7fce5815df58a919ab593ce80222028
|
|
@ -0,0 +1,41 @@
|
||||||
|
group("third_party")
|
||||||
|
project("gflags")
|
||||||
|
uuid("e319da87-75ed-4517-8f65-bd25e9cc02a3")
|
||||||
|
kind("StaticLib")
|
||||||
|
language("C++")
|
||||||
|
|
||||||
|
-- These win32-specific overrides must come before others.
|
||||||
|
filter("platforms:Windows")
|
||||||
|
defines({
|
||||||
|
"PATH_SEPARATOR=%%27\\\\%%27",
|
||||||
|
})
|
||||||
|
includedirs({
|
||||||
|
"gflags/src/windows",
|
||||||
|
})
|
||||||
|
filter({})
|
||||||
|
|
||||||
|
defines({
|
||||||
|
"GFLAGS_DLL_DECL=",
|
||||||
|
"GFLAGS_DLL_DEFINE_FLAG=",
|
||||||
|
"GFLAGS_DLL_DECLARE_FLAG=",
|
||||||
|
"_LIB",
|
||||||
|
})
|
||||||
|
includedirs({
|
||||||
|
"gflags/src",
|
||||||
|
})
|
||||||
|
files({
|
||||||
|
"gflags/src/gflags.cc",
|
||||||
|
"gflags/src/gflags_completions.cc",
|
||||||
|
"gflags/src/gflags_reporting.cc",
|
||||||
|
"gflags/src/mutex.h",
|
||||||
|
"gflags/src/util.h",
|
||||||
|
})
|
||||||
|
filter("platforms:Windows")
|
||||||
|
files({
|
||||||
|
"gflags/src/windows/config.h",
|
||||||
|
"gflags/src/windows/gflags/gflags.h",
|
||||||
|
"gflags/src/windows/gflags/gflags_completions.h",
|
||||||
|
"gflags/src/windows/gflags/gflags_declare.h",
|
||||||
|
"gflags/src/windows/port.cc",
|
||||||
|
"gflags/src/windows/port.h",
|
||||||
|
})
|
|
@ -0,0 +1,45 @@
|
||||||
|
This is automated checker to make sure a C++ file follows Google's C++ style
|
||||||
|
guide (http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml). As it
|
||||||
|
heavily relies on regular expressions, cpplint.py won't catch all violations of
|
||||||
|
the style guide and will very occasionally report a false positive. There is a
|
||||||
|
list of things we currently don't handle very well at the top of cpplint.py,
|
||||||
|
and we welcome patches to improve it.
|
||||||
|
|
||||||
|
The linting tool takes a list of files as input. For full usage instructions,
|
||||||
|
please see the output of:
|
||||||
|
|
||||||
|
./cpplint.py --help
|
||||||
|
|
||||||
|
Unit tests are provided in cpplint_unittest.py. This file can safely be ignored
|
||||||
|
by end users who have downloaded this package and only want to run the lint
|
||||||
|
tool.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
cpplint.py and its corresponding unit tests are Copyright (C) 2009 Google Inc.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1b2f19fa879d99ebe6dd57789525dc47dacd1c77
|
|
@ -0,0 +1,162 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright 2015 Ben Vanik. All Rights Reserved.
|
||||||
|
|
||||||
|
"""Premake trampoline script.
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = 'ben.vanik@gmail.com (Ben Vanik)'
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
self_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
root_path = os.path.join(self_path, '..', '..')
|
||||||
|
premake_path = os.path.join(root_path, 'third_party', 'premake-core')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# First try the freshly-built premake.
|
||||||
|
premake5_bin = os.path.join(premake_path, 'bin', 'release', 'premake5')
|
||||||
|
if not has_bin(premake5_bin):
|
||||||
|
# No fresh build, so fallback to checked in copy (which we may not have).
|
||||||
|
premake5_bin = os.path.join(self_path, 'bin', 'premake5')
|
||||||
|
if not has_bin(premake5_bin):
|
||||||
|
# Still no valid binary, so build it.
|
||||||
|
print('premake5 executable not found, attempting build...')
|
||||||
|
build_premake()
|
||||||
|
premake5_bin = os.path.join(premake_path, 'bin', 'release', 'premake5')
|
||||||
|
if not has_bin(premake5_bin):
|
||||||
|
# Nope, boned.
|
||||||
|
print('ERROR: cannot build premake5 executable.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Ensure the submodule has been checked out.
|
||||||
|
if not os.path.exists(os.path.join(premake_path, 'scripts', 'package.lua')):
|
||||||
|
print('third_party/premake-core was not present; run xb setup...')
|
||||||
|
sys.exit(1)
|
||||||
|
return
|
||||||
|
|
||||||
|
return_code = shell_call([
|
||||||
|
premake5_bin,
|
||||||
|
'--scripts=%s' % (premake_path),
|
||||||
|
] + sys.argv[1:],
|
||||||
|
throw_on_error=False)
|
||||||
|
|
||||||
|
sys.exit(return_code)
|
||||||
|
|
||||||
|
|
||||||
|
def build_premake():
|
||||||
|
"""Builds premake from source.
|
||||||
|
"""
|
||||||
|
cwd = os.getcwd()
|
||||||
|
try:
|
||||||
|
os.chdir(premake_path)
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
shell_call([
|
||||||
|
'make',
|
||||||
|
'-f', 'Bootstrap.mak',
|
||||||
|
'osx',
|
||||||
|
])
|
||||||
|
elif sys.platform == 'win32':
|
||||||
|
# TODO(benvanik): import VS environment.
|
||||||
|
shell_call([
|
||||||
|
'nmake',
|
||||||
|
'-f', 'Bootstrap.mak',
|
||||||
|
'windows',
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
shell_call([
|
||||||
|
'make',
|
||||||
|
'-f', 'Bootstrap.mak',
|
||||||
|
'linux',
|
||||||
|
])
|
||||||
|
finally:
|
||||||
|
os.chdir(cwd)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def has_bin(bin):
|
||||||
|
"""Checks whether the given binary is present.
|
||||||
|
"""
|
||||||
|
for path in os.environ["PATH"].split(os.pathsep):
|
||||||
|
path = path.strip('"')
|
||||||
|
exe_file = os.path.join(path, bin)
|
||||||
|
if os.path.isfile(exe_file) and os.access(exe_file, os.X_OK):
|
||||||
|
return True
|
||||||
|
exe_file = exe_file + '.exe'
|
||||||
|
if os.path.isfile(exe_file) and os.access(exe_file, os.X_OK):
|
||||||
|
return True
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def shell_call(command, throw_on_error=True, stdout_path=None):
|
||||||
|
"""Executes a shell command.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
command: Command to execute, as a list of parameters.
|
||||||
|
throw_on_error: Whether to throw an error or return the status code.
|
||||||
|
stdout_path: File path to write stdout output to.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
If throw_on_error is False the status code of the call will be returned.
|
||||||
|
"""
|
||||||
|
stdout_file = None
|
||||||
|
if stdout_path:
|
||||||
|
stdout_file = open(stdout_path, 'w')
|
||||||
|
result = 0
|
||||||
|
try:
|
||||||
|
if throw_on_error:
|
||||||
|
result = 1
|
||||||
|
subprocess.check_call(command, shell=False, stdout=stdout_file)
|
||||||
|
result = 0
|
||||||
|
else:
|
||||||
|
result = subprocess.call(command, shell=False, stdout=stdout_file)
|
||||||
|
finally:
|
||||||
|
if stdout_file:
|
||||||
|
stdout_file.close()
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def git_submodule_update():
|
||||||
|
"""Runs a full recursive git submodule init and update.
|
||||||
|
|
||||||
|
Older versions of git do not support 'update --init --recursive'. We could
|
||||||
|
check and run it on versions that do support it and speed things up a bit.
|
||||||
|
"""
|
||||||
|
if True:
|
||||||
|
shell_call([
|
||||||
|
'git',
|
||||||
|
'submodule',
|
||||||
|
'update',
|
||||||
|
'--init',
|
||||||
|
'--recursive',
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
shell_call([
|
||||||
|
'git',
|
||||||
|
'submodule',
|
||||||
|
'init',
|
||||||
|
])
|
||||||
|
shell_call([
|
||||||
|
'git',
|
||||||
|
'submodule',
|
||||||
|
'foreach',
|
||||||
|
'--recursive',
|
||||||
|
'git',
|
||||||
|
'submodule',
|
||||||
|
'init',
|
||||||
|
])
|
||||||
|
shell_call([
|
||||||
|
'git',
|
||||||
|
'submodule',
|
||||||
|
'update',
|
||||||
|
'--recursive',
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -0,0 +1,5 @@
|
||||||
|
include("scripts/build_paths.lua")
|
||||||
|
include("scripts/force_compile_as_c.lua")
|
||||||
|
include("scripts/force_compile_as_cc.lua")
|
||||||
|
include("scripts/platform_files.lua")
|
||||||
|
include("scripts/test_suite.lua")
|
|
@ -0,0 +1,10 @@
|
||||||
|
build_root = "build"
|
||||||
|
build_bin = build_root .. "/bin/%{cfg.platform}/%{cfg.buildcfg}"
|
||||||
|
build_gen = build_root .. "/gen/%{cfg.platform}/%{cfg.buildcfg}"
|
||||||
|
build_obj = build_root .. "/obj/%{cfg.platform}/%{cfg.buildcfg}"
|
||||||
|
|
||||||
|
build_tools = "tools/build"
|
||||||
|
build_scripts = build_tools .. "/scripts"
|
||||||
|
build_tools_src = build_tools .. "/src"
|
||||||
|
|
||||||
|
platform_suffix = "win"
|
|
@ -0,0 +1,28 @@
|
||||||
|
if premake.override then
|
||||||
|
local forced_c_files = {}
|
||||||
|
|
||||||
|
-- Forces all of the given .c and .cc files to be compiled as if they were C.
|
||||||
|
function force_compile_as_c(files)
|
||||||
|
for _, val in ipairs(files) do
|
||||||
|
for _, fname in ipairs(os.matchfiles(val)) do
|
||||||
|
table.insert(forced_c_files, path.getabsolute(fname))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- for gmake
|
||||||
|
premake.override(path, "iscfile", function(base, fname)
|
||||||
|
if table.contains(forced_c_files, fname) then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return base(fname)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- for msvc
|
||||||
|
premake.override(premake.vstudio.vc2010, "additionalCompileOptions", function(base, cfg, condition)
|
||||||
|
if cfg.abspath and table.contains(forced_c_files, cfg.abspath) then
|
||||||
|
_p(3,'<CompileAs %s>CompileAsC</CompileAs>', condition)
|
||||||
|
end
|
||||||
|
return base(cfg, condition)
|
||||||
|
end)
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
if premake.override then
|
||||||
|
local forced_cc_files = {}
|
||||||
|
|
||||||
|
-- Forces all of the given .c files to be compiled as if they were C++.
|
||||||
|
function force_compile_as_cc(files)
|
||||||
|
for _, val in ipairs(files) do
|
||||||
|
for _, fname in ipairs(os.matchfiles(val)) do
|
||||||
|
table.insert(forced_cc_files, path.getabsolute(fname))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- for gmake
|
||||||
|
premake.override(path, "iscfile", function(base, fname)
|
||||||
|
if table.contains(forced_cc_files, fname) then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return base(fname)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- for msvc
|
||||||
|
premake.override(premake.vstudio.vc2010, "additionalCompileOptions", function(base, cfg, condition)
|
||||||
|
if cfg.abspath and table.contains(forced_cc_files, cfg.abspath) then
|
||||||
|
_p(3,'<CompileAs %s>CompileAsCpp</CompileAs>', condition)
|
||||||
|
end
|
||||||
|
return base(cfg, condition)
|
||||||
|
end)
|
||||||
|
end
|
|
@ -0,0 +1,41 @@
|
||||||
|
include("build_paths.lua")
|
||||||
|
include("util.lua")
|
||||||
|
|
||||||
|
local function match_platform_files(base_path, base_match)
|
||||||
|
files({
|
||||||
|
base_path.."/"..base_match..".h",
|
||||||
|
base_path.."/"..base_match..".c",
|
||||||
|
base_path.."/"..base_match..".cc",
|
||||||
|
})
|
||||||
|
removefiles({base_path.."/".."**_main.cc"})
|
||||||
|
removefiles({base_path.."/".."**_test.cc"})
|
||||||
|
removefiles({base_path.."/".."**_posix.h", base_path.."/".."**_posix.cc"})
|
||||||
|
removefiles({base_path.."/".."**_linux.h", base_path.."/".."**_linux.cc"})
|
||||||
|
removefiles({base_path.."/".."**_mac.h", base_path.."/".."**_mac.cc"})
|
||||||
|
removefiles({base_path.."/".."**_win.h", base_path.."/".."**_win.cc"})
|
||||||
|
filter("platforms:Windows")
|
||||||
|
files({
|
||||||
|
base_path.."/"..base_match.."_win.h",
|
||||||
|
base_path.."/"..base_match.."_win.cc",
|
||||||
|
})
|
||||||
|
filter("platforms:Linux")
|
||||||
|
files({
|
||||||
|
base_path.."/"..base_match.."_posix.h",
|
||||||
|
base_path.."/"..base_match.."_posix.cc",
|
||||||
|
base_path.."/"..base_match.."_linux.h",
|
||||||
|
base_path.."/"..base_match.."_linux.cc",
|
||||||
|
})
|
||||||
|
filter({})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Adds all .h and .cc files in the current path that match the current platform
|
||||||
|
-- suffix (_win, etc).
|
||||||
|
function local_platform_files(base_path)
|
||||||
|
match_platform_files(base_path or ".", "*")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Adds all .h and .cc files in the current path and all subpaths that match
|
||||||
|
-- the current platform suffix (_win, etc).
|
||||||
|
function recursive_platform_files(base_path)
|
||||||
|
match_platform_files(base_path or ".", "**")
|
||||||
|
end
|
|
@ -0,0 +1,75 @@
|
||||||
|
include("build_paths.lua")
|
||||||
|
include("util.lua")
|
||||||
|
|
||||||
|
newoption({
|
||||||
|
trigger = "test-suite-mode",
|
||||||
|
description = "Whether to merge all tests in a test_suite into a single project",
|
||||||
|
value = "MODE",
|
||||||
|
allowed = {
|
||||||
|
{ "individual", "One binary per test." },
|
||||||
|
{ "combined", "One binary per test suite (default)." },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local function combined_test_suite(test_suite_name, project_root, base_path, config)
|
||||||
|
group("tests")
|
||||||
|
project(test_suite_name)
|
||||||
|
kind("ConsoleApp")
|
||||||
|
language("C++")
|
||||||
|
includedirs(merge_arrays(config["includedirs"], {
|
||||||
|
project_root.."/"..build_tools,
|
||||||
|
project_root.."/"..build_tools_src,
|
||||||
|
project_root.."/"..build_tools.."/third_party/catch/include",
|
||||||
|
}))
|
||||||
|
libdirs(merge_arrays(config["libdirs"], {
|
||||||
|
project_root.."/"..build_bin,
|
||||||
|
}))
|
||||||
|
links(merge_arrays(config["links"], {
|
||||||
|
"gflags",
|
||||||
|
}))
|
||||||
|
files({
|
||||||
|
project_root.."/"..build_tools_src.."/test_suite_main.cc",
|
||||||
|
base_path.."/**_test.cc",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function split_test_suite(test_suite_name, project_root, base_path, config)
|
||||||
|
local test_paths = os.matchfiles(base_path.."/**_test.cc")
|
||||||
|
for _, file_path in pairs(test_paths) do
|
||||||
|
local test_name = file_path:match("(.*).cc")
|
||||||
|
group("tests/"..test_suite_name)
|
||||||
|
project(test_suite_name.."-"..test_name)
|
||||||
|
kind("ConsoleApp")
|
||||||
|
language("C++")
|
||||||
|
includedirs(merge_arrays(config["includedirs"], {
|
||||||
|
project_root.."/"..build_tools,
|
||||||
|
project_root.."/"..build_tools_src,
|
||||||
|
project_root.."/"..build_tools.."/third_party/catch/include",
|
||||||
|
}))
|
||||||
|
libdirs(merge_arrays(config["libdirs"], {
|
||||||
|
project_root.."/"..build_bin,
|
||||||
|
}))
|
||||||
|
links(merge_arrays(config["links"], {
|
||||||
|
"gflags",
|
||||||
|
}))
|
||||||
|
files({
|
||||||
|
project_root.."/"..build_tools_src.."/test_suite_main.cc",
|
||||||
|
file_path,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Defines a test suite binary.
|
||||||
|
-- Can either be a single binary with all tests or one binary per test based on
|
||||||
|
-- the --test-suite-mode= option.
|
||||||
|
function test_suite(
|
||||||
|
test_suite_name, -- Project or group name for the entire suite.
|
||||||
|
project_root, -- Project root path (with build_tools/ under it).
|
||||||
|
base_path, -- Base source path to search for _test.cc files.
|
||||||
|
config) -- Include/lib directories and links for binaries.
|
||||||
|
if _OPTIONS["test-suite-mode"] == "individual" then
|
||||||
|
split_test_suite(test_suite_name, project_root, base_path, config)
|
||||||
|
else
|
||||||
|
combined_test_suite(test_suite_name, project_root, base_path, config)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,50 @@
|
||||||
|
-- Prints a table and all of its contents.
|
||||||
|
function print_r(t)
|
||||||
|
local print_r_cache={}
|
||||||
|
local function sub_print_r(t, indent)
|
||||||
|
if (print_r_cache[tostring(t)]) then
|
||||||
|
print(indent.."*"..tostring(t))
|
||||||
|
else
|
||||||
|
print_r_cache[tostring(t)]=true
|
||||||
|
if (type(t)=="table") then
|
||||||
|
for pos,val in pairs(t) do
|
||||||
|
if (type(val)=="table") then
|
||||||
|
print(indent.."["..pos.."] => "..tostring(t).." {")
|
||||||
|
sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
|
||||||
|
print(indent..string.rep(" ",string.len(pos)+6).."}")
|
||||||
|
elseif (type(val)=="string") then
|
||||||
|
print(indent.."["..pos..'] => "'..val..'"')
|
||||||
|
else
|
||||||
|
print(indent.."["..pos.."] => "..tostring(val))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print(indent..tostring(t))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (type(t)=="table") then
|
||||||
|
print(tostring(t).." {")
|
||||||
|
sub_print_r(t," ")
|
||||||
|
print("}")
|
||||||
|
else
|
||||||
|
sub_print_r(t," ")
|
||||||
|
end
|
||||||
|
print()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Merges two tables and returns the resulting table.
|
||||||
|
function merge_tables(t1, t2)
|
||||||
|
local result = {}
|
||||||
|
for k,v in pairs(t1 or {}) do result[k] = v end
|
||||||
|
for k,v in pairs(t2 or {}) do result[k] = v end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Merges to arrays and returns the resulting array.
|
||||||
|
function merge_arrays(t1, t2)
|
||||||
|
local result = {}
|
||||||
|
for k,v in pairs(t1 or {}) do result[#result + 1] = v end
|
||||||
|
for k,v in pairs(t2 or {}) do result[#result + 1] = v end
|
||||||
|
return result
|
||||||
|
end
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2015 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
|
#include <codecvt>
|
||||||
|
#include <cstring>
|
||||||
|
#include <locale>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#define CATCH_CONFIG_RUNNER
|
||||||
|
#include "third_party/catch/include/catch.hpp"
|
||||||
|
|
||||||
|
namespace xe {
|
||||||
|
bool has_console_attached() { return true; }
|
||||||
|
} // namespace xe
|
||||||
|
|
||||||
|
// Used in console mode apps; automatically picked based on subsystem.
|
||||||
|
int main(int argc, wchar_t* argv[]) {
|
||||||
|
google::SetUsageMessage(std::string("usage: ..."));
|
||||||
|
google::SetVersionString("1.0");
|
||||||
|
|
||||||
|
// Convert all args to narrow, as gflags doesn't support wchar.
|
||||||
|
int argca = argc;
|
||||||
|
char** argva = (char**)alloca(sizeof(char*) * argca);
|
||||||
|
for (int n = 0; n < argca; n++) {
|
||||||
|
size_t len = wcslen(argv[n]);
|
||||||
|
argva[n] = (char*)alloca(len + 1);
|
||||||
|
wcstombs_s(nullptr, argva[n], len + 1, argv[n], _TRUNCATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse flags; this may delete some of them.
|
||||||
|
google::ParseCommandLineFlags(&argc, &argva, true);
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
// Setup COM on the main thread.
|
||||||
|
// NOTE: this may fail if COM has already been initialized - that's OK.
|
||||||
|
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
|
// Run Catch.
|
||||||
|
int result = Catch::Session().run(argc, argva);
|
||||||
|
|
||||||
|
google::ShutDownCommandLineFlags();
|
||||||
|
return result;
|
||||||
|
}
|
13
xenia-build
13
xenia-build
|
@ -29,7 +29,7 @@ def main():
|
||||||
# Augment path to include our fancy things.
|
# Augment path to include our fancy things.
|
||||||
os.environ['PATH'] += os.pathsep + os.pathsep.join([
|
os.environ['PATH'] += os.pathsep + os.pathsep.join([
|
||||||
self_path,
|
self_path,
|
||||||
os.path.abspath('build_tools/'),
|
os.path.abspath(os.path.join('tools', 'build')),
|
||||||
])
|
])
|
||||||
|
|
||||||
# Check git exists.
|
# Check git exists.
|
||||||
|
@ -90,7 +90,6 @@ def main():
|
||||||
sys.exit(return_code)
|
sys.exit(return_code)
|
||||||
|
|
||||||
|
|
||||||
# TODO(benvanik): move to build_tools utils module.
|
|
||||||
def import_vs_environment():
|
def import_vs_environment():
|
||||||
"""Finds the installed Visual Studio version and imports
|
"""Finds the installed Visual Studio version and imports
|
||||||
interesting environment variables into os.environ.
|
interesting environment variables into os.environ.
|
||||||
|
@ -296,7 +295,7 @@ def run_premake(target_os, action):
|
||||||
"""
|
"""
|
||||||
shell_call([
|
shell_call([
|
||||||
'python',
|
'python',
|
||||||
os.path.join('build_tools', 'premake'),
|
os.path.join('tools', 'build', 'premake'),
|
||||||
'--file=premake5.lua',
|
'--file=premake5.lua',
|
||||||
'--os=%s' % (target_os),
|
'--os=%s' % (target_os),
|
||||||
'--cc=clang',
|
'--cc=clang',
|
||||||
|
@ -906,7 +905,7 @@ class LintCommand(Command):
|
||||||
if os.path.exists(difftemp): os.remove(difftemp)
|
if os.path.exists(difftemp): os.remove(difftemp)
|
||||||
ret = shell_call([
|
ret = shell_call([
|
||||||
'python',
|
'python',
|
||||||
'build_tools/third_party/clang-format/git-clang-format',
|
'third_party/clang-format/git-clang-format',
|
||||||
'--binary=%s' % (clang_format_binary),
|
'--binary=%s' % (clang_format_binary),
|
||||||
'--commit=%s' % ('origin/master' if args['origin'] else 'HEAD'),
|
'--commit=%s' % ('origin/master' if args['origin'] else 'HEAD'),
|
||||||
'--diff',
|
'--diff',
|
||||||
|
@ -922,7 +921,7 @@ class LintCommand(Command):
|
||||||
print('')
|
print('')
|
||||||
shell_call([
|
shell_call([
|
||||||
'python',
|
'python',
|
||||||
'build_tools/third_party/clang-format/git-clang-format',
|
'third_party/clang-format/git-clang-format',
|
||||||
'--binary=%s' % (clang_format_binary),
|
'--binary=%s' % (clang_format_binary),
|
||||||
'--commit=%s' % ('origin/master' if args['origin'] else 'HEAD'),
|
'--commit=%s' % ('origin/master' if args['origin'] else 'HEAD'),
|
||||||
'--diff',
|
'--diff',
|
||||||
|
@ -978,7 +977,7 @@ class FormatCommand(Command):
|
||||||
print('- git-clang-format')
|
print('- git-clang-format')
|
||||||
shell_call([
|
shell_call([
|
||||||
'python',
|
'python',
|
||||||
'build_tools/third_party/clang-format/git-clang-format',
|
'third_party/clang-format/git-clang-format',
|
||||||
'--binary=%s' % (clang_format_binary),
|
'--binary=%s' % (clang_format_binary),
|
||||||
'--commit=%s' % ('origin/master' if args['origin'] else 'HEAD'),
|
'--commit=%s' % ('origin/master' if args['origin'] else 'HEAD'),
|
||||||
])
|
])
|
||||||
|
@ -1004,7 +1003,7 @@ class StyleCommand(Command):
|
||||||
print('- cpplint [%d files]' % (len(all_files)))
|
print('- cpplint [%d files]' % (len(all_files)))
|
||||||
ret = shell_call([
|
ret = shell_call([
|
||||||
'python',
|
'python',
|
||||||
'build_tools/third_party/google-styleguide/cpplint/cpplint.py',
|
'third_party/google-styleguide/cpplint/cpplint.py',
|
||||||
'--output=vs7',
|
'--output=vs7',
|
||||||
'--linelength=80',
|
'--linelength=80',
|
||||||
'--filter=-build/c++11,+build/include_alpha',
|
'--filter=-build/c++11,+build/include_alpha',
|
||||||
|
|
Loading…
Reference in New Issue