Skip to content

Commit a1546ab

Browse files
Shabareesh ShettyShabareesh Shetty
authored andcommitted
chore: update include.gypi
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 8a267f4 commit a1546ab

File tree

1 file changed

+39
-234
lines changed

1 file changed

+39
-234
lines changed
Lines changed: 39 additions & 234 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @license Apache-2.0
22
#
3-
# Copyright (c) 2025 The Stdlib Authors.
3+
# Copyright (c) 2024 The Stdlib Authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -14,252 +14,57 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# A `.gyp` file for building a Node.js native add-on.
17+
# A GYP include file for building a Node.js native add-on.
18+
#
19+
# Note that nesting variables is required due to how GYP processes a configuration. Any variables defined within a nested 'variables' section is defined in the outer scope. Thus, conditions in the outer variable scope are free to use these variables without running into "variable undefined" errors.
20+
#
21+
# Main documentation:
1822
#
1923
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
2024
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
25+
#
26+
# Variable nesting hacks:
27+
#
28+
# [3]: https://chromium.googlesource.com/external/skia/gyp/+/master/common_variables.gypi
29+
# [4]: https://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004
2130
{
22-
# List of files to include in this file:
23-
'includes': [
24-
'./include.gypi',
25-
],
26-
2731
# Define variables to be used throughout the configuration for all targets:
2832
'variables': {
29-
# Target name should match the add-on export name:
30-
'addon_target_name%': 'addon',
31-
32-
# Fortran compiler (to override -Dfortran_compiler=<compiler>):
33-
'fortran_compiler%': 'gfortran',
33+
'variables': {
34+
# Host BLAS library (to override -Dblas=<blas>):
35+
'blas%': '',
3436

35-
# Fortran compiler flags:
36-
'fflags': [
37-
# Specify the Fortran standard to which a program is expected to conform:
38-
'-std=f95',
37+
# Path to BLAS library (to override -Dblas_dir=<path>):
38+
'blas_dir%': '',
39+
}, # end variables
3940

40-
# Indicate that the layout is free-form source code:
41-
'-ffree-form',
41+
# Source directory:
42+
'src_dir': './src',
4243

43-
# Aggressive optimization:
44-
'-O3',
45-
46-
# Enable commonly used warning options:
47-
'-Wall',
48-
49-
# Warn if source code contains problematic language features:
50-
'-Wextra',
51-
52-
# Warn if a procedure is called without an explicit interface:
53-
'-Wimplicit-interface',
44+
# Include directories:
45+
'include_dirs': [
46+
'<@(blas_dir)',
47+
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
48+
],
5449

55-
# Do not transform names of entities specified in Fortran source files by appending underscores (i.e., don't mangle names, thus allowing easier usage in C wrappers):
56-
'-fno-underscoring',
50+
# Add-on destination directory:
51+
'addon_output_dir': './src',
5752

58-
# Warn if source code contains Fortran 95 extensions and C-language constructs:
59-
'-pedantic',
53+
# Source files:
54+
'src_files': [
55+
'<(src_dir)/addon.c',
56+
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
57+
],
6058

61-
# Compile but do not link (output is an object file):
62-
'-c',
59+
# Library dependencies:
60+
'libraries': [
61+
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
6362
],
6463

65-
# Set variables based on the host OS:
66-
'conditions': [
67-
[
68-
'OS=="win"',
69-
{
70-
# Define the object file suffix:
71-
'obj': 'obj',
72-
},
73-
{
74-
# Define the object file suffix:
75-
'obj': 'o',
76-
}
77-
], # end condition (OS=="win")
78-
], # end conditions
64+
# Library directories:
65+
'library_dirs': [
66+
'<@(blas_dir)',
67+
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
68+
],
7969
}, # end variables
80-
81-
# Define compile targets:
82-
'targets': [
83-
84-
# Target to generate an add-on:
85-
{
86-
# The target name should match the add-on export name:
87-
'target_name': '<(addon_target_name)',
88-
89-
# Define dependencies:
90-
'dependencies': [],
91-
92-
# Define directories which contain relevant include headers:
93-
'include_dirs': [
94-
# Local include directory:
95-
'<@(include_dirs)',
96-
],
97-
98-
# List of source files:
99-
'sources': [
100-
'<@(src_files)',
101-
],
102-
103-
# Settings which should be applied when a target's object files are used as linker input:
104-
'link_settings': {
105-
# Define libraries:
106-
'libraries': [
107-
'<@(libraries)',
108-
],
109-
110-
# Define library directories:
111-
'library_dirs': [
112-
'<@(library_dirs)',
113-
],
114-
},
115-
116-
# C/C++ compiler flags:
117-
'cflags': [
118-
# Enable commonly used warning options:
119-
'-Wall',
120-
121-
# Aggressive optimization:
122-
'-O3',
123-
],
124-
125-
# C specific compiler flags:
126-
'cflags_c': [
127-
# Specify the C standard to which a program is expected to conform:
128-
'-std=c99',
129-
],
130-
131-
# C++ specific compiler flags:
132-
'cflags_cpp': [
133-
# Specify the C++ standard to which a program is expected to conform:
134-
'-std=c++11',
135-
],
136-
137-
# Linker flags:
138-
'ldflags': [],
139-
140-
# Apply conditions based on the host OS:
141-
'conditions': [
142-
[
143-
'OS=="mac"',
144-
{
145-
# Linker flags:
146-
'ldflags': [
147-
'-undefined dynamic_lookup',
148-
'-Wl,-no-pie',
149-
'-Wl,-search_paths_first',
150-
],
151-
},
152-
], # end condition (OS=="mac")
153-
[
154-
'OS!="win"',
155-
{
156-
# C/C++ flags:
157-
'cflags': [
158-
# Generate platform-independent code:
159-
'-fPIC',
160-
],
161-
},
162-
], # end condition (OS!="win")
163-
], # end conditions
164-
165-
# Define custom build actions for particular inputs:
166-
'rules': [
167-
{
168-
# Define a rule for processing Fortran files:
169-
'extension': 'f',
170-
171-
# Define the pathnames to be used as inputs when performing processing:
172-
'inputs': [
173-
# Full path of the current input:
174-
'<(RULE_INPUT_PATH)'
175-
],
176-
177-
# Define the outputs produced during processing:
178-
'outputs': [
179-
# Store an output object file in a directory for placing intermediate results (only accessible within a single target):
180-
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).<(obj)'
181-
],
182-
183-
# Define the rule for compiling Fortran based on the host OS:
184-
'conditions': [
185-
[
186-
'OS=="win"',
187-
188-
# Rule to compile Fortran on Windows:
189-
{
190-
'rule_name': 'compile_fortran_windows',
191-
'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Windows...',
192-
193-
'process_outputs_as_sources': 0,
194-
195-
# Define the command-line invocation:
196-
'action': [
197-
'<(fortran_compiler)',
198-
'<@(fflags)',
199-
'<@(_inputs)',
200-
'-o',
201-
'<@(_outputs)',
202-
],
203-
},
204-
205-
# Rule to compile Fortran on non-Windows:
206-
{
207-
'rule_name': 'compile_fortran_linux',
208-
'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Linux...',
209-
210-
'process_outputs_as_sources': 1,
211-
212-
# Define the command-line invocation:
213-
'action': [
214-
'<(fortran_compiler)',
215-
'<@(fflags)',
216-
'-fPIC', # generate platform-independent code
217-
'<@(_inputs)',
218-
'-o',
219-
'<@(_outputs)',
220-
],
221-
}
222-
], # end condition (OS=="win")
223-
], # end conditions
224-
}, # end rule (extension=="f")
225-
], # end rules
226-
}, # end target <(addon_target_name)
227-
228-
# Target to copy a generated add-on to a standard location:
229-
{
230-
'target_name': 'copy_addon',
231-
232-
# Declare that the output of this target is not linked:
233-
'type': 'none',
234-
235-
# Define dependencies:
236-
'dependencies': [
237-
# Require that the add-on be generated before building this target:
238-
'<(addon_target_name)',
239-
],
240-
241-
# Define a list of actions:
242-
'actions': [
243-
{
244-
'action_name': 'copy_addon',
245-
'message': 'Copying addon...',
246-
247-
# Explicitly list the inputs in the command-line invocation below:
248-
'inputs': [],
249-
250-
# Declare the expected outputs:
251-
'outputs': [
252-
'<(addon_output_dir)/<(addon_target_name).node',
253-
],
254-
255-
# Define the command-line invocation:
256-
'action': [
257-
'cp',
258-
'<(PRODUCT_DIR)/<(addon_target_name).node',
259-
'<(addon_output_dir)/<(addon_target_name).node',
260-
],
261-
},
262-
], # end actions
263-
}, # end target copy_addon
264-
], # end targets
26570
}

0 commit comments

Comments
 (0)