Merge pull request #8 from vaporvee/reorganize-libs
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -19,6 +19,4 @@ build/
|
|||||||
*.lib
|
*.lib
|
||||||
|
|
||||||
#Clean files from the Game SDK
|
#Clean files from the Game SDK
|
||||||
src/discord-game-sdk-cpp/*.cpp
|
src/lib/discord_game_sdk/
|
||||||
src/discord-game-sdk-cpp/*.h
|
|
||||||
src/discord-game-sdk-cpp/*.md
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
|||||||
[submodule "lib/godot-cpp"]
|
[submodule "src/lib/godot-cpp"]
|
||||||
path = lib/godot-cpp
|
path = src/lib/godot-cpp
|
||||||
url = https://github.com/godotengine/godot-cpp
|
url = https://github.com/godotengine/godot-cpp
|
||||||
|
21
.vscode/c_cpp_properties.json
vendored
Normal file
21
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Win32",
|
||||||
|
"includePath": [
|
||||||
|
"${default}"
|
||||||
|
],
|
||||||
|
"defines": [
|
||||||
|
"_DEBUG",
|
||||||
|
"UNICODE",
|
||||||
|
"_UNICODE"
|
||||||
|
],
|
||||||
|
"windowsSdkVersion": "10.0.22621.0",
|
||||||
|
"compilerPath": "cl.exe",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "c++17",
|
||||||
|
"intelliSenseMode": "windows-msvc-x64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
12
.vscode/settings.json
vendored
12
.vscode/settings.json
vendored
@@ -1,10 +1,14 @@
|
|||||||
{
|
{
|
||||||
"C_Cpp.default.includePath": [
|
"C_Cpp.default.includePath": [
|
||||||
"lib/godot-cpp/include",
|
"src/lib/godot-cpp/include",
|
||||||
"lib/godot-cpp/gen/include",
|
"src/lib/godot-cpp/gen/include",
|
||||||
"lib/godot-cpp/gdextension"
|
"src/lib/godot-cpp/gdextension"
|
||||||
],
|
],
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"xlocbuf": "cpp"
|
"xlocbuf": "cpp"
|
||||||
}
|
},
|
||||||
|
"[python]": {
|
||||||
|
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||||
|
},
|
||||||
|
"python.formatting.provider": "none"
|
||||||
}
|
}
|
56
SConstruct
56
SConstruct
@@ -2,40 +2,62 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# Gets the standard flags CC, CCX, etc.
|
# Gets the standard flags CC, CCX, etc.
|
||||||
env = SConscript("lib/godot-cpp/SConstruct")
|
env = SConscript("src/lib/godot-cpp/SConstruct")
|
||||||
|
|
||||||
# Check our platform specifics
|
# Check our platform specifics
|
||||||
if env['platform'] == "macos":
|
if env["platform"] == "macos":
|
||||||
discord_library = 'libdiscord_game_sdk.dylib'
|
discord_library = "libdiscord_game_sdk.dylib"
|
||||||
|
discord_library_second = "libdiscord_game_sdk_aarch64.dylib"
|
||||||
libexportfolder = "/macos/"
|
libexportfolder = "/macos/"
|
||||||
|
|
||||||
elif env['platform'] in ('linuxbsd', 'linux'):
|
elif env["platform"] in ("linuxbsd", "linux"):
|
||||||
discord_library = 'libdiscord_game_sdk.so'
|
discord_library = "libdiscord_game_sdk.so"
|
||||||
|
discord_library_second = ""
|
||||||
libexportfolder = "/linux/"
|
libexportfolder = "/linux/"
|
||||||
|
|
||||||
elif env['platform'] == "windows":
|
elif env["platform"] == "windows":
|
||||||
discord_library = 'discord_game_sdk.dll'
|
discord_library = "discord_game_sdk.dll"
|
||||||
|
discord_library_second = "discord_game_sdk_x86.dll"
|
||||||
libexportfolder = "/windows/"
|
libexportfolder = "/windows/"
|
||||||
|
|
||||||
if env['target'] == "template_debug":
|
if env["target"] == "template_debug":
|
||||||
debugsuffix = "_debug"
|
debugsuffix = "_debug"
|
||||||
else:
|
else:
|
||||||
debugsuffix = ""
|
debugsuffix = ""
|
||||||
|
|
||||||
# make sure our binding library is properly includes
|
# make sure our binding library is properly includes
|
||||||
env.Append(LIBPATH=["lib/discord-game-sdk/"])
|
env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"])
|
||||||
sources = Glob('src/discord-game-sdk-cpp/*.cpp')
|
sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp")
|
||||||
env.Append(CPPPATH=['src/discord-game-sdk-cpp'])
|
env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"])
|
||||||
env.Append(LIBS=["discord_game_sdk"])
|
env.Append(LIBS=["discord_game_sdk"])
|
||||||
|
|
||||||
# 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=['src/'])
|
env.Append(CPPPATH=["src/"])
|
||||||
sources += Glob('src/*.cpp')
|
sources += Glob("src/*.cpp")
|
||||||
|
|
||||||
# The finished exports
|
# The finished exports
|
||||||
library = env.SharedLibrary(target="project/addons/discord-sdk-gd/bin/" +
|
library = env.SharedLibrary(
|
||||||
libexportfolder + "discord_game_sdk_binding" + debugsuffix, source=sources)
|
target="project/addons/discord-sdk-gd/bin/"
|
||||||
env.Depends(library, Command("project/addons/discord-sdk-gd/bin/" + libexportfolder +
|
+ libexportfolder
|
||||||
discord_library, "lib/discord-game-sdk/" + discord_library, Copy("$TARGET", "$SOURCE")))
|
+ "discord_game_sdk_binding"
|
||||||
|
+ debugsuffix,
|
||||||
|
source=sources,
|
||||||
|
)
|
||||||
|
env.Depends(
|
||||||
|
library,
|
||||||
|
Command(
|
||||||
|
"project/addons/discord-sdk-gd/bin/" + libexportfolder + discord_library,
|
||||||
|
"src/lib/discord_game_sdk/bin/" + discord_library,
|
||||||
|
Copy("$TARGET", "$SOURCE"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
env.Depends(
|
||||||
|
library,
|
||||||
|
Command(
|
||||||
|
"project/addons/discord-sdk-gd/bin/" + libexportfolder + discord_library_second,
|
||||||
|
"src/lib/discord_game_sdk/bin/" + discord_library_second,
|
||||||
|
Copy("$TARGET", "$SOURCE"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
Default(library)
|
Default(library)
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Submodule lib/godot-cpp deleted from feaba551b5
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,8 +3,12 @@ extends EditorExportPlugin
|
|||||||
|
|
||||||
func _export_file(path, type, features):
|
func _export_file(path, type, features):
|
||||||
if features[2] == "windows":
|
if features[2] == "windows":
|
||||||
add_shared_object("res://addons/discord-sdk-gd/bin/windows/discord_game_sdk.dll",[],"/")
|
if features[4] == "x86_64":
|
||||||
|
add_shared_object("res://addons/discord-sdk-gd/bin/windows/discord_game_sdk.dll",[],"/")
|
||||||
|
elif features[4] == "x86":
|
||||||
|
add_shared_object("res://addons/discord-sdk-gd/bin/windows/discord_game_sdk_x86.dll",[],"/")
|
||||||
elif features[2] == "linux":
|
elif features[2] == "linux":
|
||||||
add_shared_object("res://addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk.so",[],"/")
|
add_shared_object("res://addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk.so",[],"/")
|
||||||
elif features[2] == "macos":
|
elif features[2] == "macos":
|
||||||
add_shared_object("res://addons/discord-sdk-gd/bin/macos/libdiscord_game_sdk.dylib",[],"/")
|
add_shared_object("res://addons/discord-sdk-gd/bin/macos/libdiscord_game_sdk.dylib",[],"/")
|
||||||
|
add_shared_object("res://addons/discord-sdk-gd/bin/macos/libdiscord_game_sdk_aarch64.dylib",[],"/")
|
||||||
|
43
setup.py
43
setup.py
@@ -3,15 +3,42 @@ from distutils.dir_util import copy_tree
|
|||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
|
||||||
with zipfile.ZipFile("src/discord-game-sdk-cpp/discord_game_sdk.zip", "r") as zip_ref:
|
with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref:
|
||||||
zip_ref.extractall("src/discord-game-sdk-cpp")
|
zip_ref.extractall("src/lib/discord_game_sdk/")
|
||||||
|
|
||||||
copy_tree("src/discord-game-sdk-cpp/cpp", "src/discord-game-sdk-cpp/")
|
copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/")
|
||||||
|
os.rename(
|
||||||
|
"src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib",
|
||||||
|
"src/lib/discord_game_sdk/bin/aarch64/libdiscord_game_sdk_aarch64.dylib",
|
||||||
|
)
|
||||||
|
os.rename(
|
||||||
|
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.dylib",
|
||||||
|
"src/lib/discord_game_sdk/bin/x86_64/libdiscord_game_sdk.dylib",
|
||||||
|
)
|
||||||
|
os.rename(
|
||||||
|
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.so",
|
||||||
|
"src/lib/discord_game_sdk/bin/x86_64/libdiscord_game_sdk.so",
|
||||||
|
)
|
||||||
|
os.rename(
|
||||||
|
"src/lib/discord_game_sdk/bin/x86/discord_game_sdk.dll",
|
||||||
|
"src/lib/discord_game_sdk/bin/x86/discord_game_sdk_x86.dll",
|
||||||
|
)
|
||||||
|
|
||||||
shutil.rmtree("src/discord-game-sdk-cpp/c/", ignore_errors=True)
|
os.rename(
|
||||||
shutil.rmtree("src/discord-game-sdk-cpp/cpp/", ignore_errors=True)
|
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.dll.lib",
|
||||||
shutil.rmtree("src/discord-game-sdk-cpp/csharp/", ignore_errors=True)
|
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.lib",
|
||||||
shutil.rmtree("src/discord-game-sdk-cpp/examples/", ignore_errors=True)
|
)
|
||||||
shutil.rmtree("src/discord-game-sdk-cpp/lib/", ignore_errors=True)
|
copy_tree("src/lib/discord_game_sdk/bin/aarch64/", "src/lib/discord_game_sdk/bin/")
|
||||||
|
copy_tree("src/lib/discord_game_sdk/bin/x86/", "src/lib/discord_game_sdk/bin/")
|
||||||
|
copy_tree("src/lib/discord_game_sdk/bin/x86_64/", "src/lib/discord_game_sdk/bin/")
|
||||||
|
|
||||||
|
shutil.rmtree("src/lib/discord_game_sdk/c/", ignore_errors=True)
|
||||||
|
shutil.rmtree("src/lib/discord_game_sdk/csharp/", ignore_errors=True)
|
||||||
|
shutil.rmtree("src/lib/discord_game_sdk/examples/", ignore_errors=True)
|
||||||
|
shutil.rmtree("src/lib/discord_game_sdk/lib/", ignore_errors=True)
|
||||||
|
shutil.rmtree("src/lib/discord_game_sdk/bin/aarch64/", ignore_errors=True)
|
||||||
|
shutil.rmtree("src/lib/discord_game_sdk/bin/x86/", ignore_errors=True)
|
||||||
|
shutil.rmtree("src/lib/discord_game_sdk/bin/x86_64/", ignore_errors=True)
|
||||||
|
os.remove("src/lib/discord_game_sdk/README.md")
|
||||||
|
|
||||||
os.system("git submodule update --init")
|
os.system("git submodule update --init")
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#include "discordgodot.h"
|
#include "discordgodot.h"
|
||||||
#include "./discord-game-sdk-cpp/discord.h"
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
#include <godot_cpp/classes/editor_plugin.hpp>
|
#include <godot_cpp/classes/editor_plugin.hpp>
|
||||||
#include <godot_cpp/variant/utility_functions.hpp>
|
#include <godot_cpp/variant/utility_functions.hpp>
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#define DISCORDGODOT_H
|
#define DISCORDGODOT_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "discord-game-sdk-cpp/discord.h"
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
#include <godot_cpp/classes/object.hpp>
|
#include <godot_cpp/classes/object.hpp>
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user