nwjs / nw-gyp

native addon build tool for node-webkit
MIT License
195 stars 50 forks source link

Trouble in building a addon which depends on a dll. #95

Open ngrj opened 8 years ago

ngrj commented 8 years ago

Hello, I'm using sfml library to play audio in nwjs (for some unavoidable reasons, so in future I can use it in childprocess to play audio). I'm facing following issues, please forgive me if it sounds naive but this is my first attempt to write a addon. Os: Windows 10 64 bit Target Build: Nw 0.15.4 32 bit My binding.gyp:

{
    "targets": [
        {
        "target_name": "addon",
        "sources": [ "addon.cc" , "myobject.cc"],
        "include_dirs": [
        "SFML-2.4.0/include/"
        ],
        "defines": [
        "SFML_STATIC"
        ],
        'msvs_settings': {
              'VCCLCompilerTool': {
                 'AdditionalOptions': [
                  '/MD'
                ]
              }
        },
        'link_settings': {
            "library_dirs": ["SFML-2.4.0/lib/"],
            'libraries': [
            'sfml-audio-s.lib',
            'openal32.lib',
            'flac.lib',
            'vorbisenc.lib',
            'vorbisfile.lib',
            'vorbis.lib',
            'ogg.lib',
            'sfml-system-s.lib',
            'winmm.lib'
            ]
        }
        }        
    ]
}

From this url you can see that audio module depends on above libraries , as I'm using static libraries I don't need to add dll but the documentation states that I need openal32.dll(anyway) wherever cpp exe is built. As I didn't include the openal32.dll in my binding.gyp(I don't know where to include it in binding.gyp), I am getting the following error on the below code: player = require(./js/player/build/Release/addon) module.js:610 Uncaught Error: The specified module could not be found. So I tried variety of things , I was finally able to fix this my copy pasting the openal32.dll inside Release folder.

But once I built the nw app using nw builder and ran the built on some other PC, I'm getting the same errror and the build is working fine on development PC . I made some noob attempts by pasting dll file in the root directory of build . I looked up into this thread but didn't found it much helpful 892 I would really appreciate some help/guidance here. Thank You

PS: My nw-gyp command:

nw-gyp configure build --target=0.15.4 --arch=ia32