mirror of
https://github.com/Relintai/godot-mono-builds.git
synced 2024-11-12 10:25:10 +01:00
WASM/BCL: Build WebAssembly.Framework.sln and include in BCL
This commit is contained in:
parent
61e36a93b6
commit
9d75cff174
21
bcl.py
21
bcl.py
@ -139,6 +139,27 @@ def make_product(opts: BclOpts, product: str):
|
|||||||
file_pattern_recursive = '%s/**/%s' % (install_dir, file_pattern)
|
file_pattern_recursive = '%s/**/%s' % (install_dir, file_pattern)
|
||||||
[rm_rf(x) for x in glob.iglob(file_pattern_recursive, recursive=True)]
|
[rm_rf(x) for x in glob.iglob(file_pattern_recursive, recursive=True)]
|
||||||
|
|
||||||
|
# WebAssembly.Framework.sln
|
||||||
|
if product == 'wasm':
|
||||||
|
wasm_fx_output_dir = '%s/sdks/wasm/framework/netstandard2.0' % opts.mono_source_root
|
||||||
|
wasm_fx_sln_file = '%s/sdks/wasm/framework/src/WebAssembly.Framework.sln' % opts.mono_source_root
|
||||||
|
output_dir = path_join(install_dir, 'wasm')
|
||||||
|
|
||||||
|
from msbuild_helper import build_solution
|
||||||
|
build_solution(wasm_fx_sln_file, 'Release')
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
|
fglob = glob(path_join(wasm_fx_output_dir, '*.dll'))
|
||||||
|
|
||||||
|
if not opts.remove_pdb:
|
||||||
|
fglob.extend(glob(path_join(wasm_fx_output_dir, '*.pdb')))
|
||||||
|
|
||||||
|
for file in fglob:
|
||||||
|
if os.path.isfile(file):
|
||||||
|
shutil.copy(file, output_dir)
|
||||||
|
|
||||||
# godot_android_ext profile (custom 'Mono.Android.dll')
|
# godot_android_ext profile (custom 'Mono.Android.dll')
|
||||||
if product == 'android':
|
if product == 'android':
|
||||||
this_script_dir = os.path.dirname(os.path.realpath(__file__))
|
this_script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
61
msbuild_helper.py
Normal file
61
msbuild_helper.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from os_utils import *
|
||||||
|
|
||||||
|
|
||||||
|
def find_dotnet_cli():
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
for hint_dir in os.environ["PATH"].split(os.pathsep):
|
||||||
|
hint_dir = hint_dir.strip('"')
|
||||||
|
hint_path = os.path.join(hint_dir, "dotnet")
|
||||||
|
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
|
||||||
|
return hint_path
|
||||||
|
|
||||||
|
|
||||||
|
def find_msbuild():
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
hint_dirs = []
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
hint_dirs[:0] = [
|
||||||
|
"/Library/Frameworks/Mono.framework/Versions/Current/bin",
|
||||||
|
"/usr/local/var/homebrew/linked/mono/bin",
|
||||||
|
]
|
||||||
|
|
||||||
|
for hint_dir in hint_dirs:
|
||||||
|
hint_path = os.path.join(hint_dir, "msbuild")
|
||||||
|
if os.path.isfile(hint_path):
|
||||||
|
return hint_path
|
||||||
|
|
||||||
|
for hint_dir in os.environ["PATH"].split(os.pathsep):
|
||||||
|
hint_dir = hint_dir.strip('"')
|
||||||
|
hint_path = os.path.join(hint_dir, "msbuild")
|
||||||
|
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
|
||||||
|
return hint_path
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def build_solution(solution_path, build_config, extra_msbuild_args=[]):
|
||||||
|
msbuild_args = []
|
||||||
|
|
||||||
|
dotnet_cli = find_dotnet_cli()
|
||||||
|
|
||||||
|
if dotnet_cli:
|
||||||
|
msbuild_path = dotnet_cli
|
||||||
|
msbuild_args += ["msbuild"] # `dotnet msbuild` command
|
||||||
|
else:
|
||||||
|
msbuild_path = find_msbuild()
|
||||||
|
if msbuild_path is None:
|
||||||
|
raise BuildError("Cannot find MSBuild executable")
|
||||||
|
|
||||||
|
print("MSBuild path: " + msbuild_path)
|
||||||
|
|
||||||
|
# Build solution
|
||||||
|
|
||||||
|
msbuild_args += [solution_path, "/restore", "/t:Build", "/p:Configuration=" + build_config]
|
||||||
|
msbuild_args += extra_msbuild_args
|
||||||
|
|
||||||
|
run_command(msbuild_path, msbuild_args, name="msbuild")
|
Loading…
Reference in New Issue
Block a user