summaryrefslogtreecommitdiff
path: root/modules/mono/SCsub
blob: 95c959235cd34da3afdcea966f68d0c059e98b38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python

import build_scripts.mono_configure as mono_configure

Import("env")
Import("env_modules")

env_mono = env_modules.Clone()

if env_mono["tools"]:
    # NOTE: It is safe to generate this file here, since this is still executed serially
    import build_scripts.gen_cs_glue_version as gen_cs_glue_version

    gen_cs_glue_version.generate_header("glue/GodotSharp", "glue/cs_glue_version.gen.h")

# Glue sources
if env_mono["mono_glue"]:
    env_mono.Append(CPPDEFINES=["MONO_GLUE_ENABLED"])

    import os.path

    if not os.path.isfile("glue/mono_glue.gen.cpp"):
        raise RuntimeError("Mono glue sources not found. Did you forget to run '--generate-mono-glue'?")

if env_mono["tools"] or env_mono["target"] != "release":
    env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])

# Configure Mono

mono_configure.configure(env, env_mono)

if env_mono["tools"] and env_mono["mono_glue"] and env_mono["build_cil"]:
    # Build Godot API solution
    import build_scripts.api_solution_build as api_solution_build

    api_sln_cmd = api_solution_build.build(env_mono)

    # Build GodotTools
    import build_scripts.godot_tools_build as godot_tools_build

    godot_tools_build.build(env_mono, api_sln_cmd)

    # Build Godot.NET.Sdk
    import build_scripts.godot_net_sdk_build as godot_net_sdk_build

    godot_net_sdk_build.build(env_mono)

# Add sources

env_mono.add_source_files(env.modules_sources, "*.cpp")
env_mono.add_source_files(env.modules_sources, "glue/*.cpp")
env_mono.add_source_files(env.modules_sources, "glue/mono_glue.gen.cpp")
env_mono.add_source_files(env.modules_sources, "mono_gd/*.cpp")
env_mono.add_source_files(env.modules_sources, "utils/*.cpp")

env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.cpp")

if env["platform"] in ["osx", "iphone"]:
    env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.mm")
    env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.m")
elif env["platform"] == "android":
    env_mono.add_source_files(env.modules_sources, "mono_gd/android_mono_config.gen.cpp")

if env["tools"]:
    env_mono.add_source_files(env.modules_sources, "editor/*.cpp")