1 | # This file inherits default targets for Node addons, see https://github.com/nodejs/node-gyp/blob/master/addon.gypi
|
2 | {
|
3 | 'includes': [ 'common.gypi' ], # brings in a default set of options that are inherited from gyp
|
4 | 'variables': { # custom variables we use specific to this file
|
5 | 'error_on_warnings%':'true', # can be overriden by a command line variable because of the % sign using "WERROR" (defined in Makefile)
|
6 | # Use this variable to silence warnings from mason dependencies and from NAN
|
7 | # It's a variable to make easy to pass to
|
8 | # cflags (linux) and xcode (mac)
|
9 | 'system_includes': [
|
10 | "-isystem <(module_root_dir)/<!(node -e \"require('nan')\")",
|
11 | "-isystem <(module_root_dir)/mason_packages/.link/include/",
|
12 | "-isystem <(module_root_dir)/mason_packages/.link/include/freetype2"
|
13 | ],
|
14 | # Flags we pass to the compiler to ensure the compiler
|
15 | # warns us about potentially buggy or dangerous code
|
16 | 'compiler_checks': [
|
17 | '-Wall',
|
18 | '-Wextra',
|
19 | '-Weffc++',
|
20 | '-Wconversion',
|
21 | '-pedantic-errors',
|
22 | '-Wconversion',
|
23 | '-Wshadow',
|
24 | '-Wfloat-equal',
|
25 | '-Wuninitialized',
|
26 | '-Wunreachable-code',
|
27 | '-Wold-style-cast',
|
28 | '-Wno-error=unused-variable',
|
29 | '-Wno-deprecated-declarations'
|
30 | ]
|
31 | },
|
32 | # `targets` is a list of targets for gyp to run.
|
33 | # Different types of targets:
|
34 | # - [executable](https://github.com/mapbox/cpp/blob/master/glossary.md#executable)
|
35 | # - [loadable_module](https://github.com/mapbox/cpp/blob/master/glossary.md#loadable-module)
|
36 | # - [static library](https://github.com/mapbox/cpp/blob/master/glossary.md#static-library)
|
37 | # - [shared library](https://github.com/mapbox/cpp/blob/master/glossary.md#shared-library)
|
38 | # - none: a trick to tell gyp not to run the compiler for a given target.
|
39 | 'targets': [
|
40 | {
|
41 | # This target:
|
42 | # - doesnt build any code (why it's type "none", to tell gyp not to run the compiler)
|
43 | # - runs a script to install mason packages
|
44 | 'target_name': 'action_before_build',
|
45 | 'type': 'none',
|
46 | 'hard_dependency': 1,
|
47 | 'actions': [
|
48 | {
|
49 | 'action_name': 'install_deps',
|
50 | 'inputs': ['./scripts/install_deps.sh'],
|
51 | 'outputs': ['./mason_packages'],
|
52 | 'action': ['./scripts/install_deps.sh']
|
53 | }
|
54 | ]
|
55 | },
|
56 | {
|
57 | # module_name and module_path are both variables passed by node-pre-gyp from package.json
|
58 | 'target_name': '<(module_name)', # sets the name of the binary file
|
59 | 'product_dir': '<(module_path)', # controls where the node binary file gets copied to (./lib/binding/module.node)
|
60 | 'type': 'loadable_module',
|
61 | 'dependencies': [ 'action_before_build' ],
|
62 | # "make" only watches files specified here, and will sometimes cache these files after the first compile.
|
63 | # This cache can sometimes cause confusing errors when removing/renaming/adding new files.
|
64 | # Running "make clean" helps to prevent this "mysterious error by cache" scenario
|
65 | # This also is where the benefits of using a "glob" come into play...
|
66 | # See: https://github.com/mapbox/node-cpp-skel/pull/44#discussion_r122050205
|
67 | 'sources': [
|
68 | 'src/node_fontnik.cpp',
|
69 | 'src/glyphs.cpp'
|
70 | ],
|
71 | "link_settings": {
|
72 | "libraries": [
|
73 | "-lfreetype"
|
74 | ],
|
75 | "library_dirs": [
|
76 | "<(module_root_dir)/mason_packages/.link/lib"
|
77 | ]
|
78 | },
|
79 | 'ldflags': [
|
80 | '-Wl,-z,now',
|
81 | ],
|
82 | 'conditions': [
|
83 | ['error_on_warnings == "true"', {
|
84 | 'cflags_cc' : [ '-Werror' ],
|
85 | 'xcode_settings': {
|
86 | 'OTHER_CPLUSPLUSFLAGS': [ '-Werror' ]
|
87 | }
|
88 | }]
|
89 | ],
|
90 | 'cflags_cc': [
|
91 | '<@(system_includes)',
|
92 | '<@(compiler_checks)'
|
93 | ],
|
94 | 'include_dirs': [
|
95 | './vendor/agg/include',
|
96 | ],
|
97 | 'xcode_settings': {
|
98 | 'OTHER_LDFLAGS':[
|
99 | '-Wl,-bind_at_load'
|
100 | ],
|
101 | 'OTHER_CPLUSPLUSFLAGS': [
|
102 | '<@(system_includes)',
|
103 | '<@(compiler_checks)'
|
104 | ],
|
105 | 'GCC_ENABLE_CPP_RTTI': 'YES',
|
106 | 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
|
107 | 'MACOSX_DEPLOYMENT_TARGET':'10.8',
|
108 | 'CLANG_CXX_LIBRARY': 'libc++',
|
109 | 'CLANG_CXX_LANGUAGE_STANDARD':'c++14',
|
110 | 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0'
|
111 | }
|
112 | }
|
113 | ]
|
114 | }
|