|
19 | 19 | # [1]: https://gyp.gsrc.io/docs/InputFormatReference.md |
20 | 20 | # [2]: https://gyp.gsrc.io/docs/UserDocumentation.md |
21 | 21 | { |
22 | | - # List of files to include in this file: |
23 | | - "includes": [ |
24 | | - "./include.gypi", |
25 | | - ], |
26 | | - # Define variables to be used throughout the configuration for all targets: |
27 | | - "variables": { |
28 | | - # Target name should match the add-on export name: |
29 | | - "addon_target_name%": "addon", |
30 | | - # Set variables based on the host OS: |
31 | | - "conditions": [ |
32 | | - [ |
33 | | - 'OS=="win"', |
34 | | - { |
35 | | - # Define the object file suffix: |
36 | | - "obj": "obj", |
37 | | - }, |
38 | | - { |
39 | | - # Define the object file suffix: |
40 | | - "obj": "o", |
41 | | - }, |
42 | | - ], # end condition (OS=="win") |
43 | | - ], # end conditions |
44 | | - }, # end variables |
45 | | - # Define compile targets: |
46 | | - "targets": [ |
47 | | - # Target to generate an add-on: |
| 22 | + # List of files to include in this file: |
| 23 | + 'includes': [ |
| 24 | + './include.gypi', |
| 25 | + ], |
| 26 | + |
| 27 | + # Define variables to be used throughout the configuration for all targets: |
| 28 | + 'variables': { |
| 29 | + # Target name should match the add-on export name: |
| 30 | + 'addon_target_name%': 'addon', |
| 31 | + |
| 32 | + # Set variables based on the host OS: |
| 33 | + 'conditions': [ |
| 34 | + [ |
| 35 | + 'OS=="win"', |
48 | 36 | { |
49 | | - # The target name should match the add-on export name: |
50 | | - "target_name": "<(addon_target_name)", |
51 | | - # Define dependencies: |
52 | | - "dependencies": [], |
53 | | - # Define directories which contain relevant include headers: |
54 | | - "include_dirs": [ |
55 | | - # Local include directory: |
56 | | - "<@(include_dirs)", |
57 | | - ], |
58 | | - # List of source files: |
59 | | - "sources": [ |
60 | | - "<@(src_files)", |
61 | | - "src/addon.c", |
62 | | - ], |
63 | | - # Settings which should be applied when a target's object files are used as linker input: |
64 | | - "link_settings": { |
65 | | - # Define libraries: |
66 | | - "libraries": [ |
67 | | - "<@(libraries)", |
68 | | - ], |
69 | | - # Define library directories: |
70 | | - "library_dirs": [ |
71 | | - "<@(library_dirs)", |
72 | | - ], |
73 | | - }, |
74 | | - # C/C++ compiler flags: |
75 | | - "cflags": [ |
76 | | - # Enable commonly used warning options: |
77 | | - "-Wall", |
78 | | - # Aggressive optimization: |
79 | | - "-O3", |
80 | | - ], |
81 | | - # C specific compiler flags: |
82 | | - "cflags_c": [ |
83 | | - # Specify the C standard to which a program is expected to conform: |
84 | | - "-std=c99", |
| 37 | + # Define the object file suffix: |
| 38 | + 'obj': 'obj', |
| 39 | + }, |
| 40 | + { |
| 41 | + # Define the object file suffix: |
| 42 | + 'obj': 'o', |
| 43 | + } |
| 44 | + ], # end condition (OS=="win") |
| 45 | + ], # end conditions |
| 46 | + }, # end variables |
| 47 | + |
| 48 | + # Define compile targets: |
| 49 | + 'targets': [ |
| 50 | + |
| 51 | + # Target to generate an add-on: |
| 52 | + { |
| 53 | + # The target name should match the add-on export name: |
| 54 | + 'target_name': '<(addon_target_name)', |
| 55 | + |
| 56 | + # Define dependencies: |
| 57 | + 'dependencies': [], |
| 58 | + |
| 59 | + # Define directories which contain relevant include headers: |
| 60 | + 'include_dirs': [ |
| 61 | + # Local include directory: |
| 62 | + '<@(include_dirs)', |
| 63 | + ], |
| 64 | + |
| 65 | + # List of source files: |
| 66 | + 'sources': [ |
| 67 | + '<@(src_files)', |
| 68 | + ], |
| 69 | + |
| 70 | + # Settings which should be applied when a target's object files are used as linker input: |
| 71 | + 'link_settings': { |
| 72 | + # Define libraries: |
| 73 | + 'libraries': [ |
| 74 | + '<@(libraries)', |
| 75 | + ], |
| 76 | + |
| 77 | + # Define library directories: |
| 78 | + 'library_dirs': [ |
| 79 | + '<@(library_dirs)', |
| 80 | + ], |
| 81 | + }, |
| 82 | + |
| 83 | + # C/C++ compiler flags: |
| 84 | + 'cflags': [ |
| 85 | + # Enable commonly used warning options: |
| 86 | + '-Wall', |
| 87 | + |
| 88 | + # Aggressive optimization: |
| 89 | + '-O3', |
| 90 | + ], |
| 91 | + |
| 92 | + # C specific compiler flags: |
| 93 | + 'cflags_c': [ |
| 94 | + # Specify the C standard to which a program is expected to conform: |
| 95 | + '-std=c99', |
| 96 | + ], |
| 97 | + |
| 98 | + # C++ specific compiler flags: |
| 99 | + 'cflags_cpp': [ |
| 100 | + # Specify the C++ standard to which a program is expected to conform: |
| 101 | + '-std=c++11', |
| 102 | + ], |
| 103 | + |
| 104 | + # Linker flags: |
| 105 | + 'ldflags': [], |
| 106 | + |
| 107 | + # Apply conditions based on the host OS: |
| 108 | + 'conditions': [ |
| 109 | + [ |
| 110 | + 'OS=="mac"', |
| 111 | + { |
| 112 | + # Linker flags: |
| 113 | + 'ldflags': [ |
| 114 | + '-undefined dynamic_lookup', |
| 115 | + '-Wl,-no-pie', |
| 116 | + '-Wl,-search_paths_first', |
85 | 117 | ], |
86 | | - # C++ specific compiler flags: |
87 | | - "cflags_cpp": [ |
88 | | - # Specify the C++ standard to which a program is expected to conform: |
89 | | - "-std=c++11", |
| 118 | + }, |
| 119 | + ], # end condition (OS=="mac") |
| 120 | + [ |
| 121 | + 'OS!="win"', |
| 122 | + { |
| 123 | + # C/C++ flags: |
| 124 | + 'cflags': [ |
| 125 | + # Generate platform-independent code: |
| 126 | + '-fPIC', |
90 | 127 | ], |
91 | | - # Linker flags: |
92 | | - "ldflags": [], |
93 | | - # Apply conditions based on the host OS: |
94 | | - "conditions": [ |
95 | | - [ |
96 | | - 'OS=="mac"', |
97 | | - { |
98 | | - # Linker flags: |
99 | | - "ldflags": [ |
100 | | - "-undefined dynamic_lookup", |
101 | | - "-Wl,-no-pie", |
102 | | - "-Wl,-search_paths_first", |
103 | | - ], |
104 | | - }, |
105 | | - ], # end condition (OS=="mac") |
106 | | - [ |
107 | | - 'OS!="win"', |
108 | | - { |
109 | | - # C/C++ flags: |
110 | | - "cflags": [ |
111 | | - # Generate platform-independent code: |
112 | | - "-fPIC", |
113 | | - ], |
114 | | - }, |
115 | | - ], # end condition (OS!="win") |
116 | | - ], # end conditions |
117 | | - }, # end target <(addon_target_name) |
118 | | - # Target to copy a generated add-on to a standard location: |
| 128 | + }, |
| 129 | + ], # end condition (OS!="win") |
| 130 | + ], # end conditions |
| 131 | + }, # end target <(addon_target_name) |
| 132 | + |
| 133 | + # Target to copy a generated add-on to a standard location: |
| 134 | + { |
| 135 | + 'target_name': 'copy_addon', |
| 136 | + |
| 137 | + # Declare that the output of this target is not linked: |
| 138 | + 'type': 'none', |
| 139 | + |
| 140 | + # Define dependencies: |
| 141 | + 'dependencies': [ |
| 142 | + # Require that the add-on be generated before building this target: |
| 143 | + '<(addon_target_name)', |
| 144 | + ], |
| 145 | + |
| 146 | + # Define a list of actions: |
| 147 | + 'actions': [ |
119 | 148 | { |
120 | | - "target_name": "copy_addon", |
121 | | - # Declare that the output of this target is not linked: |
122 | | - "type": "none", |
123 | | - # Define dependencies: |
124 | | - "dependencies": [ |
125 | | - # Require that the add-on be generated before building this target: |
126 | | - "<(addon_target_name)", |
127 | | - ], |
128 | | - # Define a list of actions: |
129 | | - "actions": [ |
130 | | - { |
131 | | - "action_name": "copy_addon", |
132 | | - "message": "Copying addon...", |
133 | | - # Explicitly list the inputs in the command-line invocation below: |
134 | | - "inputs": [], |
135 | | - # Declare the expected outputs: |
136 | | - "outputs": [ |
137 | | - "<(addon_output_dir)/<(addon_target_name).node", |
138 | | - ], |
139 | | - # Define the command-line invocation: |
140 | | - "action": [ |
141 | | - "cp", |
142 | | - "<(PRODUCT_DIR)/<(addon_target_name).node", |
143 | | - "<(addon_output_dir)/<(addon_target_name).node", |
144 | | - ], |
145 | | - }, |
146 | | - ], # end actions |
147 | | - }, # end target copy_addon |
148 | | - ], # end targets |
| 149 | + 'action_name': 'copy_addon', |
| 150 | + 'message': 'Copying addon...', |
| 151 | + |
| 152 | + # Explicitly list the inputs in the command-line invocation below: |
| 153 | + 'inputs': [], |
| 154 | + |
| 155 | + # Declare the expected outputs: |
| 156 | + 'outputs': [ |
| 157 | + '<(addon_output_dir)/<(addon_target_name).node', |
| 158 | + ], |
| 159 | + |
| 160 | + # Define the command-line invocation: |
| 161 | + 'action': [ |
| 162 | + 'cp', |
| 163 | + '<(PRODUCT_DIR)/<(addon_target_name).node', |
| 164 | + '<(addon_output_dir)/<(addon_target_name).node', |
| 165 | + ], |
| 166 | + }, |
| 167 | + ], # end actions |
| 168 | + }, # end target copy_addon |
| 169 | + ], # end targets |
149 | 170 | } |
0 commit comments