cleaned and organized files
This commit is contained in:
49
SConstruct
49
SConstruct
@@ -1,63 +1,40 @@
|
||||
#!python
|
||||
import os
|
||||
|
||||
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 = "lib/discord-game-sdk"
|
||||
|
||||
# Updates the environment with the option variables.
|
||||
opts.Update(env)
|
||||
|
||||
# For the 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
|
||||
|
||||
# Check our platform specifics
|
||||
if env['platform'] == "macos":
|
||||
# Set the correct library
|
||||
discord_library = 'discord_game_sdk.dylib'
|
||||
libexportfolder = "/macos/"
|
||||
|
||||
elif env['platform'] in ('linuxbsd', 'linux'):
|
||||
# Set correct library
|
||||
discord_library = 'discord_game_sdk.so'
|
||||
libexportfolder = "/linux/"
|
||||
|
||||
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'
|
||||
libexportfolder = "/windows/"
|
||||
|
||||
if env['target'] == "template_debug":
|
||||
debugsuffix = "_debug"
|
||||
else:
|
||||
debugsuffix = ""
|
||||
|
||||
# make sure our binding library is properly includes
|
||||
env.Append(LIBPATH=[discord_lib_path])
|
||||
env.Append(LIBPATH=["lib/discord-game-sdk/"])
|
||||
sources = Glob('src/discord-game-sdk-cpp/*.cpp')
|
||||
env.Append(CPPPATH=['src/discord-game-sdk-cpp'])
|
||||
env.Append(LIBS=[
|
||||
discord_library.replace(".dll", "")
|
||||
])
|
||||
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')
|
||||
|
||||
library = env.SharedLibrary(target="project/addons/discord-rpc-gd/bin/discordrpc" + 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")))
|
||||
#The finished exports
|
||||
library = env.SharedLibrary(target="project/addons/discord-rpc-gd/bin/" + libexportfolder + "discord_game_sdk_binding" + debugsuffix, source=sources)
|
||||
env.Depends(library, Command("project/addons/discord-rpc-gd/bin/" + libexportfolder + discord_library, "lib/discord-game-sdk/" + discord_library, Copy("$TARGET", "$SOURCE")))
|
||||
|
||||
Default(library)
|
||||
|
||||
# Generates help for the -h scons option.
|
||||
Help(opts.GenerateHelpText(env))
|
||||
Default(library)
|
Reference in New Issue
Block a user