diff --git a/premake4.lua b/premake4.lua index 005d3c0a5..55e01f4c4 100644 --- a/premake4.lua +++ b/premake4.lua @@ -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 diff --git a/premake5.lua b/premake5.lua index 1adcc90e1..76a679e8d 100644 --- a/premake5.lua +++ b/premake5.lua @@ -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*"