diff --git a/SConstruct b/SConstruct index e8d4286..e60856b 100644 --- a/SConstruct +++ b/SConstruct @@ -1,8 +1,20 @@ -#!/usr/bin/env python +#!python import os -import sys -env = SConscript("./godot-cpp/SConstruct") +opts = Variables([], ARGUMENTS) + +# Gets the standard flags CC, CCX, etc. +env = SConscript("godot-cpp/SConstruct") + +# Define our options +opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'project/addons/discord-rpc-gd/bin')) +opts.Add(PathVariable('target_name', 'The library name.', 'discord_game_sdk', PathVariable.PathAccept)) + +# Local dependency paths, adapt them to your setup +discord_lib_path = "project/addons/discord-rpc-gd/bin" + +# Updates the environment with the option variables. +opts.Update(env) # For the reference: # - CCFLAGS are compilation flags shared between C and C++ @@ -12,25 +24,38 @@ env = SConscript("./godot-cpp/SConstruct") # - CPPDEFINES are for pre-processor defines # - LINKFLAGS are for linking flags +# Check our platform specifics +if env['platform'] == "macos": + # Set the correct library + discord_library = 'discord_game_sdk.dylib' + +elif env['platform'] in ('linuxbsd', 'linux'): + # Set correct library + discord_library = 'discord_game_sdk.so' + +elif env['platform'] == "windows": + # 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.Append(ENV=os.environ) + + # Set correct library + discord_library = 'discord_game_sdk.dll' + +# make sure our binding library is properly includes +env.Append(LIBPATH=[discord_lib_path]) +env.Append(CPPPATH=['src\discord-game-sdk-cpp']) +env.Append(LIBS=[ + discord_library.replace(".dll", "") +]) + # tweak this if you want to use different folders, or more folders, to store your source code in. +env.Append(CPPPATH=['src/']) +sources = Glob('src/*.cpp') -env.Append(CPPPATH=["src/"]) -env.Append(LIBS=["discord_game_sdk"]) -env.Append(LIBPATH=["project/addons/discord-rpc-gd/lib"]) - -sources = Glob("src/*.cpp") -if env["platform"] == "macos": - library = env.SharedLibrary( - "project/addons/discord-rpc-gd/bin/libgd-discordrpc.{}.{}.framework/discord-rpc-gd.{}.{}".format( - env["platform"], env["target"], env["platform"], env["target"] - ), - source=sources, - ) -else: - library = env.SharedLibrary( - "project/addons/discord-rpc-gd/bin/libgd-discordrpc{}{}".format(env["suffix"], env["SHLIBSUFFIX"]), - source=sources, - ) - +library = env.SharedLibrary(target=env['target_path'] + env['target_name'] + env["suffix"] + env["SHLIBSUFFIX"], source=sources) +env.Depends(library, Command("project/addons/discord-rpc-gd/bin" + discord_library, discord_lib_path + "/" + discord_library, Copy("$TARGET", "$SOURCE"))) Default(library) + +# Generates help for the -h scons option. +Help(opts.GenerateHelpText(env)) \ No newline at end of file diff --git a/project/addons/discord-rpc-gd/discord-rpc-gd.gdextension b/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension similarity index 62% rename from project/addons/discord-rpc-gd/discord-rpc-gd.gdextension rename to project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension index 3280b50..0ed1a6e 100644 --- a/project/addons/discord-rpc-gd/discord-rpc-gd.gdextension +++ b/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension @@ -20,3 +20,22 @@ android.debug.x86_64 = "bin/libgd-discordrpc.android.template_debug.x86_64.so" android.release.x86_64 = "bin/libgd-discordrpc.android.template_release.x86_64.so" android.debug.arm64 = "bin/libgd-discordrpc.android.template_debug.arm64.so" android.release.arm64 = "bin/libgd-discordrpc.android.template_release.arm64.so" + +[dependencies] + +macos.debug = "bin/discord_game_sdk.framework" +macos.release = "bin/discord_game_sdk.framework" +windows.debug.x86_32 = "bin/discord_game_sdk.dll" +windows.release.x86_32 = "bin/discord_game_sdk.dll" +windows.debug.x86_64 = "bin/discord_game_sdk.dll" +windows.release.x86_64 = "bin/discord_game_sdk.dll" +linux.debug.x86_64 = "bin/ldiscord_game_sdk.so" +linux.release.x86_64 = "bin/discord_game_sdk.so" +linux.debug.arm64 = "bin/discord_game_sdk.so" +linux.release.arm64 = "bin/discord_game_sdk.so" +linux.debug.rv64 = "bin/discord_game_sdk.so" +linux.release.rv64 = "bin/discord_game_sdk.so" +android.debug.x86_64 = "bin/discord_game_sdk.so" +android.release.x86_64 = "bin/discord_game_sdk.so" +android.debug.arm64 = "bin/discord_game_sdk.so" +android.release.arm64 = "bin/discord_game_sdk.so" \ No newline at end of file diff --git a/project/addons/discord-rpc-gd/lib/discord_game_sdk.bundle b/project/addons/discord-rpc-gd/bin/discord_game_sdk.bundle similarity index 100% rename from project/addons/discord-rpc-gd/lib/discord_game_sdk.bundle rename to project/addons/discord-rpc-gd/bin/discord_game_sdk.bundle diff --git a/project/addons/discord-rpc-gd/lib/discord_game_sdk.dll b/project/addons/discord-rpc-gd/bin/discord_game_sdk.dll similarity index 100% rename from project/addons/discord-rpc-gd/lib/discord_game_sdk.dll rename to project/addons/discord-rpc-gd/bin/discord_game_sdk.dll diff --git a/project/addons/discord-rpc-gd/lib/discord_game_sdk.dylib b/project/addons/discord-rpc-gd/bin/discord_game_sdk.dylib similarity index 100% rename from project/addons/discord-rpc-gd/lib/discord_game_sdk.dylib rename to project/addons/discord-rpc-gd/bin/discord_game_sdk.dylib diff --git a/project/addons/discord-rpc-gd/lib/discord_game_sdk.lib b/project/addons/discord-rpc-gd/bin/discord_game_sdk.lib similarity index 100% rename from project/addons/discord-rpc-gd/lib/discord_game_sdk.lib rename to project/addons/discord-rpc-gd/bin/discord_game_sdk.lib diff --git a/project/addons/discord-rpc-gd/lib/discord_game_sdk.so b/project/addons/discord-rpc-gd/bin/discord_game_sdk.so similarity index 100% rename from project/addons/discord-rpc-gd/lib/discord_game_sdk.so rename to project/addons/discord-rpc-gd/bin/discord_game_sdk.so diff --git a/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.dll b/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.dll deleted file mode 100644 index 2cca7ff..0000000 Binary files a/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.dll and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.exp b/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.exp deleted file mode 100644 index ff55646..0000000 Binary files a/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.exp and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.lib b/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.lib deleted file mode 100644 index ee7f576..0000000 Binary files a/project/addons/discord-rpc-gd/bin/libgd-discordrpc.windows.template_debug.x86_64.lib and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bindiscord_game_sdk.dll b/project/addons/discord-rpc-gd/bindiscord_game_sdk.dll new file mode 100644 index 0000000..be946ea Binary files /dev/null and b/project/addons/discord-rpc-gd/bindiscord_game_sdk.dll differ diff --git a/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.dll b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.dll new file mode 100644 index 0000000..f065d06 Binary files /dev/null and b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.dll differ diff --git a/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.exp b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.exp new file mode 100644 index 0000000..e410a84 Binary files /dev/null and b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.exp differ diff --git a/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.lib b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.lib new file mode 100644 index 0000000..dfaf504 Binary files /dev/null and b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_debug.x86_64.lib differ diff --git a/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.dll b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.dll new file mode 100644 index 0000000..05f61fb Binary files /dev/null and b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.dll differ diff --git a/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.exp b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.exp new file mode 100644 index 0000000..9c1c79a Binary files /dev/null and b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.exp differ diff --git a/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.lib b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.lib new file mode 100644 index 0000000..3a0915c Binary files /dev/null and b/project/addons/discord-rpc-gd/bindiscord_game_sdk.windows.template_release.x86_64.lib differ diff --git a/project/assets/Banner_v1.png b/project/assets/Banner_v1.png deleted file mode 100644 index 952deba..0000000 Binary files a/project/assets/Banner_v1.png and /dev/null differ diff --git a/project/assets/Banner_v1.png.import b/project/assets/Banner_v1.png.import deleted file mode 100644 index eb75bd9..0000000 --- a/project/assets/Banner_v1.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://cwwdhvaogsdtb" -path="res://.godot/imported/Banner_v1.png-5ed14d0906a04274d823c02cd90d1aad.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/Banner_v1.png" -dest_files=["res://.godot/imported/Banner_v1.png-5ed14d0906a04274d823c02cd90d1aad.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/project/assets/Logo_V2.png b/project/assets/Logo_V2.png deleted file mode 100644 index dbdcf65..0000000 Binary files a/project/assets/Logo_V2.png and /dev/null differ diff --git a/project/assets/Logo_V2.png.import b/project/assets/Logo_V2.png.import deleted file mode 100644 index f4a7dbf..0000000 --- a/project/assets/Logo_V2.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://d3prnkmtfx1nq" -path="res://.godot/imported/Logo_V2.png-3c17f898c9e359ffd20bde3cd3e1cd33.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/Logo_V2.png" -dest_files=["res://.godot/imported/Logo_V2.png-3c17f898c9e359ffd20bde3cd3e1cd33.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/project/assets/Logo_V2_Clyde.png b/project/assets/Logo_V2_Clyde.png deleted file mode 100644 index 4409f7e..0000000 Binary files a/project/assets/Logo_V2_Clyde.png and /dev/null differ diff --git a/project/assets/Logo_V2_Clyde.png.import b/project/assets/Logo_V2_Clyde.png.import deleted file mode 100644 index 67ac02c..0000000 --- a/project/assets/Logo_V2_Clyde.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://vj51qej4ohom" -path="res://.godot/imported/Logo_V2_Clyde.png-2f34f333e2fac3b95f8c8c6a41e767f0.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/Logo_V2_Clyde.png" -dest_files=["res://.godot/imported/Logo_V2_Clyde.png-2f34f333e2fac3b95f8c8c6a41e767f0.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/src/main.cpp b/src/main.cpp index e7faeb0..165efe1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,9 +4,8 @@ #include "./discord-game-sdk-cpp/discord.h" using namespace godot; -using namespace discord; -Core *core{}; +// discord::Core *core{}; void DiscordRPC::_bind_methods() { @@ -25,12 +24,13 @@ DiscordRPC::~DiscordRPC() void DiscordRPC::_ready() { - /*discord::Result res = Core::Create(53908232506183680, DiscordCreateFlags_NoRequireDiscord, &core); - Activity activity{}; - UtilityFunctions::print(core); + /*auto result = discord::Core::Create(461618159171141643, DiscordCreateFlags_Default, &core); + discord::Activity activity{}; activity.SetState("Testing"); activity.SetDetails("Fruit Loops"); - core->ActivityManager().UpdateActivity(activity, [](Result res) {});*/ + core->ActivityManager().UpdateActivity(activity, [](discord::Result result) { + + });*/ } void DiscordRPC::_process(float delta) diff --git a/src/main.windows.template_debug.x86_64.obj b/src/main.windows.template_debug.x86_64.obj index 5d3ca62..d4277cd 100644 Binary files a/src/main.windows.template_debug.x86_64.obj and b/src/main.windows.template_debug.x86_64.obj differ diff --git a/src/main.windows.template_release.x86_64.obj b/src/main.windows.template_release.x86_64.obj new file mode 100644 index 0000000..40596d8 Binary files /dev/null and b/src/main.windows.template_release.x86_64.obj differ diff --git a/src/register_types.windows.template_debug.x86_64.obj b/src/register_types.windows.template_debug.x86_64.obj index bfb53e4..11354d2 100644 Binary files a/src/register_types.windows.template_debug.x86_64.obj and b/src/register_types.windows.template_debug.x86_64.obj differ diff --git a/src/register_types.windows.template_release.x86_64.obj b/src/register_types.windows.template_release.x86_64.obj new file mode 100644 index 0000000..5a9c6f4 Binary files /dev/null and b/src/register_types.windows.template_release.x86_64.obj differ