jerryscript-project / iotjs

Platform for Internet of Things with JavaScript http://www.iotjs.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I change original module names in modules.json

yyykkkyyy opened this issue · comments

Hi, I really appreciate this amazing library.

By the way, in the docs about writng native module , the sample module name is named "mymodule" in the modules.json.

How can I change this name ?

When I change this name to "test-module" something like that, I cannot compile with ./tools/build.py --external-modules=./my-module --cmake-param=-DENABLE_MODULE_MYMODULE=ON.

I would like to add other original native modules and I add original modules in the modules.json. But the compiler ignore my settings.

How can I add original native modules ?
I'm looking forward to hearing from you,
Thanks.

@yyykkkyyy hi, the name 'mymodule' and 'my-module' are mixed in the example which could be a bit confusing. The name you write in the JSON file will be the ID of your module. The cmake param will be also generated from that. If you use dashes in the name, then they will be replaced to underscores in the cmake param, because cmake variables cannot contain dashes. --external-modules is the directory where your module can be found. If I understrand your problem correctly, then you made the example based on the documentation and only touched the my-module/modules.json file like this:

{
  "modules": {
    "test-module": {
      "native_files": ["my_module.c"],
      "init": "InitMyNativeModule"
    }
  }
}

In that case the following build command should work:
./tools/build.py --external-modules=./my-module --cmake-param=-DENABLE_MODULE_TEST_MODULE=ON

I hope I could help you.

@LaszloLango Hi, I understand your response and how to add new modules.
And I resolved above question.
Thank you very much !