Refactor build resources

Move DUB files into /bld/d and add more instructions to README.
This commit is contained in:
Aidan C. Mullen 2025-03-05 07:44:25 -05:00
parent dd8e9d4296
commit 724659b25f
9 changed files with 69 additions and 28 deletions

25
.gitignore vendored
View file

@ -11,8 +11,6 @@
!build.sh
!CHANGELOG
!configure.ac
!dub.sdl
!dub.selections.json
!extension_api.json
!LICENSE
!Makefile.am
@ -21,6 +19,21 @@
!/bin/main.gdextension
# /bld
!/bld/
/bld/*
# /bld/src
!/bld/src/
/bld/src/*
# /bld/src/d
!/bld/src/d/
/bld/src/d/*
!/bld/src/d/dub.sdl
!/bld/src/d/dub.selections.json
# /docs
!/docs/
/docs/*
@ -64,19 +77,17 @@
!/src/init
/src/init/*
!/src/init/bind.d
# /src/init/cpp
!/src/init/cpp
!/src/init/cpp/
/src/init/cpp/*
!/src/init/cpp/bind.cpp
# /src/init/d
!/src/init/d
!/src/init/d/
/src/init/d/*
/src/init/d/bind.d
!/src/init/d/bind.d
!/src/init/d

11
README
View file

@ -43,6 +43,17 @@ Build
operating systems and WebAssembly, which can be useful for transpiling and
new platform testing.
Quick Setup
-----------
In a terminal run Godot with the "--dump-extension-api" flag; this will
generate the "extension_api.json" required by your installation.
Following this, run the following command:
dub run godot-dlang:generator -- -j extension_api.json -o
Refer to documentation for more information.
Project organized in conformance to the Straightforward C Project Standard 5
(SCPS5).

View file

@ -7,6 +7,6 @@ dependency "godot-dlang" version="~master"
configuration "spruce-basin" {
targetType "dynamicLibrary"
dflags "-dllimport=defaultLibsOnly" platform="windows-ldc2"
targetName "bld/out/spruce-basin"
mainSourceFile "src/init/bind.d"
targetName "../../obj/spruce-basin"
mainSourceFile "../../../src/init/bind.d"
}

View file

@ -5,7 +5,7 @@
# Prepare to Build Project
mkdir ./bld
mkdir ./bld/out
mkdir ./bld/obj
# Run Autotools
libtoolize

View file

@ -1,8 +0,0 @@
[configuration]
entry_symbol = "librtr_extension_init"
compatibility_minimum = "4.2"
[libraries]
windows.x86_64 = "res://../src/.libs/librtr.dll"
macos = "res://../src/.libs/librtr.dylib"
linux.debug.x86_64 = "res://../src/.libs/librtr.so"

View file

@ -1,10 +1,13 @@
[configuration]
entry_symbol = "Godot-DLang"
entry_symbol = "libsb_init"
compatibility_minimum = "4.4"
[libraries]
linux.64 = "bind.so"
darwin.64 = "bind.dylib"
windows.64 = "bind.dll"
linux.amd64 = "res://../bld/obj/.libs/libbind.so"
linux.amd64 = "res://../bld/obj/.libs/libsb.so"
darwin.amd64 = "res://../bld/obj/.libs/libbind.dylib"
darwin.amd64 = "res://../bld/obj/.libs/libsb.dylib"
windows.amd64 = "res://../bld/obj/.libs/libbind.dll"
windows.amd64 = "res://../bld/obj/.libs/libsb.dll"

View file

@ -1,6 +0,0 @@
import std;
void main()
{
printf("Start.");
}

30
src/init/d/bind.d Normal file
View file

@ -0,0 +1,30 @@
import godot;
// import godot.api.script; // for GodotScript!
// import godot.api.register; // for GodotNativeLibrary
// import godot.string; // for gs!
import godot.node;
// minimal class example with _ready method that will be invoked on creation
class Greeter : GodotScript!Node {
@Property String name;
// this method is a special godot entry point when object is added to the scene
@Method
void _ready() {
// 'gs' is a string wrapper that converts D string to godot string
// usually there is helper functions that takes regular D strings and do this for you
print(gs!"Hello ", name);
}
}
// register classes, initialize and terminate D runtime, only one per plugin
mixin GodotNativeLibrary!(
// this is a name prefix of the plugin to be acessible inside godot
// it must match the prefix in .gdextension file:
// entry_symbol = "mydplugin_gdextension_entry"
"mydplugin",
// here goes the list of classes you would like to expose in godot
Greeter,
);