Browse Source

Fix Mono not being found on the PATH on recent macOS versions.

pull/1295/head
João Matos 6 years ago
parent
commit
d110a2f045
  1. 10
      build/Compile.sh
  2. 16
      build/Helpers.lua
  3. 4
      src/CppParser/Bindings/CSharp/premake5.lua
  4. 5
      src/CppParser/premake5.lua

10
build/Compile.sh

@ -9,13 +9,21 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then @@ -9,13 +9,21 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
PREMAKE=$CUR_DIR/premake5-linux-64;
fi
MONO_VERSION_OUTPUT="$(mono --version)"
MONO=mono
if [ "$(uname)" == "Darwin" ]; then
MONO_PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/
MONO="$MONO_PATH$MONO"
fi
MONO_VERSION_OUTPUT="$($MONO --version)"
if [[ $MONO_VERSION_OUTPUT == *"amd64"* ]]; then
BUILD_CONF=release_x64;
else
BUILD_CONF=release_x86;
fi
export PATH=$PATH:$MONO_PATH
$PREMAKE --file=$CUR_DIR/premake5.lua gmake "$@"
config=$BUILD_CONF make -C $CUR_DIR/gmake/

16
build/Helpers.lua

@ -27,8 +27,22 @@ newoption { @@ -27,8 +27,22 @@ newoption {
explicit_target_architecture = _OPTIONS["arch"]
function get_mono_path()
local mono = "mono"
local result, errorcode = os.outputof(mono .. " --version")
if result == nil and os.ishost("macosx") then
mono = "/Library/Frameworks/Mono.framework/Versions/Current/bin/" .. mono
result, errorcode = os.outputof(mono .. " --version")
end
if result == nil then
print("Could not find Mono executable, please make sure it is in PATH.")
os.exit(1)
end
return mono
end
function is_64_bits_mono_runtime()
result, errorcode = os.outputof("mono --version")
local result, errorcode = os.outputof(get_mono_path() .. " --version")
local arch = string.match(result, "Architecture:%s*([%w]+)")
return arch == "amd64"
end

4
src/CppParser/Bindings/CSharp/premake5.lua

@ -16,9 +16,7 @@ project "CppSharp.Parser.CSharp" @@ -16,9 +16,7 @@ project "CppSharp.Parser.CSharp"
if os.istarget("windows") then
files { "i686-pc-win32-msvc/**.cs" }
elseif os.istarget("macosx") then
local file = io.popen("lipo -info `which mono`")
local output = file:read('*all')
if string.find(output, "x86_64") or _OPTIONS["arch"] == "x64" then
if is_64_bits_mono_runtime() or _OPTIONS["arch"] == "x64" then
files { "x86_64-apple-darwin12.4.0/**.cs" }
else
files { "i686-apple-darwin12.4.0/**.cs" }

5
src/CppParser/premake5.lua

@ -53,14 +53,11 @@ project "Std-symbols" @@ -53,14 +53,11 @@ project "Std-symbols"
if os.istarget("windows") then
files { "Bindings/CSharp/i686-pc-win32-msvc/Std-symbols.cpp" }
elseif os.istarget("macosx") then
local file = io.popen("lipo -info `which mono`")
local output = file:read('*all')
if string.find(output, "x86_64") then
if is_64_bits_mono_runtime() or _OPTIONS["arch"] == "x64" then
files { "Bindings/CSharp/x86_64-apple-darwin12.4.0/Std-symbols.cpp" }
else
files { "Bindings/CSharp/i686-apple-darwin12.4.0/Std-symbols.cpp" }
end
elseif os.istarget("linux") then
local abi = ""
if UseCxx11ABI() then

Loading…
Cancel
Save