Add initial files for dual gdextension-module setup
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.venv
|
||||
.idea
|
||||
54
SConstruct
Normal file
54
SConstruct
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
import project_config
|
||||
|
||||
constant_prefix = project_config.get_defines_friendly_name()
|
||||
|
||||
env = SConscript("godot-cpp/SConstruct")
|
||||
|
||||
# For reference:
|
||||
# - CCFLAGS are compilation flags shared between C and C++
|
||||
# - CFLAGS are for C-specific compilation flags
|
||||
# - CXXFLAGS are for C++-specific compilation flags
|
||||
# - CPPFLAGS are for pre-processor flags
|
||||
# - CPPDEFINES are for pre-processor defines
|
||||
# - LINKFLAGS are for linking flags
|
||||
|
||||
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
||||
env.Append(CPPPATH=["src/"])
|
||||
|
||||
env.Append(CPPDEFINES=[f"{constant_prefix}_GDEXTENSION"])
|
||||
sources = Glob("src/*.cpp")
|
||||
|
||||
if env["platform"] == "macos":
|
||||
library = env.SharedLibrary(
|
||||
"demo/bin/{}.{}.{}.framework/libgdexample.{}.{}".format(
|
||||
project_config.lib_name(),
|
||||
env["platform"],
|
||||
env["target"],
|
||||
project_config.lib_name(),
|
||||
env["platform"],
|
||||
env["target"]
|
||||
),
|
||||
source=sources,
|
||||
)
|
||||
elif env["platform"] == "ios":
|
||||
if env["ios_simulator"]:
|
||||
library = env.StaticLibrary(
|
||||
"demo/bin/{}.{}.{}.simulator.a".format(project_config.lib_name(), env["platform"], env["target"]),
|
||||
source=sources,
|
||||
)
|
||||
else:
|
||||
library = env.StaticLibrary(
|
||||
"demo/bin/{}.{}.{}.a".format(project_config.lib_name(), env["platform"], env["target"]),
|
||||
source=sources,
|
||||
)
|
||||
else:
|
||||
library = env.SharedLibrary(
|
||||
"demo/bin/{}{}{}".format(project_config.lib_name(), env["suffix"], env["SHLIBSUFFIX"]),
|
||||
source=sources,
|
||||
)
|
||||
|
||||
Default(library)
|
||||
12
project_config.py
Normal file
12
project_config.py
Normal file
@@ -0,0 +1,12 @@
|
||||
PROJECT_NAME = "dual-gdextension-module"
|
||||
PROJECT_VERSION = "0.1.0"
|
||||
|
||||
def get_defines_friendly_name():
|
||||
global PROJECT_NAME
|
||||
|
||||
friendly_name = PROJECT_NAME.replace("-", "_").upper()
|
||||
|
||||
return friendly_name
|
||||
|
||||
def lib_name():
|
||||
return "lib" + PROJECT_NAME.replace("-", "").lower()
|
||||
5
register_types.cpp
Normal file
5
register_types.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// Created by andrew on 3/17/26.
|
||||
//
|
||||
|
||||
#include "register_types.h"
|
||||
10
register_types.h
Normal file
10
register_types.h
Normal file
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Created by andrew on 3/17/26.
|
||||
//
|
||||
|
||||
#ifndef DUAL_GDEXTENSION_MODULE_TEMPLATE_REGISTER_TYPES_H
|
||||
#define DUAL_GDEXTENSION_MODULE_TEMPLATE_REGISTER_TYPES_H
|
||||
|
||||
#ifdef
|
||||
|
||||
#endif //DUAL_GDEXTENSION_MODULE_TEMPLATE_REGISTER_TYPES_H
|
||||
Reference in New Issue
Block a user