简体   繁体   English

在没有node-gyp的情况下在目标平台上编译C / C ++文件

[英]Compile C/C++ files on target platform without node-gyp

I have some C/C++ code that I need to compile for target platforms (MacOS, Linux flavors, etc). 我有一些C / C ++代码,需要针对目标平台(MacOS,Linux版本等)进行编译。 However, it isn't for Node.js bindings, just some scripts written in C, so I don't absolutely need to use node-gyp to do this. 但是,它不是用于Node.js绑定的,只是一些用C语言编写的脚本,因此我绝对不需要使用node-gyp来执行此操作。

My question is - what is the best way to compile these C scripts if they are packaged in an NPM package. 我的问题是-如果将这些C脚本打包在NPM软件包中,那么编译它们的最佳方法是什么? Should I just use the postinstall script to compile the C code? 我应该只使用postinstall脚本来编译C代码吗? What is best practice here? 什么是最佳做法?

What is the best way to compile these C scripts if they are packaged in an NPM package 如果将这些C脚本打包在NPM软件包中,那么编译它们的最佳方法是什么?

This tasks generally solved by crossplatform build systems like automake, cmake, qmake and so on. 通常通过跨平台构建系统(例如automake,cmake,qmake等)解决此任务。

Create an independent c++ package with configured build environment. 使用配置的构建环境创建一个独立的c ++软件包。 Add to npm package checking that your program compiled from c++ is available. 添加到npm软件包中,以检查从c ++编译的程序是否可用。 Show error message if it is not available and notice where to find it and mention in doc about how to compile and install. 如果错误消息不可用,请显示错误消息,并注意在哪里可以找到它,并在文档中提及有关如何编译和安装的错误消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM