diff --git a/c/InstanceBindingDemo/SConstruct b/c/InstanceBindingDemo/SConstruct index 76529f3..7f2d068 100644 --- a/c/InstanceBindingDemo/SConstruct +++ b/c/InstanceBindingDemo/SConstruct @@ -14,34 +14,36 @@ platform = ARGUMENTS.get("platform", platform) # 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) + 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 file.endswith(".c"): + sources.append(directory + "/" + file) + if platform == "osx": - env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64']) + 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']) + env.Append(CCFLAGS=["-fPIC", "-g", "-O3", "-std=c11"]) if platform == "windows": if target == "debug": - env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '/MDd']) + env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "/MDd"]) else: - env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '/MD']) + env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "/MD"]) # , 'include', 'include/core' -env.Append(CPPPATH=['.', godot_headers_path]) +env.Append(CPPPATH=[".", godot_headers_path]) sources = [] add_sources(sources, "src") -library = env.SharedLibrary(target='bin/instance_binding_demo', source=sources) +library = env.SharedLibrary(target="bin/instance_binding_demo", source=sources) Default(library) diff --git a/c/SimpleDemo/SConstruct b/c/SimpleDemo/SConstruct index e7ead64..2d14720 100644 --- a/c/SimpleDemo/SConstruct +++ b/c/SimpleDemo/SConstruct @@ -7,12 +7,12 @@ opts = Variables([], ARGUMENTS) env = DefaultEnvironment() # Define our options -opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release'])) -opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx'])) -opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx'])) -opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) -opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'demo/bin/')) -opts.Add(PathVariable('target_name', 'The library name.', 'libsimple', PathVariable.PathAccept)) +opts.Add(EnumVariable("target", "Compilation target", "debug", ["d", "debug", "r", "release"])) +opts.Add(EnumVariable("platform", "Compilation platform", "", ["", "windows", "x11", "linux", "osx"])) +opts.Add(EnumVariable("p", "Compilation target, alias for 'platform'", "", ["", "windows", "x11", "linux", "osx"])) +opts.Add(BoolVariable("use_llvm", "Use the LLVM / Clang compiler", "no")) +opts.Add(PathVariable("target_path", "The path where the lib is installed.", "demo/bin/")) +opts.Add(PathVariable("target_name", "The library name.", "libsimple", PathVariable.PathAccept)) # Local dependency paths, adapt them to your setup godot_headers_path = "godot_headers/" @@ -24,54 +24,54 @@ bits = 64 opts.Update(env) # Process some arguments -if env['use_llvm']: - env['CC'] = 'clang' - env['CXX'] = 'clang++' +if env["use_llvm"]: + env["CC"] = "clang" + env["CXX"] = "clang++" -if env['p'] != '': - env['platform'] = env['p'] +if env["p"] != "": + env["platform"] = env["p"] -if env['platform'] == '': +if env["platform"] == "": print("No valid target platform selected.") - quit(); + quit() # Check our platform specifics -if env['platform'] == "osx": - env['target_path'] += 'osx/' - if env['target'] in ('debug', 'd'): - env.Append(CCFLAGS = ['-g','-O2', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64']) +if env["platform"] == "osx": + env["target_path"] += "osx/" + if env["target"] in ("debug", "d"): + env.Append(CCFLAGS=["-g", "-O2", "-arch", "x86_64"]) + env.Append(LINKFLAGS=["-arch", "x86_64"]) else: - env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64']) + env.Append(CCFLAGS=["-g", "-O3", "-arch", "x86_64"]) + env.Append(LINKFLAGS=["-arch", "x86_64"]) -elif env['platform'] in ('x11', 'linux'): - env['target_path'] += 'x11/' - if env['target'] in ('debug', 'd'): - env.Append(CCFLAGS = ['-fPIC', '-g3','-Og', '-std=c++17']) +elif env["platform"] in ("x11", "linux"): + env["target_path"] += "x11/" + if env["target"] in ("debug", "d"): + env.Append(CCFLAGS=["-fPIC", "-g3", "-Og", "-std=c++17"]) else: - env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++17']) + env.Append(CCFLAGS=["-fPIC", "-g", "-O3", "-std=c++17"]) -elif env['platform'] == "windows": - env['target_path'] += 'win64/' +elif env["platform"] == "windows": + env["target_path"] += "win64/" # 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.Append(ENV = os.environ) + env.Append(ENV=os.environ) - env.Append(CCFLAGS = ['-DWIN32', '-D_WIN32', '-D_WINDOWS', '-W3', '-GR', '-D_CRT_SECURE_NO_WARNINGS']) - if env['target'] in ('debug', 'd'): - env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '-MDd']) + env.Append(CCFLAGS=["-DWIN32", "-D_WIN32", "-D_WINDOWS", "-W3", "-GR", "-D_CRT_SECURE_NO_WARNINGS"]) + if env["target"] in ("debug", "d"): + env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "-MDd"]) else: - env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '-MD']) + env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "-MD"]) # make sure our binding library is properly includes -env.Append(CPPPATH=['.', godot_headers_path]) +env.Append(CPPPATH=[".", godot_headers_path]) # tweak this if you want to use different folders, or more folders, to store your source code in. -env.Append(CPPPATH=['src/']) -sources = Glob('src/*.c') +env.Append(CPPPATH=["src/"]) +sources = Glob("src/*.c") -library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources) +library = env.SharedLibrary(target=env["target_path"] + env["target_name"], source=sources) Default(library) diff --git a/cpp/SimpleDemo/SConstruct b/cpp/SimpleDemo/SConstruct index 0300f6f..7bfa4bc 100644 --- a/cpp/SimpleDemo/SConstruct +++ b/cpp/SimpleDemo/SConstruct @@ -9,7 +9,7 @@ platform = ARGUMENTS.get("platform", platform) # 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) + env = Environment(ENV=os.environ) godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "godot-cpp/godot_headers")) godot_bindings_path = ARGUMENTS.get("cpp_bindings", os.getenv("CPP_BINDINGS", "godot-cpp")) @@ -23,36 +23,44 @@ if ARGUMENTS.get("use_llvm", "no") == "yes": # put stuff that is the same for all first, saves duplication if platform == "osx": - env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup']) + env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-arch", "x86_64"]) + env.Append(LINKFLAGS=["-arch", "x86_64", "-framework", "Cocoa", "-Wl,-undefined,dynamic_lookup"]) elif platform == "linux": - env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-Wno-writable-strings']) - env.Append(LINKFLAGS = ['-Wl,-R,\'$$ORIGIN\'']) + env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-Wno-writable-strings"]) + env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"]) elif platform == "windows": # need to add detection of msvc vs mingw, this is for msvc... - env.Append(LINKFLAGS = ['/WX']) + env.Append(LINKFLAGS=["/WX"]) if target == "debug": - env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '/MDd']) + env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "/MDd"]) else: - env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '/MD']) + env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "/MD"]) + def add_sources(sources, dir): for f in os.listdir(dir): if f.endswith(".cpp"): sources.append(dir + "/" + f) -env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + '/include', godot_bindings_path + '/include/gen/', godot_bindings_path + '/include/core/']) + +env.Append( + CPPPATH=[ + godot_headers_path, + godot_bindings_path + "/include", + godot_bindings_path + "/include/gen/", + godot_bindings_path + "/include/core/", + ] +) if target == "debug": - env.Append(LIBS=['libgodot-cpp.linux.debug.64']) + env.Append(LIBS=["libgodot-cpp.linux.debug.64"]) else: - env.Append(LIBS=['libgodot-cpp.linux.release.64']) + env.Append(LIBS=["libgodot-cpp.linux.release.64"]) -env.Append(LIBPATH=[ godot_bindings_path + '/bin/' ]) +env.Append(LIBPATH=[godot_bindings_path + "/bin/"]) sources = [] add_sources(sources, "src") -library = env.SharedLibrary(target='bin/libsimple', source=sources) +library = env.SharedLibrary(target="bin/libsimple", source=sources) Default(library) - diff --git a/cpp/cpp_constructors/SConstruct b/cpp/cpp_constructors/SConstruct index a3c1885..75d5548 100644 --- a/cpp/cpp_constructors/SConstruct +++ b/cpp/cpp_constructors/SConstruct @@ -9,7 +9,7 @@ platform = ARGUMENTS.get("platform", platform) # 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) + env = Environment(ENV=os.environ) godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "godot-cpp/godot_headers")) godot_bindings_path = ARGUMENTS.get("cpp_bindings", os.getenv("CPP_BINDINGS", "godot-cpp")) @@ -23,35 +23,43 @@ if ARGUMENTS.get("use_llvm", "no") == "yes": # put stuff that is the same for all first, saves duplication if platform == "osx": - env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup']) + env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-arch", "x86_64"]) + env.Append(LINKFLAGS=["-arch", "x86_64", "-framework", "Cocoa", "-Wl,-undefined,dynamic_lookup"]) elif platform == "linux": - env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-Wno-writable-strings']) - env.Append(LINKFLAGS = ['-Wl,-R,\'$$ORIGIN\'']) + env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-Wno-writable-strings"]) + env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"]) elif platform == "windows": # need to add detection of msvc vs mingw, this is for msvc... - env.Append(LINKFLAGS = ['/WX']) + env.Append(LINKFLAGS=["/WX"]) if target == "debug": - env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '/MDd']) + env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "/MDd"]) else: - env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '/MD']) + env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "/MD"]) + def add_sources(sources, dir): for f in os.listdir(dir): if f.endswith(".cpp"): sources.append(dir + "/" + f) -env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + '/include', godot_bindings_path + '/include/gen/', godot_bindings_path + '/include/core/']) + +env.Append( + CPPPATH=[ + godot_headers_path, + godot_bindings_path + "/include", + godot_bindings_path + "/include/gen/", + godot_bindings_path + "/include/core/", + ] +) if target == "debug": - env.Append(LIBS=['libgodot-cpp.linux.debug.64']) + env.Append(LIBS=["libgodot-cpp.linux.debug.64"]) else: - env.Append(LIBS=['libgodot-cpp.linux.release.64']) -env.Append(LIBPATH=[ godot_bindings_path + '/bin/' ]) + env.Append(LIBS=["libgodot-cpp.linux.release.64"]) +env.Append(LIBPATH=[godot_bindings_path + "/bin/"]) sources = [] add_sources(sources, "src") -library = env.SharedLibrary(target='bin/libconstructor', source=sources) +library = env.SharedLibrary(target="bin/libconstructor", source=sources) Default(library) - diff --git a/cpp/kinematic_character/Script/SConstruct b/cpp/kinematic_character/Script/SConstruct index 1cbdf8f..364660c 100644 --- a/cpp/kinematic_character/Script/SConstruct +++ b/cpp/kinematic_character/Script/SConstruct @@ -9,7 +9,7 @@ platform = ARGUMENTS.get("platform", platform) # 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) + env = Environment(ENV=os.environ) godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "godot-cpp/godot_headers")) godot_bindings_path = ARGUMENTS.get("cpp_bindings", os.getenv("CPP_BINDINGS", "godot-cpp")) @@ -23,35 +23,43 @@ if ARGUMENTS.get("use_llvm", "no") == "yes": # put stuff that is the same for all first, saves duplication if platform == "osx": - env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup']) + env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-arch", "x86_64"]) + env.Append(LINKFLAGS=["-arch", "x86_64", "-framework", "Cocoa", "-Wl,-undefined,dynamic_lookup"]) elif platform == "linux": - env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-Wno-writable-strings']) - env.Append(LINKFLAGS = ['-Wl,-R,\'$$ORIGIN\'']) + env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-Wno-writable-strings"]) + env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"]) elif platform == "windows": # need to add detection of msvc vs mingw, this is for msvc... - env.Append(LINKFLAGS = ['/WX']) + env.Append(LINKFLAGS=["/WX"]) if target == "debug": - env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '/MDd']) + env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "/MDd"]) else: - env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '/MD']) + env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "/MD"]) + def add_sources(sources, dir): for f in os.listdir(dir): if f.endswith(".cpp"): sources.append(dir + "/" + f) -env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + '/include/gen/', godot_bindings_path + '/include/core/', godot_bindings_path + '/include/']) + +env.Append( + CPPPATH=[ + godot_headers_path, + godot_bindings_path + "/include/gen/", + godot_bindings_path + "/include/core/", + godot_bindings_path + "/include/", + ] +) if target == "debug": - env.Append(LIBS=['libgodot-cpp.linux.debug.64']) + env.Append(LIBS=["libgodot-cpp.linux.debug.64"]) else: - env.Append(LIBS=['libgodot-cpp.linux.release.64']) -env.Append(LIBPATH=[ godot_bindings_path + '/bin/' ]) + env.Append(LIBS=["libgodot-cpp.linux.release.64"]) +env.Append(LIBPATH=[godot_bindings_path + "/bin/"]) sources = [] add_sources(sources, "src") -library = env.SharedLibrary(target='bin/libkinematic_char', source=sources) +library = env.SharedLibrary(target="bin/libkinematic_char", source=sources) Default(library) -