Hi, thanks for reply, just popping through today but yes used the suggested Demo project and scons placed the shared object directly into the bin directory, then I made the two descriptor files in the bin directory and the so went in the x11 directory (I'm on a Fedora machine)
The so did look large at 63.6mb but assumed I'd need to tweak the make file (SConstruct) at a later date.
I did add a few extra paths into SConstruct too, not sure which were actually needed, was tired and throughly confused by then :D
SConstruct
#!python
import os
target = ARGUMENTS.get("target", "debug")
platform = ARGUMENTS.get("platform", "linux")
bits = ARGUMENTS.get("bits", 64)
final_lib_path = 'demo/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)
def add_sources(sources, directory):
for file in os.listdir(directory):
if file.endswith('.cpp'):
sources.append(directory + '/' + file)
if platform == "osx":
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64', '-std=c++14'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
final_lib_path = final_lib_path + 'osx/'
elif platform == "linux":
env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++14'])
final_lib_path = final_lib_path + 'x11/'
elif platform == "windows":
if target == "debug":
env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '-MDd'])
else:
env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '-MD'])
final_lib_path = final_lib_path + 'win' + str(bits) + '/'
env.Append(CPPPATH=['.', 'src/', "godot_headers/", "godot-headers/", 'godot-cpp/include/', 'godot-cpp/include/godot_cpp/core/', 'godot-cpp/include/godot_cpp/', 'godot-cpp/gen/', 'godot-cpp/gen/include/godot_cpp/', 'godot-cpp/include/core/', 'godot-cpp/include/', 'godot-cpp/include/gen'])
env.Append(LIBPATH="godot-cpp/bin/")
env.Append(LIBS=["libgodot-cpp" + "." + platform + ".debug." + str(bits) + ".a"])
sources = []
add_sources(sources, "src")
library = env.SharedLibrary(target=final_lib_path + 'libgdexample', source=sources)
Default(library)
I will have another attempt on Sunday, but been thinking I may start to use Godot4 and therefore try GDExtension as well...
https://godotengine.org/article/introducing-gd-extensions
Cheers