This commit is contained in:
Edward R. Gonzalez 2022-05-12 10:30:48 -04:00
parent 0033fb160b
commit bf7650bf1d
5 changed files with 23 additions and 11 deletions

View File

@ -1,5 +1,6 @@
#!python #!python
import os import os
import glob
opts = Variables([], ARGUMENTS) opts = Variables([], ARGUMENTS)
@ -14,16 +15,16 @@ opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r
opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx'])) 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(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
opts.Add(PathVariable('target_path', 'The path where the lib is installed.', ProjPath + '/Engine/gdnative_cpp/bin')) opts.Add(PathVariable('target_path', 'The path where the lib is installed.', ProjPath + '/Engine/gdnative_cpp/bin/'))
opts.Add(PathVariable('target_name', 'The library name.', 'libgdexample', PathVariable.PathAccept)) opts.Add(PathVariable('target_name', 'The library name.', 'libgdexample', PathVariable.PathAccept))
# Local dependency paths, adapt them to your setup # Local dependency paths, adapt them to your setup
godot_headers_path = ProjPath + "/Engine/gdnative_cpp/godot_cpp/godot-headers/" godot_headers_path = ProjPath + "/Engine/gdnative_cpp/godot-headers/"
cpp_bindings_path = ProjPath + "/Engine/gdnative_cpp/godot_cpp/" cpp_bindings_path = ProjPath + "/Engine/gdnative_cpp/"
cpp_library = "libgodot-cpp" cpp_library = "libgodot-cpp"
GDNative_Src = ProjPath + '/Engine/gdnative_cpp/godot_cpp/src/*.cpp' GDNative_Src = ProjPath + '/Engine/gdnative_cpp/src/'
Src = ProjPath + "/Source/*.cpp" Src = ProjPath + "/Source/"
# only support 64 at this time.. # only support 64 at this time..
bits = 64 bits = 64
@ -99,16 +100,25 @@ else:
cpp_library += '.' + str(bits) cpp_library += '.' + str(bits)
# make sure our binding library is properly includes # make sure our binding library is properly includes
env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/']) env.Append(CPPPATH=[
env.Append(LIBPATH=[cpp_bindings_path + 'bin/']) '.',
godot_headers_path,
cpp_bindings_path + 'include/',
cpp_bindings_path + 'include/core/',
cpp_bindings_path + 'include/gen/'])
env.Append(LIBPATH=[cpp_bindings_path + "/bin"])
env.Append(LIBS=[cpp_library]) env.Append(LIBS=[cpp_library])
# tweak this if you want to use different folders, or more folders, to store your source code in. # tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=[GDNative_Src]) env.Append(CPPPATH=[GDNative_Src])
env.Append(CPPPATH=[Src]) env.Append(CPPPATH=[Src])
sources = Glob(GDNative_Src, Src)
test = "Sources: ".join(sources) sources = Glob(GDNative_Src + '/*.cpp') + Glob(Src + '/*cpp')
print(test);
for thing in sources :
print(thing)
library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources) library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources)

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <Godot.hpp> #include <godot.hpp>
#include <Sprite.hpp> #include <Sprite.hpp>
namespace godot { namespace godot {

View File

@ -1,3 +1,5 @@
#pragma once
#include "gdexample.h" #include "gdexample.h"
#define gd_export(Type_) \ #define gd_export(Type_) \

Binary file not shown.

Binary file not shown.