-
Notifications
You must be signed in to change notification settings - Fork 5
/
SConstruct
55 lines (43 loc) · 1.73 KB
/
SConstruct
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
#!python
import os, subprocess
# Local dependency paths, adapt them to your setup
godot_headers_path = ARGUMENTS.get("headers", "godot_headers/")
# default to release build, add target=debug to build debug build
target = ARGUMENTS.get("target", "release")
# platform= makes it in line with Godots scons file
platform = ARGUMENTS.get("platform", "windows")
# start building our destination path
godot_build_path = 'demo/addons/arvrsimple/bin/'
# 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)
bits = '64'
if 'bits' in env:
bits = env['bits']
if ARGUMENTS.get("use_llvm", "no") == "yes":
env["CXX"] = "clang++"
def add_sources(sources, directory):
for file in os.listdir(directory):
if file.endswith('.c'):
sources.append(directory + '/' + file)
if platform == "osx":
godot_build_path = godot_build_path + 'osx/'
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
elif platform == "linux":
godot_build_path = godot_build_path + 'x11/'
env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++14'])
elif platform == "windows":
godot_build_path = godot_build_path + 'win' + str(bits) + '/'
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=godot_build_path + 'arvrsimple', source=sources)
Default(library)