mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure versions prop detects use of global libvips
This commit is contained in:
@@ -111,6 +111,9 @@
|
||||
# Use pkg-config for include and lib
|
||||
'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g)'],
|
||||
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)'],
|
||||
'defines': [
|
||||
'SHARP_USE_GLOBAL_LIBVIPS'
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "linux"', {
|
||||
'defines': [
|
||||
|
||||
@@ -92,9 +92,18 @@ Napi::Value simd(const Napi::CallbackInfo& info) {
|
||||
Get libvips version
|
||||
*/
|
||||
Napi::Value libvipsVersion(const Napi::CallbackInfo& info) {
|
||||
char version[9];
|
||||
std::snprintf(version, sizeof(version), "%d.%d.%d", vips_version(0), vips_version(1), vips_version(2));
|
||||
return Napi::String::New(info.Env(), version);
|
||||
Napi::Env env = info.Env();
|
||||
Napi::Object version = Napi::Object::New(env);
|
||||
|
||||
char semver[9];
|
||||
std::snprintf(semver, sizeof(semver), "%d.%d.%d", vips_version(0), vips_version(1), vips_version(2));
|
||||
version.Set("semver", Napi::String::New(env, semver));
|
||||
#ifdef SHARP_USE_GLOBAL_LIBVIPS
|
||||
version.Set("isGlobal", Napi::Boolean::New(env, true));
|
||||
#else
|
||||
version.Set("isGlobal", Napi::Boolean::New(env, false));
|
||||
#endif
|
||||
return version;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user