deps-freeimage-raub

Binaries and headers for FreeImage-dependent compilation

Usage no npm install needed!

<script type="module">
  import depsFreeimageRaub from 'https://cdn.skypack.dev/deps-freeimage-raub';
</script>

README

FreeImage binaries

This is a part of Node3D project.

NPM CodeFactor

npm i deps-freeimage-raub

Synopsis

This dependency package is distributing FreeImage 3.18 binaries through NPM for Node.js addons.

  • Platforms (x64): Windows, Linux, OSX.
  • Library: FreeImage.
  • Linking: static dll-type.

Usage

Example binding.gyp

As in image-raub Node.js addon.

{
    'variables': {
        'bin'        : '<!(node -p "require(\'addon-tools-raub\').bin")',
        'fi_include' : '<!(node -p "require(\'deps-freeimage-raub\').include")',
        'fi_bin'     : '<!(node -p "require(\'deps-freeimage-raub\').bin")',
    },
    'targets': [
        {
            'target_name': 'image',
            'sources': [
                'cpp/bindings.cpp',
                'cpp/image.cpp',
            ],
            'include_dirs': [
                '<(fi_include)',
                '<!@(node -p "require(\'addon-tools-raub\').include")',
            ],
            'cflags!': ['-fno-exceptions'],
            'cflags_cc!': ['-fno-exceptions'],
            'library_dirs': ['<(fi_bin)'],
            'conditions': [
                [
                    'OS=="linux"',
                    {
                        'libraries': [
                            "-Wl,-rpath,'$ORIGIN'",
                            "-Wl,-rpath,'$ORIGIN/../node_modules/deps-freeimage-raub/<(bin)'",
                            "-Wl,-rpath,'$ORIGIN/../../deps-freeimage-raub/<(bin)'",
                            '<(fi_bin)/libfreeimage.so.3',
                        ],
                    }
                ],
                [
                    'OS=="mac"',
                    {
                        'libraries': [
                            '-Wl,-rpath,@loader_path',
                            '-Wl,-rpath,@loader_path/../node_modules/deps-freeimage-raub/<(bin)',
                            '-Wl,-rpath,@loader_path/../../deps-freeimage-raub/<(bin)',
                            '<(fi_bin)/freeimage.dylib',
                        ],
                        'xcode_settings': {
                            'DYLIB_INSTALL_NAME_BASE': '@rpath',
                        },
                    }
                ],
                [
                    'OS=="win"',
                    {
                        'libraries': ['FreeImage.lib'],
                        'defines' : [
                            'WIN32_LEAN_AND_MEAN',
                            'VC_EXTRALEAN'
                        ],
                        'msvs_version'  : '2013',
                        'msvs_settings' : {
                            'VCCLCompilerTool' : {
                                'AdditionalOptions' : [
                                    '/O2','/Oy','/GL','/GF','/Gm-','/EHsc',
                                    '/MT','/GS','/Gy','/GR-','/Gd',
                                ]
                            },
                            'VCLinkerTool' : {
                                'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
                            },
                        },
                    }
                ],
            ],
        },
    ]
}

addon.cpp

#include <FreeImage.h>

Refer to FreeImage 3.18 docs.

Legal notice

This software uses the FreeImage open source image library. FreeImage is legally used under the FIPL (FreeImage Public License) version. It is explicitly stated that FreeImage can be used commercially under FIPL.

FreeImage licensing information (a COPY) is given in a separate file, which also can be found on FreeImage's official web-site. The rest of this package is MIT licensed.

Windows, Linux, and OSX binaries are built with GitHub Actions.