The wscript method is a bit more… fidlier…
from waflib.TaskGen import feature
platform = self.bld.env['PLATFORM']
configuration = self.bld.env['CONFIGURATION']
#for the windows platform
if platform == 'win_x64' or platform == 'win_x64_vs2015' or platform == 'win_x64_vs2013':
output_folder = self.bld.get_output_folders(platform, configuration)
snd_source_file = self.bld.CreateRootRelativePath('Gems/' + self.name + '/3rdParty/libsndfile/bin/libsndfile-1.dll')
self.create_task('copy_outputs', self.bld.root.make_node(snd_source_file), output_folder.make_node('libsndfile-1.dll'))
# Add custom build options here
features = [ 'copy_libsndfile' ],
includes = [
bld.path.abspath() + '/../3rdParty/libsndfile/include'
lib = [
libpath = [
bld.path.abspath() + '/../3rdParty/libsndfile/lib'
win_features = ['crcfix']
The wscript method is different as it uses the waf system to essentially copy libraries (dll, so, dynlib) to the build directory where the launcher is (or where you want it to be, it’s flexible).
The way this is done is using the feature system that is with the waf system. That’s the top of the part before the def build(bld) section.
Be sure to have each feature definition unique as there will be problems with coping libraries.
The feature in the example above should be self explanatory but the breakdown is as followed:
platform - this variable holds what platform we are building to, same platforms as described in the json explanation, i believe.
configuration - holds which configuration we are building to, debug, profile, performance, release.
output_folder - holds the path to where to copy files to.
Now, to copy files, you first create a root relative path to where the file you want to copy is. The example above is the snd_source_file variable. I use self.name as a way to, hopefully, make sure that where the file is located is relative to the root of the gem’s folder (i.e. if the gem folder name changes, so does self.name, havent tested this and is where the unique feature name comes into play…). So with that, you can change the “/libsndfile/bin/libsndfile-1.dll” section to where you have the library at. Next is to actually copy the file itself. That’s where the self.create_task comes into play. Be sure to adapt it to your code and to change the “libsndfile-1.dll” in the output_folder.make_node to the library you are using.
To enable the usage, be sure to add in “features = [ ‘’ ]” in your bld.DefineGem section.
The rest is standard wscript with the aside that i have linked any 3rd party includes and libraries using bld.path.abspath() to allow for gem folder name changes.
Both methods should work for using 3rd party libraries but i would implement both because it’s been hit and miss with the json version.