mirror of
https://github.com/izzy2lost/xenia-edge.git
synced 2026-07-06 00:20:26 -07:00
Third-party: build/premake fixes
This commit is contained in:
Vendored
+60
-2
@@ -4,23 +4,66 @@
|
||||
--
|
||||
|
||||
local sdl2_sys_includedirs = {}
|
||||
local sdl2_sys_libdirs = {}
|
||||
local third_party_path = os.getcwd()
|
||||
local sdl2_config = os.getenv("SDL2_CONFIG") or "sdl2-config"
|
||||
|
||||
if os.istarget("windows") then
|
||||
-- build ourselves
|
||||
include("SDL2-static.lua")
|
||||
else
|
||||
-- use system libraries
|
||||
local result, code, what = os.outputof("sdl2-config --cflags")
|
||||
if os.istarget("macosx") then
|
||||
local target_arch = os.targetarch() or ""
|
||||
local option_arch = _OPTIONS and _OPTIONS["arch"] or ""
|
||||
local want_x86 =
|
||||
_OPTIONS and _OPTIONS["mac-x86_64"] or
|
||||
target_arch == "x86_64" or target_arch == "x64" or
|
||||
option_arch == "x86_64" or option_arch == "x64"
|
||||
local want_arm = target_arch == "arm64" or option_arch == "arm64"
|
||||
if want_x86 and os.isfile("/usr/local/bin/sdl2-config") then
|
||||
sdl2_config = "/usr/local/bin/sdl2-config"
|
||||
elseif want_arm and os.isfile("/opt/homebrew/bin/sdl2-config") then
|
||||
sdl2_config = "/opt/homebrew/bin/sdl2-config"
|
||||
end
|
||||
end
|
||||
local result, code, what = os.outputof(sdl2_config .. " --cflags")
|
||||
if result then
|
||||
print("SDL2: sdl2-config --cflags returned: " .. result)
|
||||
for inc in string.gmatch(result, "-I([%S]+)") do
|
||||
table.insert(sdl2_sys_includedirs, inc)
|
||||
print("SDL2: Added include dir: " .. inc)
|
||||
end
|
||||
if #sdl2_sys_includedirs == 0 then
|
||||
print("SDL2: Warning - no include directories found in sdl2-config output")
|
||||
end
|
||||
else
|
||||
error("Failed to run 'sdl2-config'. Are libsdl2 development files installed?")
|
||||
end
|
||||
local libs, libs_code, libs_what = os.outputof(sdl2_config .. " --libs")
|
||||
if libs then
|
||||
for libdir in string.gmatch(libs, "-L([%S]+)") do
|
||||
table.insert(sdl2_sys_libdirs, libdir)
|
||||
end
|
||||
else
|
||||
error("Failed to run 'sdl2-config --libs'. Are libsdl2 development files installed?")
|
||||
end
|
||||
end
|
||||
|
||||
if os.istarget("macosx") then
|
||||
local target_arch = os.targetarch() or ""
|
||||
local option_arch = _OPTIONS and _OPTIONS["arch"] or ""
|
||||
local want_x86 =
|
||||
_OPTIONS and _OPTIONS["mac-x86_64"] or
|
||||
target_arch == "x86_64" or target_arch == "x64" or
|
||||
option_arch == "x86_64" or option_arch == "x64"
|
||||
local want_arm = target_arch == "arm64" or option_arch == "arm64"
|
||||
if want_x86 and os.isdir("/usr/local/opt/sdl2/lib") then
|
||||
table.insert(sdl2_sys_libdirs, "/usr/local/opt/sdl2/lib")
|
||||
elseif want_arm and os.isdir("/opt/homebrew/opt/sdl2/lib") then
|
||||
table.insert(sdl2_sys_libdirs, "/opt/homebrew/opt/sdl2/lib")
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Call this function in project scope to include the SDL2 headers.
|
||||
@@ -30,7 +73,22 @@ function sdl2_include()
|
||||
includedirs({
|
||||
path.getrelative(".", third_party_path) .. "/SDL2/include",
|
||||
})
|
||||
filter("platforms:Linux or platforms:Mac")
|
||||
filter("platforms:Linux or Mac")
|
||||
includedirs(sdl2_sys_includedirs)
|
||||
libdirs(sdl2_sys_libdirs)
|
||||
filter({})
|
||||
|
||||
-- For Linux, also add SDL2 includes outside of filter for cmake compatibility
|
||||
-- The premake-cmake module doesn't properly handle filtered include directories
|
||||
if os.istarget("linux") then
|
||||
includedirs(sdl2_sys_includedirs)
|
||||
libdirs(sdl2_sys_libdirs)
|
||||
-- Also add common fallback path for cases where sdl2-config doesn't return -I flags
|
||||
if #sdl2_sys_includedirs == 0 then
|
||||
includedirs({"/usr/include/SDL2"})
|
||||
print("SDL2: Using fallback include path /usr/include/SDL2")
|
||||
else
|
||||
print("SDL2: Added includes for Linux cmake: " .. table.concat(sdl2_sys_includedirs, ", "))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Vendored
+45
-8
@@ -4,31 +4,68 @@ project("capstone")
|
||||
kind("StaticLib")
|
||||
language("C")
|
||||
defines({
|
||||
"CAPSTONE_X86_ATT_DISABLE",
|
||||
"CAPSTONE_HAS_X86",
|
||||
"CAPSTONE_DIET_NO",
|
||||
"CAPSTONE_USE_SYS_DYN_MEM",
|
||||
"_LIB",
|
||||
})
|
||||
|
||||
filter("architecture:x86_64")
|
||||
defines({
|
||||
"CAPSTONE_HAS_X86",
|
||||
"CAPSTONE_X86_ATT_DISABLE",
|
||||
"CAPSTONE_X86_REDUCE_NO",
|
||||
})
|
||||
files({
|
||||
"capstone/arch/X86/*.c",
|
||||
"capstone/arch/X86/*.h",
|
||||
"capstone/arch/X86/*.inc",
|
||||
})
|
||||
force_compile_as_c({
|
||||
"capstone/arch/X86/**.c",
|
||||
})
|
||||
filter("architecture:ARM64")
|
||||
defines({
|
||||
"CAPSTONE_HAS_AARCH64",
|
||||
"CAPSTONE_HAS_ARM64",
|
||||
})
|
||||
files({
|
||||
"capstone/arch/AArch64/*.c",
|
||||
"capstone/arch/AArch64/*.h",
|
||||
"capstone/arch/AArch64/*.inc",
|
||||
})
|
||||
force_compile_as_c({
|
||||
"capstone/arch/AArch64/**.c",
|
||||
})
|
||||
filter({})
|
||||
includedirs({
|
||||
"capstone",
|
||||
"capstone/include",
|
||||
})
|
||||
externalincludedirs({
|
||||
"capstone/include",
|
||||
})
|
||||
files({
|
||||
"capstone/cs.c",
|
||||
"capstone/cs_priv.h",
|
||||
"capstone/LEB128.h",
|
||||
"capstone/MathExtras.h",
|
||||
"capstone/MCDisassembler.h",
|
||||
"capstone/MCFixedLenDisassembler.h",
|
||||
"capstone/MCInst.c",
|
||||
"capstone/MCInst.h",
|
||||
"capstone/MCInstPrinter.c",
|
||||
"capstone/MCInstPrinter.h",
|
||||
"capstone/MCInstrDesc.c",
|
||||
"capstone/MCInstrDesc.h",
|
||||
"capstone/MCRegisterInfo.c",
|
||||
"capstone/MCRegisterInfo.h",
|
||||
"capstone/SStream.c",
|
||||
"capstone/SStream.h",
|
||||
"capstone/utils.c",
|
||||
"capstone/utils.h",
|
||||
"capstone/Mapping.c",
|
||||
|
||||
"capstone/arch/X86/*.c",
|
||||
"capstone/arch/X86/*.h",
|
||||
"capstone/arch/X86/*.inc",
|
||||
})
|
||||
force_compile_as_c({
|
||||
"capstone/**.c",
|
||||
"capstone/arch/X86/**.c",
|
||||
})
|
||||
removefiles({
|
||||
"capstone/arch/X86/X86ATTInstPrinter.c",
|
||||
|
||||
Vendored
+36
-7
@@ -3,14 +3,12 @@ project("discord-rpc")
|
||||
uuid("012f6131-efc0-4abd-852d-a33640732d4c")
|
||||
kind("StaticLib")
|
||||
language("C++")
|
||||
defines({
|
||||
"RAPIDJSON_SSE42",
|
||||
-- "RAPIDJSON_NEON",
|
||||
})
|
||||
includedirs({
|
||||
"discord-rpc/include",
|
||||
"rapidjson/include"
|
||||
})
|
||||
|
||||
-- Common files for all platforms
|
||||
files({
|
||||
"discord-rpc/src/connection.h",
|
||||
"discord-rpc/src/discord_rpc.cpp",
|
||||
@@ -20,17 +18,48 @@ project("discord-rpc")
|
||||
"discord-rpc/src/serialization.cpp",
|
||||
"discord-rpc/src/serialization.h"
|
||||
})
|
||||
filter("platforms:Linux")
|
||||
|
||||
-- x86_64 uses SSE4.2, ARM64 uses NEON for rapidjson SIMD
|
||||
filter("architecture:x86_64")
|
||||
defines({ "RAPIDJSON_SSE42" })
|
||||
filter("architecture:ARM64")
|
||||
defines({ "RAPIDJSON_NEON" })
|
||||
filter({})
|
||||
|
||||
-- Platform-specific connection implementations
|
||||
-- For premake-cmake compatibility, we use os.istarget() which is evaluated at
|
||||
-- premake generation time. This ensures the correct files are included in cmake.
|
||||
if os.istarget("linux") then
|
||||
files({
|
||||
"discord-rpc/src/connection_unix.cpp",
|
||||
"discord-rpc/src/discord_register_linux.cpp"
|
||||
})
|
||||
filter("platforms:Mac")
|
||||
elseif os.istarget("macosx") then
|
||||
files({
|
||||
"discord-rpc/src/connection_unix.cpp",
|
||||
"discord-rpc/src/discord_register_osx.m"
|
||||
})
|
||||
filter("platforms:Windows")
|
||||
elseif os.istarget("windows") then
|
||||
files({
|
||||
"discord-rpc/src/connection_win.cpp",
|
||||
"discord-rpc/src/discord_register_win.cpp"
|
||||
})
|
||||
end
|
||||
|
||||
-- Also add system filter for generators that handle platforms differently
|
||||
filter("system:linux")
|
||||
files({
|
||||
"discord-rpc/src/connection_unix.cpp",
|
||||
"discord-rpc/src/discord_register_linux.cpp"
|
||||
})
|
||||
filter("system:macosx")
|
||||
files({
|
||||
"discord-rpc/src/connection_unix.cpp",
|
||||
"discord-rpc/src/discord_register_osx.m"
|
||||
})
|
||||
filter("system:windows")
|
||||
files({
|
||||
"discord-rpc/src/connection_win.cpp",
|
||||
"discord-rpc/src/discord_register_win.cpp"
|
||||
})
|
||||
filter({})
|
||||
|
||||
Vendored
+3
@@ -12,6 +12,9 @@ project("mspack")
|
||||
includedirs({
|
||||
"mspack",
|
||||
})
|
||||
sysincludedirs({
|
||||
"mspack",
|
||||
})
|
||||
files({
|
||||
"mspack/logging.cc",
|
||||
"mspack/lzxd.c",
|
||||
|
||||
Vendored
+2
@@ -8,6 +8,8 @@ project("zarchive")
|
||||
})
|
||||
includedirs({
|
||||
"zarchive/include",
|
||||
})
|
||||
sysincludedirs({
|
||||
"zstd/lib",
|
||||
})
|
||||
files({
|
||||
|
||||
Vendored
+31
-26
@@ -5,40 +5,45 @@ project("zlib-ng")
|
||||
language("C")
|
||||
|
||||
defines({
|
||||
"X86_FEATURES",
|
||||
"X86_HAVE_XSAVE_INTRIN",
|
||||
"X86_SSSE3",
|
||||
"X86_SSE42",
|
||||
"WITH_GZFILEOP",
|
||||
})
|
||||
if os.istarget("windows") then
|
||||
defines({
|
||||
"X86_SSE2",
|
||||
"X86_AVX2",
|
||||
"X86_AVX512",
|
||||
"X86_AVX512VNNI",
|
||||
"X86_PCLMULQDQ_CRC",
|
||||
"X86_VPCLMULQDQ_CRC",
|
||||
})
|
||||
end
|
||||
|
||||
files({
|
||||
"zlib-ng/*.c",
|
||||
"zlib-ng/arch/x86/*.c",
|
||||
"zlib-ng/arch/generic/*.c",
|
||||
})
|
||||
if not os.istarget("windows") then
|
||||
removefiles({
|
||||
"zlib-ng/arch/x86/adler32_avx2.c",
|
||||
"zlib-ng/arch/x86/adler32_avx512.c",
|
||||
"zlib-ng/arch/x86/adler32_avx512_vnni.c",
|
||||
"zlib-ng/arch/x86/chunkset_avx2.c",
|
||||
"zlib-ng/arch/x86/compare256_avx2.c",
|
||||
"zlib-ng/arch/x86/crc32_pclmulqdq.c",
|
||||
"zlib-ng/arch/x86/crc32_vpclmulqdq.c",
|
||||
"zlib-ng/arch/x86/slide_hash_avx2.c",
|
||||
filter("architecture:x86_64")
|
||||
defines({
|
||||
"X86_FEATURES",
|
||||
"X86_HAVE_XSAVE_INTRIN",
|
||||
"X86_SSSE3",
|
||||
"X86_SSE42",
|
||||
})
|
||||
end
|
||||
files({
|
||||
"zlib-ng/arch/x86/*.c",
|
||||
})
|
||||
if os.istarget("windows") then
|
||||
defines({
|
||||
"X86_SSE2",
|
||||
"X86_AVX2",
|
||||
"X86_AVX512",
|
||||
"X86_AVX512VNNI",
|
||||
"X86_PCLMULQDQ_CRC",
|
||||
"X86_VPCLMULQDQ_CRC",
|
||||
})
|
||||
else
|
||||
removefiles({
|
||||
"zlib-ng/arch/x86/adler32_avx2.c",
|
||||
"zlib-ng/arch/x86/adler32_avx512.c",
|
||||
"zlib-ng/arch/x86/adler32_avx512_vnni.c",
|
||||
"zlib-ng/arch/x86/chunkset_avx2.c",
|
||||
"zlib-ng/arch/x86/compare256_avx2.c",
|
||||
"zlib-ng/arch/x86/crc32_pclmulqdq.c",
|
||||
"zlib-ng/arch/x86/crc32_vpclmulqdq.c",
|
||||
"zlib-ng/arch/x86/slide_hash_avx2.c",
|
||||
})
|
||||
end
|
||||
filter({})
|
||||
|
||||
includedirs({
|
||||
"zlib-ng",
|
||||
|
||||
Reference in New Issue
Block a user