Fixes for issue #19 (msys2 build fixes)

This commit is contained in:
Martín Lucas Golini
2023-04-15 20:24:10 -03:00
parent 3a8bd77c95
commit 3477d5bc69
2 changed files with 42 additions and 6 deletions

View File

@@ -227,18 +227,29 @@ function get_dll_extension()
end
end
function get_host()
if os.getenv("MSYSTEM") ~= "" then
return "msys"
end
return os.get()
end
function os_ishost(host)
return get_host() == host
end
function postsymlinklib(src_path, dst_path, lib)
if os.is_real("emscripten") then
return
end
configuration { "release", "windows" }
if os.is("windows") then
if os_ishost("windows") then
postbuildcommands { "mklink \"" .. dst_path .. lib .. ".dll\"" .. " \"" .. src_path .. lib .. ".dll\" || ver>nul" }
else
postbuildcommands { "ln -sf \"" .. src_path .. lib .. "." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
end
configuration { "debug", "windows" }
if os.is("windows") then
if os_ishost("windows") then
postbuildcommands { "mklink \"" .. dst_path .. lib .. "-debug.dll\"" .. " \"" .. src_path .. lib .. "-debug.dll\" || ver>nul" }
else
postbuildcommands { "ln -sf \"" .. src_path .. lib .. "-debug." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
@@ -662,7 +673,11 @@ function generate_os_links()
if os.is_real("linux") or os.is_real("freebsd") or os.is_real("haiku") or os.is_real("emscripten") then
multiple_insert( os_links, { "openal" } )
elseif os.is_real("windows") or os.is_real("mingw32") or os.is_real("mingw64") then
multiple_insert( os_links, { "OpenAL32" } )
if os_ishost("msys") then
multiple_insert( os_links, { "openal" } )
else
multiple_insert( os_links, { "OpenAL32" } )
end
elseif os.is_real("macosx") or os.is_real("ios") then
multiple_insert( os_links, { "OpenAL.framework" } )
end
@@ -1235,6 +1250,9 @@ solution "eepp"
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
if os_ishost("msys") then
defines { "WINVER=0x0602" }
end
if not is_vs() then
buildoptions{ "-std=c++17" }
else

View File

@@ -30,15 +30,26 @@ function get_dll_extension()
end
end
function get_host()
if os.getenv("MSYSTEM") ~= "" then
return "msys"
end
return os.host()
end
function os_ishost(host)
return get_host() == host
end
function postsymlinklib(src_path, dst_path, lib, arch)
filter { "configurations:release*", "system:windows", arch }
if os.ishost("windows") then
if os_ishost("windows") then
postbuildcommands { "mklink \"" .. dst_path .. lib .. ".dll\"" .. " \"" .. src_path .. lib .. ".dll\" || ver>nul" }
else
postbuildcommands { "ln -sf \"" .. src_path .. lib .. "." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
end
filter { "configurations:debug*", "system:windows", arch }
if os.ishost("windows") then
if os_ishost("windows") then
postbuildcommands { "mklink \"" .. dst_path .. lib .. "-debug.dll\"" .. " \"" .. src_path .. lib .. "-debug.dll\" || ver>nul" }
else
postbuildcommands { "ln -sf \"" .. src_path .. lib .. "-debug." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
@@ -404,7 +415,11 @@ function generate_os_links()
if os.istarget("linux") or os.istarget("bsd") or os.istarget("haiku") or os.istarget("emscripten") then
multiple_insert( os_links, { "openal" } )
elseif os.istarget("windows") or os.istarget("mingw32") then
multiple_insert( os_links, { "OpenAL32" } )
if os_ishost("msys") then
multiple_insert( os_links, { "openal" } )
else
multiple_insert( os_links, { "OpenAL32" } )
end
elseif os.istarget("macosx") or os.istarget("ios") then
multiple_insert( os_links, { "OpenAL.framework" } )
end
@@ -987,6 +1002,9 @@ workspace "eepp"
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
if os_ishost("msys") then
defines { "WINVER=0x0602" }
end
build_base_cpp_configuration( "eterm" )
target_dir_lib("")
filter "action:not vs*"