Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
addon: add module_root_dir gyp variable
Browse files Browse the repository at this point in the history
For native modules to use in their gyp files.

It gives the absolute path to the root of the module directory, i.e. where your
main binding.gyp file is located.

This seems helpful for some modules where the build system is more advanced and
using absolute paths is a requirement.
  • Loading branch information
TooTallNate authored and bnoordhuis committed Mar 5, 2012
1 parent e10bd51 commit 1520c7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/gyp_addon
Expand Up @@ -4,8 +4,9 @@ import sys

script_dir = os.path.dirname(__file__)
node_root = os.path.abspath(os.path.join(script_dir, os.pardir))
module_root = os.getcwd()
if sys.platform == 'win32':
output_dir = os.path.join(os.getcwd(), 'build')
output_dir = os.path.join(module_root, 'build')
else:
output_dir = 'build'

Expand All @@ -24,6 +25,7 @@ if __name__ == '__main__':
args.extend(['-Dlibrary=shared_library'])
args.extend(['-Dvisibility=default'])
args.extend(['-Dnode_root_dir=%s' % node_root])
args.extend(['-Dmodule_root_dir=%s' % module_root])
args.extend(['--depth=.']);

# Tell gyp to write the Makefile/Solution files into output_dir
Expand Down

0 comments on commit 1520c7b

Please sign in to comment.