Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable build dir #263

Closed
vliedel opened this issue Jun 5, 2013 · 16 comments
Closed

Configurable build dir #263

vliedel opened this issue Jun 5, 2013 · 16 comments

Comments

@vliedel
Copy link

vliedel commented Jun 5, 2013

It would be nice if the build dir can be set to something other than "build". Either via the binding.gyp or via an option of the node-gyp commands.

@TooTallNate
Copy link
Contributor

What's your use-case?

@vliedel
Copy link
Author

vliedel commented Jun 6, 2013

We are writing a tool that can compile modules for different middle wares, such as ros, yarp and nodejs. Therefore it is nice to compile them in different build dirs.
See: https://github.com/dobots/aimtools

@vliedel
Copy link
Author

vliedel commented Jun 10, 2013

Do you have an idea how to do it (via command option or binding.gyp and which files to edit)? I'm willing to help, but don't know how to do it in a good way :)

@springmeyer
Copy link
Contributor

Its not the same as pre-defining the build directory, but the node-sqlite3 gyp file shows how to move the targets after the fact: https://github.com/developmentseed/node-sqlite3/blob/master/binding.gyp. I use this to ease packaging whereby it allows safely removing the entire build directory to save space. So, you might be able to use gyp pre or post build actions to accomplish what you want rather than needed to change node-gyp behavior.

@vliedel
Copy link
Author

vliedel commented Jun 19, 2013

Thanks, i didn't know of that option.

@peterbraden
Copy link

Was there an update to this? See also: #631

@springmeyer
Copy link
Contributor

@peterbraden - looks like there has not been any action by anyone to make this configurable. It would not likely be too hard, but it is still hardcoded right here:

var output_dir = 'build'
.

peterbraden added a commit to peterbraden/node-gyp that referenced this issue May 6, 2016
Change with `NODE_GYP_BUILD_DIR` environment variable

Fixes nodejs#263
peterbraden added a commit to peterbraden/node-gyp that referenced this issue Oct 24, 2016
Change with `--build-dir` parameter.

ie:
```
node-gyp --build-dir=foo rebuild
```

PR nodejs#919
Fixes nodejs#263
peterbraden added a commit to peterbraden/node-gyp that referenced this issue Nov 23, 2016
Change with `--build-dir` parameter.

ie:
```
node-gyp --build-dir=foo rebuild
```

PR nodejs#919
Fixes nodejs#263
peterbraden added a commit to peterbraden/node-gyp that referenced this issue Nov 23, 2016
Change with `--build-dir` parameter.

ie:
```
node-gyp --build-dir=foo rebuild
```

PR nodejs#919
Fixes nodejs#263
peterbraden added a commit to peterbraden/node-gyp that referenced this issue Dec 2, 2016
Change with `--build-dir` parameter.

ie:
```
node-gyp --build-dir=foo rebuild
```

PR nodejs#919
Fixes nodejs#263
@LaszloLango
Copy link

It is so sad this has not been fixed since 2013. :(

@ThePrimeagen
Copy link
Member

I too once had this deep desire filling my soul to change my output directory. Upon further research, I have learned it is unsupported. This saddens me. I have laid awake several nights in a row now pondering life's great questions, and this is one of them.

I appreciate you taking the time to read this, and hopefully one day this issue will be dominated in the most satisfying possible way, which is committed, completed, and compiled.

Thanks,

Your loving friend,

Michael, ThePrimeagen, Paulson

@opti21
Copy link

opti21 commented Dec 9, 2019

Literally the worst comment ever, you should be banned

@bnoordhuis
Copy link
Member

Heads up: I'm putting this issue on notice. If you want to see this feature merged, please pick up #919 - it's close but it needs minor fixes and a rebase and its original author no longer has time.

@bnoordhuis
Copy link
Member

It's been a week and no one stepped up so I'm going to close this out. For anyone still wanting to move forward with this, please adopt #919 and we'll take it from there.

@ThePrimeagen
Copy link
Member

The closing of this issue has brought forward feelings I have not felt in many of years. Again, my nights have interrupted with what some describe as fever dreams. Yearning, no... passionately desiring change but ill equipped to make change happen. We have all been here, we have all been at the mercies of life, peering over the edge, but unable to move the stones in our body to make the leap of faith required to make change that will ultimately affect history as we know it.

Unfortunately, this isn't for me, as I only program in Rust, btw. Have you heard rust? Its a type safe, memory safe, blazingly fast compiled language that is pretty new and amazing. You should give it try.

Aka ThePrimeagen

@gorankarlic
Copy link

Output directory is still hard-coded and this 8 year old issue has been closed without a fix - what a disappointment.

let outputDir = 'build'

Hope one day we can build NodeJS add-ons without this Python crap.

@j-refs
Copy link

j-refs commented Mar 16, 2024

Bruh, like why hasn't someone just changed :


let outputDir = "build";

to this:


let outputDir = process.env.NODE_GYP_OUTPUT_DIR ?? "build";

Literally small quick and easy, like I can PR that in minutes. Kind of shocked that hasn't been done yet.

@j-refs
Copy link

j-refs commented Mar 16, 2024

Also, you have it set up to completely ignore the outputDir variable on windows, and default to a separate hard coded path to the same spot?

const buildDir = path.resolve('build')

if (win) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants