Skip to content

Commit 8ad3900

Browse files
committed
Windows Support.
This commit finally introduces passing Windows support for both Win32 and Win64 operating systems. Note: If you are installing on a modern Windows operating system such as Windows Server 2012 or Windows 8.1 and are using the latest Visual Studio, you may have to toggle the installation from the standard npm install to instead use the following build flag: npm install --msvs_version=2013 All tests should be passing, per the CI.
1 parent cef1521 commit 8ad3900

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ http://www.nodegit.org/nodegit/
2020

2121
## Building and Installing. ##
2222

23-
Dependencies:
23+
Minimum dependencies:
2424

2525
* [Python 2](https://www.python.org/)
2626
* [CMake >= 2.8](http://www.cmake.org/)
@@ -49,18 +49,46 @@ correctly.
4949

5050
### Installing dependencies: ###
5151

52-
Using Brew on OS X:
52+
#### OS X ####
53+
54+
Using Brew:
5355

5456
``` bash
5557
brew install cmake libzip
5658
```
5759

58-
Using APT on Ubuntu:
60+
#### Linux ####
61+
62+
Using APT in Ubuntu:
5963

6064
``` bash
6165
sudo apt-get install cmake libzip-dev build-essential
6266
```
6367

68+
Using Pacman in Arch Linux:
69+
70+
``` bash
71+
sudo pacman -S cmake libzip base-devel
72+
```
73+
74+
#### Windows ####
75+
76+
For Windows users, you will have to install Visual Studio Express. You may
77+
have to add a build flag to the installation process to successfully install.
78+
Try first without, if the build fails, try again with the flag.
79+
80+
*Allegedly the order in which you install Visual Studio could trigger this
81+
error.*
82+
83+
- [Download and install CMake](http://www.cmake.org/cmake/resources/software.html).
84+
- [Download and install Python](https://www.python.org/download/windows)
85+
- [Download and install VS Express](http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop)
86+
87+
``` bash
88+
npm install nodegit --msvs_version=2013
89+
# Or whatever version you've installed.
90+
```
91+
6492
## API examples. ##
6593

6694
### Cloning a repository and reading a file: ###

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ install:
2626
- cmd: SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH%
2727
- cmd: SET PATH=c:\python27;%PATH%
2828
- cmd: npm install -g node-gyp
29-
- npm install
29+
- npm install --msvs_version=2013
3030

3131
test_script:
3232
- node --version

install.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Core Node.js modules.
2+
var os = require('os');
23
var fs = require('fs');
34
var path = require('path');
45
var zlib = require('zlib');
@@ -135,6 +136,11 @@ var dependencies = Q.allSettled([
135136
'-DCMAKE_C_FLAGS=-fPIC',
136137
'-DCMAKE_BUILD_TYPE=RelWithDebInfo'
137138
]);
139+
140+
// If the architecture is 64bit, have to change the generator.
141+
if (os.arch() === 'x64') {
142+
flags.push('-G "Visual Studio 12 Win64"');
143+
}
138144
}
139145

140146
return Q.nfcall(exec, 'cmake .. ' + flags.join(' '), {
@@ -169,7 +175,8 @@ var dependencies = Q.allSettled([
169175
return Q.nfcall(exec, systemPath([
170176
'.', 'node_modules', '.bin', 'node-gyp build'
171177
]), {
172-
cwd: '.'
178+
cwd: '.',
179+
maxBuffer: Number.MAX_VALUE
173180
});
174181
})
175182

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
},
3333
"dependencies": {
3434
"request": "~2.25.0",
35-
"node-gyp": "~0.10.9",
35+
"node-gyp": "~0.13.0",
3636
"tar": "~0.1.18",
3737
"which": "~1.0.5",
3838
"q": "~0.9.6",
39-
"node-gyp": "~0.8.2",
4039
"fs-extra": "0.6.0",
4140
"nan": "0.8.0",
4241
"rimraf": "~2.2.6"

0 commit comments

Comments
 (0)