Compare commits
12 Commits
f836481b66
...
a1b01a59a4
Author | SHA1 | Date |
---|---|---|
Sara | a1b01a59a4 | |
Sara | d3fdf7bb26 | |
Patrick Exner (FlameLizard) | 3ec351897d | |
Patrick Exner (FlameLizard) | 682db5ae1a | |
Fabio Alessandrelli | ac1499baf4 | |
Patrick Exner (FlameLizard) | e6323bdc32 | |
Sebastien Dabdoub | 24a5efe8f7 | |
Patrick Exner (FlameLizard) | 843b2258a0 | |
Adam Scott | 54a177ce39 | |
Patrick Exner (FlameLizard) | 055ab32bc6 | |
Adam Scott | fbd0021dec | |
Adam Scott | 43d3b1181c |
|
@ -0,0 +1,199 @@
|
||||||
|
# Commented out parameters are those with the same value as base LLVM style.
|
||||||
|
# We can uncomment them if we want to change their value, or enforce the
|
||||||
|
# chosen value in case the base style changes (last sync: Clang 14.0).
|
||||||
|
---
|
||||||
|
### General config, applies to all languages ###
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
# AlignArrayOfStructures: None
|
||||||
|
# AlignConsecutiveMacros: None
|
||||||
|
# AlignConsecutiveAssignments: None
|
||||||
|
# AlignConsecutiveBitFields: None
|
||||||
|
# AlignConsecutiveDeclarations: None
|
||||||
|
# AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments: false
|
||||||
|
# AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
# AllowShortEnumsOnASingleLine: true
|
||||||
|
# AllowShortBlocksOnASingleLine: Never
|
||||||
|
# AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
# AllowShortFunctionsOnASingleLine: All
|
||||||
|
# AllowShortLambdasOnASingleLine: All
|
||||||
|
# AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
# AllowShortLoopsOnASingleLine: false
|
||||||
|
# AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
# AlwaysBreakAfterReturnType: None
|
||||||
|
# AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
# AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
# AttributeMacros:
|
||||||
|
# - __capability
|
||||||
|
# BinPackArguments: true
|
||||||
|
# BinPackParameters: true
|
||||||
|
# BraceWrapping:
|
||||||
|
# AfterCaseLabel: false
|
||||||
|
# AfterClass: false
|
||||||
|
# AfterControlStatement: Never
|
||||||
|
# AfterEnum: false
|
||||||
|
# AfterFunction: false
|
||||||
|
# AfterNamespace: false
|
||||||
|
# AfterObjCDeclaration: false
|
||||||
|
# AfterStruct: false
|
||||||
|
# AfterUnion: false
|
||||||
|
# AfterExternBlock: false
|
||||||
|
# BeforeCatch: false
|
||||||
|
# BeforeElse: false
|
||||||
|
# BeforeLambdaBody: false
|
||||||
|
# BeforeWhile: false
|
||||||
|
# IndentBraces: false
|
||||||
|
# SplitEmptyFunction: true
|
||||||
|
# SplitEmptyRecord: true
|
||||||
|
# SplitEmptyNamespace: true
|
||||||
|
# BreakBeforeBinaryOperators: None
|
||||||
|
# BreakBeforeConceptDeclarations: true
|
||||||
|
# BreakBeforeBraces: Attach
|
||||||
|
# BreakBeforeInheritanceComma: false
|
||||||
|
# BreakInheritanceList: BeforeColon
|
||||||
|
# BreakBeforeTernaryOperators: true
|
||||||
|
# BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
# BreakStringLiterals: true
|
||||||
|
ColumnLimit: 0
|
||||||
|
# CommentPragmas: '^ IWYU pragma:'
|
||||||
|
# QualifierAlignment: Leave
|
||||||
|
# CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 8
|
||||||
|
ContinuationIndentWidth: 8
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
# DeriveLineEnding: true
|
||||||
|
# DerivePointerAlignment: false
|
||||||
|
# DisableFormat: false
|
||||||
|
# EmptyLineAfterAccessModifier: Never
|
||||||
|
# EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
|
# ExperimentalAutoDetectBinPacking: false
|
||||||
|
# PackConstructorInitializers: BinPack
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
# AllowAllConstructorInitializersOnNextLine: true
|
||||||
|
# FixNamespaceComments: true
|
||||||
|
# ForEachMacros:
|
||||||
|
# - foreach
|
||||||
|
# - Q_FOREACH
|
||||||
|
# - BOOST_FOREACH
|
||||||
|
# IfMacros:
|
||||||
|
# - KJ_IF_MAYBE
|
||||||
|
# IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '".*"'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^<.*\.h>'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 3
|
||||||
|
# IncludeIsMainRegex: '(Test)?$'
|
||||||
|
# IncludeIsMainSourceRegex: ''
|
||||||
|
# IndentAccessModifiers: false
|
||||||
|
IndentCaseLabels: true
|
||||||
|
# IndentCaseBlocks: false
|
||||||
|
# IndentGotoLabels: true
|
||||||
|
# IndentPPDirectives: None
|
||||||
|
# IndentExternBlock: AfterExternBlock
|
||||||
|
# IndentRequires: false
|
||||||
|
IndentWidth: 4
|
||||||
|
# IndentWrappedFunctionNames: false
|
||||||
|
# InsertTrailingCommas: None
|
||||||
|
# JavaScriptQuotes: Leave
|
||||||
|
# JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
# LambdaBodyIndentation: Signature
|
||||||
|
# MacroBlockBegin: ''
|
||||||
|
# MacroBlockEnd: ''
|
||||||
|
# MaxEmptyLinesToKeep: 1
|
||||||
|
# NamespaceIndentation: None
|
||||||
|
# PenaltyBreakAssignment: 2
|
||||||
|
# PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
# PenaltyBreakComment: 300
|
||||||
|
# PenaltyBreakFirstLessLess: 120
|
||||||
|
# PenaltyBreakOpenParenthesis: 0
|
||||||
|
# PenaltyBreakString: 1000
|
||||||
|
# PenaltyBreakTemplateDeclaration: 10
|
||||||
|
# PenaltyExcessCharacter: 1000000
|
||||||
|
# PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
# PenaltyIndentedWhitespace: 0
|
||||||
|
# PointerAlignment: Right
|
||||||
|
# PPIndentWidth: -1
|
||||||
|
# ReferenceAlignment: Pointer
|
||||||
|
# ReflowComments: true
|
||||||
|
# RemoveBracesLLVM: false
|
||||||
|
# SeparateDefinitionBlocks: Leave
|
||||||
|
# ShortNamespaceLines: 1
|
||||||
|
# SortIncludes: CaseSensitive
|
||||||
|
# SortJavaStaticImport: Before
|
||||||
|
# SortUsingDeclarations: true
|
||||||
|
# SpaceAfterCStyleCast: false
|
||||||
|
# SpaceAfterLogicalNot: false
|
||||||
|
# SpaceAfterTemplateKeyword: true
|
||||||
|
# SpaceBeforeAssignmentOperators: true
|
||||||
|
# SpaceBeforeCaseColon: false
|
||||||
|
# SpaceBeforeCpp11BracedList: false
|
||||||
|
# SpaceBeforeCtorInitializerColon: true
|
||||||
|
# SpaceBeforeInheritanceColon: true
|
||||||
|
# SpaceBeforeParens: ControlStatements
|
||||||
|
# SpaceBeforeParensOptions:
|
||||||
|
# AfterControlStatements: true
|
||||||
|
# AfterForeachMacros: true
|
||||||
|
# AfterFunctionDefinitionName: false
|
||||||
|
# AfterFunctionDeclarationName: false
|
||||||
|
# AfterIfMacros: true
|
||||||
|
# AfterOverloadedOperator: false
|
||||||
|
# BeforeNonEmptyParentheses: false
|
||||||
|
# SpaceAroundPointerQualifiers: Default
|
||||||
|
# SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
# SpaceInEmptyBlock: false
|
||||||
|
# SpaceInEmptyParentheses: false
|
||||||
|
# SpacesBeforeTrailingComments: 1
|
||||||
|
# SpacesInAngles: Never
|
||||||
|
# SpacesInConditionalStatement: false
|
||||||
|
# SpacesInContainerLiterals: true
|
||||||
|
# SpacesInCStyleCastParentheses: false
|
||||||
|
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
|
||||||
|
## our comment capitalization at the same time.
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 0
|
||||||
|
Maximum: -1
|
||||||
|
# SpacesInParentheses: false
|
||||||
|
# SpacesInSquareBrackets: false
|
||||||
|
# SpaceBeforeSquareBrackets: false
|
||||||
|
# BitFieldColonSpacing: Both
|
||||||
|
# StatementAttributeLikeMacros:
|
||||||
|
# - Q_EMIT
|
||||||
|
# StatementMacros:
|
||||||
|
# - Q_UNUSED
|
||||||
|
# - QT_REQUIRE_VERSION
|
||||||
|
TabWidth: 4
|
||||||
|
# UseCRLF: false
|
||||||
|
UseTab: Always
|
||||||
|
# WhitespaceSensitiveMacros:
|
||||||
|
# - STRINGIZE
|
||||||
|
# - PP_STRINGIZE
|
||||||
|
# - BOOST_PP_STRINGIZE
|
||||||
|
# - NS_SWIFT_NAME
|
||||||
|
# - CF_SWIFT_NAME
|
||||||
|
---
|
||||||
|
### C++ specific config ###
|
||||||
|
Language: Cpp
|
||||||
|
Standard: c++17
|
||||||
|
---
|
||||||
|
### ObjC specific config ###
|
||||||
|
Language: ObjC
|
||||||
|
# ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
# ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
# ObjCSpaceAfterProperty: false
|
||||||
|
# ObjCSpaceBeforeProtocolList: true
|
||||||
|
---
|
||||||
|
### Java specific config ###
|
||||||
|
Language: Java
|
||||||
|
# BreakAfterJavaFieldAnnotations: false
|
||||||
|
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']
|
||||||
|
...
|
|
@ -3,9 +3,27 @@
|
||||||
|
|
||||||
# Ignore library files but not the gdextension file
|
# Ignore library files but not the gdextension file
|
||||||
demo/bin/*
|
demo/bin/*
|
||||||
|
!demo/bin/android
|
||||||
|
demo/bin/android/*
|
||||||
|
!demo/bin/android/.gitkeep
|
||||||
|
!demo/bin/linux
|
||||||
|
demo/bin/linux/*
|
||||||
|
!demo/bin/linux/.gitkeep
|
||||||
|
!demo/bin/macos
|
||||||
|
demo/bin/macos/*
|
||||||
|
!demo/bin/macos/.gitkeep
|
||||||
|
!demo/bin/windows
|
||||||
|
demo/bin/windows/*
|
||||||
|
!demo/bin/windows/.gitkeep
|
||||||
!demo/bin/*.gdextension
|
!demo/bin/*.gdextension
|
||||||
.sconsign*.dblite
|
.sconsign*.dblite
|
||||||
|
|
||||||
|
# Ignore custom.py
|
||||||
|
custom.py
|
||||||
|
|
||||||
|
# Ignore generated compile_commands.json
|
||||||
|
compile_commands.json
|
||||||
|
|
||||||
# Binaries
|
# Binaries
|
||||||
*.o
|
*.o
|
||||||
*.os
|
*.os
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[submodule "godot-cpp"]
|
[submodule "godot-cpp"]
|
||||||
path = godot-cpp
|
path = godot-cpp
|
||||||
url = https://github.com/godotengine/godot-cpp.git
|
url = https://git.saragerretsen.nl/Sara/godot-cpp.git
|
||||||
branch = 4.0
|
branch = 4.0
|
||||||
|
|
|
@ -12,7 +12,8 @@ This repository serves as a quickstart template for GDExtension development with
|
||||||
To use this template, log in to github and click the green "Use this template" button at the top of the repository page.
|
To use this template, log in to github and click the green "Use this template" button at the top of the repository page.
|
||||||
This will let you create a copy of this repository with a clean git history. Make sure you clone the correct branch as these are configured for development of their respective Godot development branches and differ from each other. Refer to the docs to see what changed between the versions.
|
This will let you create a copy of this repository with a clean git history. Make sure you clone the correct branch as these are configured for development of their respective Godot development branches and differ from each other. Refer to the docs to see what changed between the versions.
|
||||||
|
|
||||||
For getting started after cloning your own copy to your local machine, you should
|
For getting started after cloning your own copy to your local machine, you should:
|
||||||
|
* initialize the godot-cpp git submodule via `git submodule update --init`
|
||||||
* change the name of your library
|
* change the name of your library
|
||||||
* change the name of the compiled library file inside the `SConstruct` file by modifying the `libname` string.
|
* change the name of the compiled library file inside the `SConstruct` file by modifying the `libname` string.
|
||||||
* change the pathnames of the to be loaded library name inside the `demo/bin/example.gdextension` file. By replacing `libgdexample` to the name specified in your `SConstruct` file.
|
* change the pathnames of the to be loaded library name inside the `demo/bin/example.gdextension` file. By replacing `libgdexample` to the name specified in your `SConstruct` file.
|
||||||
|
|
73
SConstruct
73
SConstruct
|
@ -1,22 +1,73 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_path(val, env):
|
||||||
|
return val if os.path.isabs(val) else os.path.join(env.Dir("#").abspath, val)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_parent_dir(key, val, env):
|
||||||
|
if not os.path.isdir(normalize_path(os.path.dirname(val), env)):
|
||||||
|
raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val)))
|
||||||
|
|
||||||
|
|
||||||
libname = "EXTENSION-NAME"
|
libname = "EXTENSION-NAME"
|
||||||
|
projectdir = "demo"
|
||||||
|
|
||||||
env = SConscript("godot-cpp/SConstruct")
|
localEnv = Environment(tools=["default"], PLATFORM="")
|
||||||
|
|
||||||
|
customs = ["custom.py"]
|
||||||
|
customs = [os.path.abspath(path) for path in customs]
|
||||||
|
|
||||||
|
opts = Variables(customs, ARGUMENTS)
|
||||||
|
opts.Add(
|
||||||
|
BoolVariable(
|
||||||
|
key="compiledb",
|
||||||
|
help="Generate compilation DB (`compile_commands.json`) for external tools",
|
||||||
|
default=localEnv.get("compiledb", False),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
opts.Add(
|
||||||
|
PathVariable(
|
||||||
|
key="compiledb_file",
|
||||||
|
help="Path to a custom `compile_commands.json` file",
|
||||||
|
default=localEnv.get("compiledb_file", "compile_commands.json"),
|
||||||
|
validator=validate_parent_dir,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
opts.Update(localEnv)
|
||||||
|
|
||||||
|
Help(opts.GenerateHelpText(localEnv))
|
||||||
|
|
||||||
|
env = localEnv.Clone()
|
||||||
|
env["compiledb"] = False
|
||||||
|
|
||||||
|
env.Tool("compilation_db")
|
||||||
|
compilation_db = env.CompilationDatabase(
|
||||||
|
normalize_path(localEnv["compiledb_file"], localEnv)
|
||||||
|
)
|
||||||
|
env.Alias("compiledb", compilation_db)
|
||||||
|
|
||||||
|
env = SConscript("godot-cpp/SConstruct", {"env": env, "customs": customs})
|
||||||
|
|
||||||
env.Append(CPPPATH=["src/"])
|
env.Append(CPPPATH=["src/"])
|
||||||
sources = Glob("src/*.cpp")
|
sources = Glob("src/*.cpp")
|
||||||
|
|
||||||
|
file = "{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"])
|
||||||
|
|
||||||
if env["platform"] == "macos":
|
if env["platform"] == "macos":
|
||||||
platlibname = "{}.{}.{}".format(libname, env["platform"], env["target"])
|
platlibname = "{}.{}.{}".format(libname, env["platform"], env["target"])
|
||||||
library = env.SharedLibrary(
|
file = "{}.framework/{}".format(env["platform"], platlibname, platlibname)
|
||||||
"bin/{}.framework/{}".format(platlibname, platlibname),
|
|
||||||
source=sources,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
library = env.SharedLibrary(
|
|
||||||
"bin/{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"]),
|
|
||||||
source=sources,
|
|
||||||
)
|
|
||||||
|
|
||||||
Default(library)
|
libraryfile = "bin/{}/{}".format(env["platform"], file)
|
||||||
|
library = env.SharedLibrary(
|
||||||
|
libraryfile,
|
||||||
|
source=sources,
|
||||||
|
)
|
||||||
|
|
||||||
|
copy = env.InstallAs("{}/bin/{}/lib{}".format(projectdir, env["platform"], file), library)
|
||||||
|
|
||||||
|
default_args = [library, copy]
|
||||||
|
if localEnv.get("compiledb", False):
|
||||||
|
default_args += [compilation_db]
|
||||||
|
Default(*default_args)
|
||||||
|
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Loading…
Reference in New Issue