nodejs / node-gyp

Node.js native addon build tool
MIT License
9.88k stars 1.79k forks source link

How to compile static library target in simulator #3035

Open Ch3nYuY opened 4 months ago

Ch3nYuY commented 4 months ago

I need to have the simdutf target compiled by my implementation to support the new instructions. That is, add my simulator path before the gcc/g++ command to compile this object.

{
   'variables': {
     'simdutf_sources': [
     'simdutf.cpp',
     ]
   },
   'targets': [
     {
         'target_name': 'simdutf',
         'toolsets': ['host', 'target'],
         'type': 'static_library',
         'include_dirs': ['.'],
         'direct_dependent_settings': {
         'include_dirs': ['.'],
     },
     'sources': [
         '<@(simdutf_sources)',
         ],
     },
   ]
}

If it is an action, I can use the following method to add the path of my simulator before '<(node_js2c_exec)', but for a static library target, I don't know how to modify it.

   'actions': [
   {
     'action_name': 'node_js2c',
     'process_outputs_as_sources': 1,
     'inputs': [
         '<(node_js2c_exec)',
         '<@(library_files)',
         '<@(deps_files)',
         'config.gypi'
      ],
     'outputs': [
       '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
       ],
     'action': [
         'my_simulator_path',
         '<(node_js2c_exec)',
         '<@(_outputs)',
         'lib',
         'config.gypi',
         '<@(deps_files)',
         '<@(linked_module_files)',
     ],