Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/springmeyer/hello-gyp
Hello world sample for gyp build tool
https://github.com/springmeyer/hello-gyp
Last synced: about 1 month ago
JSON representation
Hello world sample for gyp build tool
- Host: GitHub
- URL: https://github.com/springmeyer/hello-gyp
- Owner: springmeyer
- Created: 2011-11-09T17:49:11.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2019-10-31T13:00:35.000Z (about 5 years ago)
- Last Synced: 2024-11-03T12:31:50.631Z (about 1 month ago)
- Language: C++
- Homepage:
- Size: 1.41 MB
- Stars: 111
- Watchers: 6
- Forks: 24
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - springmeyer/hello-gyp - Hello world sample for gyp build tool (Reference / Miscs)
README
# gyp hello world
[![Build Status](https://secure.travis-ci.org/springmeyer/hello-gyp.svg)](https://travis-ci.org/springmeyer/hello-gyp)
[![Build status](https://ci.appveyor.com/api/projects/status/9b57lcato29u73uv)](https://ci.appveyor.com/project/springmeyer/hello-gyp)
[GYP can Generate Your Projects](http://code.google.com/p/gyp/).
It is a pre-build system that uses a json config to generate optimized
project files for various build tools like make, xcode, visual studio.For example, it is able to generate make or scons files that run fast.
It is also able to generate xcode and visual studio files.
It's a bit like cmake, except: http://code.google.com/p/gyp/wiki/GypVsCMake
This demo shows how to build:
- a hello world c++ library (called 'mylib')
- a command line program that uses/links to it
- a node.js module that depends on mylib via it gyp fileSee also:
- http://n8.io/converting-a-c-library-to-gyp/
- http://code.google.com/p/gyp/wiki/GypTesting## Usage
Just grab this sample project and build it:
git clone git://github.com/springmeyer/hello-gyp.git
cd hello-gyp
makeTo learn more about how to do this manually, or for different plaforms, read on.
## make
The below commands assume you have gyp installed globally. You can do this like:
git clone https://chromium.googlesource.com/external/gyp.git
cd gyp
sudo python setup.py install### build
gyp mylib.gyp --depth=. -f make --generator-output=./build/makefiles
V=1 make -C ./build/makefiles/### test
$ ./build/makefiles/out/Release/myapp
helloAnd the node module:
npm install node-gyp
node_modules/.bin/node-gyp configure buildTest the node module:
$ node -e "console.log(require('./build/Release/modulename.node').hello())"
hello## scons
### build
gyp mylib.gyp --depth=. -f scons --generator-output=./build/sconsfiles
scons -C ./build/sconsfiles/### test
$ ./build/sconsfiles/Release/myapp
hello## xcode
### build
gyp mylib.gyp --depth=. -f xcode --generator-output=./build/xcodefiles
xcodebuild -project ./build/xcodefiles/mylib.xcodeproj### test
# xcode does not respect subdirectory so `build` goes into the main directory
$ ./build/Release/myapp
hello## ninja
Ninja is a build system designed to be ultra fast.
Install it like:
git clone git://github.com/martine/ninja.git
cd ninja
./bootstrap.py
cp ninja /usr/local/bin/Make sure it works:
$ ninja
ninja: no work to do.Now go back to the hello-gyp project folder and build the sample:
gyp mylib.gyp --depth=. -f ninja
ninja -v -C out/Release/ -f build.ninja### test
$ ./out/Release/myapp
hello## Microsft Visual Studio C++ 2010 Expres
Note, this assumes you've downloaded and installed the free 2010 C++ studio.
python gyp/gyp mylib.gyp --depth=. -f msvs -G msvs_version=2010
msbuild mylib.sln### test
c:\hello-gyp>Release\myapp.exe
hello## Others
Other formats are some some gyp-specific debugging output