mirror of
https://github.com/godotengine/gdnative-demos.git
synced 2026-01-01 05:48:13 +03:00
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
#!python
|
|
import os, subprocess
|
|
|
|
# Local dependency paths, adapt them to your setup
|
|
godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "../../../godot_headers/"))
|
|
|
|
target = ARGUMENTS.get("target", "debug")
|
|
|
|
# platform= makes it in line with Godots scons file, keeping p for backwards compatibility
|
|
platform = ARGUMENTS.get("p", "linux")
|
|
platform = ARGUMENTS.get("platform", platform)
|
|
|
|
# This makes sure to keep the session environment variables on windows,
|
|
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
|
|
env = Environment()
|
|
if platform == "windows":
|
|
env = Environment(ENV=os.environ)
|
|
|
|
if ARGUMENTS.get("use_llvm", "no") == "yes":
|
|
env["CC"] = "clang"
|
|
|
|
|
|
def add_sources(sources, directory):
|
|
for file in os.listdir(directory):
|
|
if file.endswith(".c"):
|
|
sources.append(directory + "/" + file)
|
|
|
|
|
|
if platform == "osx":
|
|
env.Append(CCFLAGS=["-g", "-O3", "-arch", "x86_64"])
|
|
env.Append(LINKFLAGS=["-arch", "x86_64"])
|
|
|
|
if platform == "linux":
|
|
env.Append(CCFLAGS=["-fPIC", "-g", "-O3", "-std=c11"])
|
|
|
|
if platform == "windows":
|
|
if target == "debug":
|
|
env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "/MDd"])
|
|
else:
|
|
env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "/MD"])
|
|
|
|
# , 'include', 'include/core'
|
|
env.Append(CPPPATH=[".", godot_headers_path])
|
|
|
|
sources = []
|
|
add_sources(sources, "src")
|
|
|
|
library = env.SharedLibrary(target="bin/instance_binding_demo", source=sources)
|
|
Default(library)
|