mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 11:15:34 +08:00
fix building with wine wrapped MSVC
This commit is contained in:
parent
d440a0ad73
commit
3bc03070aa
@ -40,6 +40,22 @@ newoption {
|
|||||||
default = nil
|
default = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
category = "tools",
|
||||||
|
trigger = "cmake-toolchain",
|
||||||
|
description = "Use cmake toolchain",
|
||||||
|
value = 'path/to/toolchain.cmake',
|
||||||
|
default = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
category = "tools",
|
||||||
|
trigger = "custom-extractor",
|
||||||
|
description = "Use custom extractor",
|
||||||
|
value = 'path/to/7z.exe',
|
||||||
|
default = nil
|
||||||
|
}
|
||||||
|
|
||||||
-- deps extraction
|
-- deps extraction
|
||||||
newoption {
|
newoption {
|
||||||
category = "extract",
|
category = "extract",
|
||||||
@ -177,12 +193,17 @@ if not third_party_dir or not os.isdir(third_party_dir) then
|
|||||||
error('third-party dir is missing')
|
error('third-party dir is missing')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if _OPTIONS["custom-extractor"] then
|
||||||
|
extractor = _OPTIONS["custom-extractor"]
|
||||||
|
print('using custom extractor: ' .. _OPTIONS["custom-extractor"])
|
||||||
|
else
|
||||||
if os.host() == 'windows' then
|
if os.host() == 'windows' then
|
||||||
extractor = extractor .. '.exe'
|
extractor = extractor .. '.exe'
|
||||||
end
|
end
|
||||||
if not extractor or not os.isfile(extractor) then
|
if not extractor or not os.isfile(extractor) then
|
||||||
error('extractor is missing from third-party dir. extractor: ' .. extractor)
|
error('extractor is missing from third-party dir. extractor: ' .. extractor)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- ############## common CMAKE args ##############
|
-- ############## common CMAKE args ##############
|
||||||
@ -242,11 +263,14 @@ local function cmake_build(dep_folder, is_32, extra_cmd_defs, c_flags_init, cxx_
|
|||||||
table.insert(all_cxxflags_init, '/MT')
|
table.insert(all_cxxflags_init, '/MT')
|
||||||
table.insert(all_cxxflags_init, '/D_MT')
|
table.insert(all_cxxflags_init, '/D_MT')
|
||||||
|
|
||||||
|
local cmake_generator = os.getenv("CMAKE_GENERATOR") or ""
|
||||||
|
if cmake_generator == "" and os.host() == 'windows' or cmake_generator:find("Visual Studio") then
|
||||||
if is_32 then
|
if is_32 then
|
||||||
cmd_gen = cmd_gen .. ' -A Win32'
|
cmd_gen = cmd_gen .. ' -A Win32'
|
||||||
else
|
else
|
||||||
cmd_gen = cmd_gen .. ' -A x64'
|
cmd_gen = cmd_gen .. ' -A x64'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error("unsupported action for cmake build: " .. _ACTION)
|
error("unsupported action for cmake build: " .. _ACTION)
|
||||||
return
|
return
|
||||||
@ -283,6 +307,9 @@ local function cmake_build(dep_folder, is_32, extra_cmd_defs, c_flags_init, cxx_
|
|||||||
|
|
||||||
-- write toolchain file
|
-- write toolchain file
|
||||||
local toolchain_file_content = ''
|
local toolchain_file_content = ''
|
||||||
|
if _OPTIONS["cmake-toolchain"] then
|
||||||
|
toolchain_file_content='include(' .. _OPTIONS["cmake-toolchain"] .. ')\n\n'
|
||||||
|
end
|
||||||
if #cflags_init_str > 0 then
|
if #cflags_init_str > 0 then
|
||||||
toolchain_file_content = toolchain_file_content .. 'set(CMAKE_C_FLAGS_INIT "' .. cflags_init_str .. '" )\n'
|
toolchain_file_content = toolchain_file_content .. 'set(CMAKE_C_FLAGS_INIT "' .. cflags_init_str .. '" )\n'
|
||||||
end
|
end
|
||||||
@ -361,11 +388,13 @@ end
|
|||||||
|
|
||||||
-- chmod tools
|
-- chmod tools
|
||||||
if os.host() == "linux" then
|
if os.host() == "linux" then
|
||||||
|
if not _OPTIONS["custom-extractor"] then
|
||||||
local ok_chmod, err_chmod = os.chmod(extractor, "777")
|
local ok_chmod, err_chmod = os.chmod(extractor, "777")
|
||||||
if not ok_chmod then
|
if not ok_chmod then
|
||||||
error("cannot chmod: " .. err_chmod)
|
error("cannot chmod: " .. err_chmod)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if not _OPTIONS["custom-cmake"] then
|
if not _OPTIONS["custom-cmake"] then
|
||||||
local ok_chmod, err_chmod = os.chmod(mycmake, "777")
|
local ok_chmod, err_chmod = os.chmod(mycmake, "777")
|
||||||
|
12
premake5.lua
12
premake5.lua
@ -99,7 +99,7 @@ local function genproto()
|
|||||||
|
|
||||||
local out_dir = 'proto_gen/' .. os_iden
|
local out_dir = 'proto_gen/' .. os_iden
|
||||||
|
|
||||||
if os.host() == "windows" then
|
if os.target() == "windows" then
|
||||||
protoc_exe = protoc_exe .. '.exe'
|
protoc_exe = protoc_exe .. '.exe'
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ local function genproto()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if os.host() == "linux" then
|
if os.target() == "linux" then
|
||||||
local ok_chmod, err_chmod = os.chmod(protoc_exe, "777")
|
local ok_chmod, err_chmod = os.chmod(protoc_exe, "777")
|
||||||
if not ok_chmod then
|
if not ok_chmod then
|
||||||
error("Error: " .. err_chmod)
|
error("Error: " .. err_chmod)
|
||||||
@ -123,6 +123,10 @@ local function genproto()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (os.host() == "linux" and os.target() == "windows") then
|
||||||
|
protoc_exe = 'wine ' .. protoc_exe
|
||||||
|
end
|
||||||
|
|
||||||
return os.execute(protoc_exe .. ' dll/net.proto -I./dll/ --cpp_out=' .. out_dir)
|
return os.execute(protoc_exe .. ' dll/net.proto -I./dll/ --cpp_out=' .. out_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -406,7 +410,9 @@ local overlay_link = {
|
|||||||
---------
|
---------
|
||||||
local x32_ssq_libdir = path.join(deps_dir, "libssq/build32")
|
local x32_ssq_libdir = path.join(deps_dir, "libssq/build32")
|
||||||
local x64_ssq_libdir = path.join(deps_dir, "libssq/build64")
|
local x64_ssq_libdir = path.join(deps_dir, "libssq/build64")
|
||||||
if _ACTION and string.match(_ACTION, 'vs.+') then
|
|
||||||
|
local cmake_generator = os.getenv("CMAKE_GENERATOR") or ""
|
||||||
|
if cmake_generator == "" and os.host() == 'windows' or cmake_generator:find("Visual Studio") then
|
||||||
x32_ssq_libdir = x32_ssq_libdir .. "/Release"
|
x32_ssq_libdir = x32_ssq_libdir .. "/Release"
|
||||||
x64_ssq_libdir = x64_ssq_libdir .. "/Release"
|
x64_ssq_libdir = x64_ssq_libdir .. "/Release"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user