@@ -7,7 +7,7 @@ This is a part of [Node3D](https://github.com/node-3d) project.
77[ ![ Build Status] ( https://api.travis-ci.com/node-3d/deps-freeimage-raub.svg?branch=master )] ( https://travis-ci.com/node-3d/deps-freeimage-raub )
88[ ![ CodeFactor] ( https://www.codefactor.io/repository/github/node-3d/deps-freeimage-raub/badge )] ( https://www.codefactor.io/repository/github/node-3d/deps-freeimage-raub )
99
10- > npm i -s deps-freeimage-raub
10+ > npm i deps-freeimage-raub
1111
1212
1313## Synopsis
@@ -22,49 +22,83 @@ binaries through **NPM** for **Node.js** addons.
2222
2323## Usage
2424
25- ### binding.gyp
25+ ### Example binding.gyp
26+
27+ As in [ image-raub] ( https://github.com/node-3d/image-raub/tree/master/src ) Node.js addon.
2628
2729``` javascript
30+ {
2831 ' variables' : {
29- ' freeimage_include' : ' <!(node -p "require(\' deps-freeimage-raub\' ).include")' ,
30- ' freeimage_bin' : ' <!(node -p "require(\' deps-freeimage-raub\' ).bin")' ,
32+ ' bin' : ' <!(node -p "require(\' addon-tools-raub\' ).bin")' ,
33+ ' fi_include' : ' <!(node -p "require(\' deps-freeimage-raub\' ).include")' ,
34+ ' fi_bin' : ' <!(node -p "require(\' deps-freeimage-raub\' ).bin")' ,
3135 },
32- ...
3336 ' targets' : [
3437 {
35- ' target_name' : ' ...' ,
36-
38+ ' target_name' : ' image' ,
39+ ' sources' : [
40+ ' cpp/bindings.cpp' ,
41+ ' cpp/image.cpp' ,
42+ ],
3743 ' include_dirs' : [
38- ' <(freeimage_include )' ,
39- ...
44+ ' <(fi_include )' ,
45+ ' <!@(node -p "require( \' addon-tools-raub \' ).include") ' ,
4046 ],
41-
42- ' library_dirs ' : [ ' <(freeimage_bin) ' ],
43-
47+ ' cflags! ' : [ ' -fno-exceptions ' ],
48+ ' cflags_cc! ' : [' -fno-exceptions ' ],
49+ ' library_dirs ' : [ ' <(fi_bin) ' ],
4450 ' conditions' : [
45-
46- [' OS=="linux"' , {
47- ' libraries' : [
48- ' -Wl,-rpath,<(freeimage_bin)' ,
49- ' <(freeimage_bin)/freeimage.so' ,
50- ...
51- ],
52- }],
53-
54- [' OS=="mac"' , {
55- ' libraries' : [
56- ' -Wl,-rpath,<(freeimage_bin)' ,
57- ' <(freeimage_bin)/freeimage.dylib' ,
58- ...
59- ],
60- }],
61-
62- [' OS=="win"' , {
63- ' libraries' : [ ' FreeImage.lib' , ... ],
64- }],
65-
51+ [
52+ ' OS=="linux"' ,
53+ {
54+ ' libraries' : [
55+ " -Wl,-rpath,'$$ORIGIN'" ,
56+ " -Wl,-rpath,'$$ORIGIN/../node_modules/deps-freeimage-raub/<(bin)'" ,
57+ " -Wl,-rpath,'$$ORIGIN/../../deps-freeimage-raub/<(bin)'" ,
58+ ' <(fi_bin)/libfreeimage.so.3' ,
59+ ],
60+ }
61+ ],
62+ [
63+ ' OS=="mac"' ,
64+ {
65+ ' libraries' : [
66+ ' -Wl,-rpath,@loader_path' ,
67+ ' -Wl,-rpath,@loader_path/../node_modules/deps-freeimage-raub/<(bin)' ,
68+ ' -Wl,-rpath,@loader_path/../../deps-freeimage-raub/<(bin)' ,
69+ ' <(fi_bin)/freeimage.dylib' ,
70+ ],
71+ ' xcode_settings' : {
72+ ' DYLIB_INSTALL_NAME_BASE' : ' @rpath' ,
73+ },
74+ }
75+ ],
76+ [
77+ ' OS=="win"' ,
78+ {
79+ ' libraries' : [' FreeImage.lib' ],
80+ ' defines' : [
81+ ' WIN32_LEAN_AND_MEAN' ,
82+ ' VC_EXTRALEAN'
83+ ],
84+ ' msvs_version' : ' 2013' ,
85+ ' msvs_settings' : {
86+ ' VCCLCompilerTool' : {
87+ ' AdditionalOptions' : [
88+ ' /O2' ,' /Oy' ,' /GL' ,' /GF' ,' /Gm-' ,' /EHsc' ,
89+ ' /MT' ,' /GS' ,' /Gy' ,' /GR-' ,' /Gd' ,
90+ ]
91+ },
92+ ' VCLinkerTool' : {
93+ ' AdditionalOptions' : [' /OPT:REF' ,' /OPT:ICF' ,' /LTCG' ]
94+ },
95+ },
96+ }
97+ ],
6698 ],
6799 },
100+ ]
101+ }
68102```
69103
70104
0 commit comments