https://github.com/insertish/gnucc
🐂 Node.js library for GCC and G++ compilers.
https://github.com/insertish/gnucc
Last synced: 3 months ago
JSON representation
🐂 Node.js library for GCC and G++ compilers.
- Host: GitHub
- URL: https://github.com/insertish/gnucc
- Owner: insertish
- Created: 2019-01-13T13:12:29.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-21T15:03:10.000Z (over 6 years ago)
- Last Synced: 2025-01-01T22:41:00.088Z (5 months ago)
- Language: TypeScript
- Homepage:
- Size: 175 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gnucc
> Node.js library for GCC and G++ compilers
[](https://www.npmjs.com/package/gnucc)
[](https://www.npmjs.com/package/gnucc)
[](https://www.npmjs.com/package/gnucc)
[](https://www.npmjs.com/package/gnucc)- Simplified options and usage
- Types and intellisense support
- Supports compilation of C and C++ files through `gcc` and `g++`
- Also can be easily used with emscripten.## Quick Start
> This method passes files directly, it is recommended you pass options as shown below.
```js
import { gnucc, gcc, gpp } from 'gnucc';gnucc('file.cpp'); // compiles to executable
gnucc(input: string, output?: string, log?: boolean); // uses gcc or g++
gcc(input: string, ...); // uses gcc
gpp(input: string, ...); // uses g++
```## Advanced Usage
> This example shows how to manually set some options.
```js
import { gnucc, OPTIMISATION, WARN } from 'gnucc';await gnucc({
input: 'src/head.cpp',
output: 'out/head',
includes: [
'src/headers'
],
binaries: {
"gcc": 'gcc',
"g++": 'g++'
},
optimisation: OPTIMISATION.HIGH,
warning: [WARN.ALL]
});
```## Automatic Project Compilation
> By enabling project mode gnucc handles a lot of the heavy lifting for you.
- Compiles to .o to reduce compile times in the future.
- Keeps track of timestamps to only compile required files.
- Ensures the correct compilers are used.```js
import { gnucc } from 'gnucc';await gnucc({
project: true,
input: [
'src/example.cc',
'src/tester.cc'
],
objOut: 'out/',
output: 'out/projecttest',
includes: [
'src/headers'
]
});
```