mikeseven / node-glfw

nodejs bindings to GLFW
103 stars 46 forks source link

Remove dependency on AntTweakBar #2

Closed konsumer closed 10 years ago

konsumer commented 11 years ago

npm install node-glfw fails due to this dep.

Especially for use in other things, it would simplify things for me on OSX (it would probably help linux people, too) to not have a dependency on AntTweakBar, as everything else is built-in, and I don't need it.

Would it be reasonable to make node-AntTweakBar a separate project, for people who are not using AntTweakBar?

konsumer commented 11 years ago

Seems like I can make it build by installing dep submodule, and modifying binding.gyp.

It seems like library_dirs is not working as expected, but works fine with -L../deps/PLATFORM works, in libraries.

I installed dep submodule with this:

git submodule init
git submodule update

Here is the edit of binding.gyp:

{
  'variables': {
    'platform': '<(OS)',
  },
  'conditions': [
    # Replace gyp platform with node platform, blech
    ['platform == "mac"', {'variables': {'platform': 'darwin'}}],
    ['platform == "win"', {'variables': {'platform': 'win32'}}],
  ],
  'targets': [
    {
      #'target_name': 'glfw-<(platform)-<(target_arch)',
      'target_name': 'glfw',
      'defines': [
        'VERSION=0.1.2'
      ],
      'sources': [ 'src/atb.cc', 'src/glfw.cc' ],
      'include_dirs': [
        './deps/include',
      ],
      'library_dirs': [
        './deps/<(platform)',
      ],
      'conditions': [
        ['OS=="linux"', {
            'libraries': [
              '-lAntTweakBar',
              '-lglfw',
              '-lGLEW'
            ]
          }
        ],
        ['OS=="mac"', {
            'libraries': [
              '-lAntTweakBar',
              '-lglfw',
              '-lGLEW',
              '-framework OpenGL',
              '-L../deps/darwin'
            ]
          }
        ],
        ['OS=="win"', {
            'libraries': [
              'AntTweakBar64.lib',
              'glew64s.lib', 
              'glfw64dll.lib', 
              'opengl32.lib',
              '-L../deps/win32'
              ],
            'defines' : [
              'WIN32_LEAN_AND_MEAN',
              'VC_EXTRALEAN'
            ]
          },
        ],
      ],
    }
  ]
}

As an alternate route, to make it easier to install by npm, the submodule could be removed, a package.json added to that repo, and a dependency added to node-glfw's package.json.

If this seems like a good plan, I'd be happy to make pull requests for both projects.

mikeseven commented 11 years ago

Yes it is a good idea. The problem is anttweakbar provides realky nice navigation and menu and requires some tight integration with glfw. I'll look if it is possible to separate it.

-- Mike

-------- Original message -------- From: David Konsumer notifications@github.com Date: 08/26/2013 13:05 (GMT-08:00) To: mikeseven/node-glfw node-glfw@noreply.github.com Subject: [node-glfw] Remove dependency on AntTweakBar (#2)

npm install node-glfw fails due to this dep.

Especially for use in other things, it would simplify things for me on OSX (it would probably help linux people, too) to not have a dependency on AntTweakBar, as everything else is built-in, and I don't need it.

Would it be reasonable to make node-AntTweakBar a separate project, for people who are not using AntTweakBar?

— Reply to this email directly or view it on GitHub.

mikeseven commented 11 years ago

Thanks! Please do make a pull request. 

-- Mike

-------- Original message -------- From: David Konsumer notifications@github.com Date: 08/26/2013 13:58 (GMT-08:00) To: mikeseven/node-glfw node-glfw@noreply.github.com Subject: Re: [node-glfw] Remove dependency on AntTweakBar (#2)

Seems like I can make it build by installing dep submodule, and modifying binding.gyp.

It seems like library_dirs is not working as expected, but works fine with -L../deps/PLATFORM works, in libraries.

I installed dep submodule with this:

git submodule init git submodule update Here is the edit of binding.gyp:

{ 'variables': { 'platform': '<(OS)', }, 'conditions': [

Replace gyp platform with node platform, blech

['platform == "mac"', {'variables': {'platform': 'darwin'}}],
['platform == "win"', {'variables': {'platform': 'win32'}}],

], 'targets': [ {

'target_name': 'glfw-<(platform)-<(target_arch)',

  'target_name': 'glfw',
  'defines': [
    'VERSION=0.1.2'
  ],
  'sources': [ 'src/atb.cc', 'src/glfw.cc' ],
  'include_dirs': [
    './deps/include',
  ],
  'library_dirs': [
    './deps/<(platform)',
  ],
  'conditions': [
    ['OS=="linux"', {
        'libraries': [
          '-lAntTweakBar',
          '-lglfw',
          '-lGLEW'
        ]
      }
    ],
    ['OS=="mac"', {
        'libraries': [
          '-lAntTweakBar',
          '-lglfw',
          '-lGLEW',
          '-framework OpenGL',
          '-L../deps/darwin'
        ]
      }
    ],
    ['OS=="win"', {
        'libraries': [
          'AntTweakBar64.lib',
          'glew64s.lib', 
          'glfw64dll.lib', 
          'opengl32.lib',
          '-L../deps/win32'
          ],
        'defines' : [
          'WIN32_LEAN_AND_MEAN',
          'VC_EXTRALEAN'
        ]
      },
    ],
  ],
}

] } As an alternate route, to make it easier to install by npm, the submodule could be removed, a package.json added to that repo, and a dependency added to node-glfw's package.json.

If this seems like a good plan, I'd be happy to make pull requests for both projects.

— Reply to this email directly or view it on GitHub.

konsumer commented 11 years ago

Upon further inspection, I can't seem to actually load the lib after building it (it's looking for ../deps/darwin on load, which is different, in relative terms)

I will inspect closer, and see if I can fix it.