Skip to content

Commit

Permalink
macosx-version-min
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Jun 6, 2024
1 parent f1c9b29 commit a388c2d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 77 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const bzip2 = require('node-bzip2');
const compressedBytes = bzip2.compress('Hello, world!', { level: 9, buffering: 'auto' });

// Decompress the data
const decompressedBytes = bzip2.decompress(compressedBytes);
const decompressedBytes = bzip2.decompress(compressedBytes, { small: false });

// Decode the decompressed data as a UTF-8 string
const decompressed = (new TextDecoder('utf8')).decode(decompressedBytes);
Expand All @@ -46,7 +46,7 @@ const bzip2 = require('node-bzip2');
const compressedBytes = await bzip2.compressAsync('Hello, world!', { level: 9, buffering: 'auto' });

// Decompress the data
const decompressedBytes = await bzip2.decompressAsync(compressedBytes);
const decompressedBytes = await bzip2.decompressAsync(compressedBytes, { small: false });

// Decode the decompressed data as a UTF-8 string
const decompressed = (new TextDecoder('utf8')).decode(decompressedBytes);
Expand Down
138 changes: 63 additions & 75 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,76 +1,64 @@
{
'targets': [
{
'target_name': 'node_bzip2',
"actions": [
{
"action_name": "configure_bzip2",
"inputs": [],
"outputs": ["<(INTERMEDIATE_DIR)/bzip2"],
"action": [
"cmake",
"-S",
"lib/bzip2",
"-B",
"<(INTERMEDIATE_DIR)/bzip2",
"-DCMAKE_BUILD_TYPE=Release",
"-DENABLE_LIB_ONLY=1",
"-DENABLE_SHARED_LIB=0",
"-DENABLE_STATIC_LIB=1"
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
]
},
{
"action_name": "build_bzip2",
"inputs": ["<(INTERMEDIATE_DIR)/bzip2"],
"outputs": ["<(INTERMEDIATE_DIR)/bzip2/bz_version.h"],
"action": [
"cmake",
"--build",
"<(INTERMEDIATE_DIR)/bzip2",
"--config=Release"
]
}
],
'sources': [
'src/node_bzip2_wrapper.cpp'
],
'include_dirs': [
'<!(node -e "require(\'nan\')")',
'lib/bzip2'
],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': 1,
'RuntimeLibrary': "MultiThreadedDLL",
'AdditionalOptions': ['/MD']
}
},
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
}
}],

['OS=="win"', {
'defines': [
'_HAS_EXCEPTIONS=1'
]
}],

["OS=='win'", {
"libraries": [
"<(INTERMEDIATE_DIR)/bzip2/Release/bz2_static.lib"
]
}, {
"libraries": [
"<(INTERMEDIATE_DIR)/bzip2/libbz2_static.a"
]
}]
]
}
]
}
"targets": [
{
"target_name": "node_bzip2",
"actions": [
{
"action_name": "configure_bzip2",
"inputs": [],
"outputs": ["<(INTERMEDIATE_DIR)/bzip2"],
"action": [
"cmake",
"-S",
"lib/bzip2",
"-B",
"<(INTERMEDIATE_DIR)/bzip2",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0",
"-DCMAKE_BUILD_TYPE=Release",
"-DENABLE_LIB_ONLY=1",
"-DENABLE_SHARED_LIB=0",
"-DENABLE_STATIC_LIB=1"
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL",
],
},
{
"action_name": "build_bzip2",
"inputs": ["<(INTERMEDIATE_DIR)/bzip2"],
"outputs": ["<(INTERMEDIATE_DIR)/bzip2/bz_version.h"],
"action": [
"cmake",
"--build",
"<(INTERMEDIATE_DIR)/bzip2",
"--config=Release",
],
},
],
"sources": ["src/node_bzip2_wrapper.cpp"],
"include_dirs": ["<!(node -e \"require('nan')\")", "lib/bzip2"],
"cflags!": ["-fno-exceptions"],
"cflags_cc!": ["-fno-exceptions"],
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeLibrary": "MultiThreadedDLL",
"AdditionalOptions": ["/MD"],
}
},
"conditions": [
[
'OS=="mac"',
{
"xcode_settings": {"GCC_ENABLE_CPP_EXCEPTIONS": "YES"},
"cflags": ["-mmacosx-version-min=11.0"],
},
],
['OS=="win"', {"defines": ["_HAS_EXCEPTIONS=1"]}],
[
"OS=='win'",
{"libraries": ["<(INTERMEDIATE_DIR)/bzip2/Release/bz2_static.lib"]},
{"libraries": ["<(INTERMEDIATE_DIR)/bzip2/libbz2_static.a"]},
],
],
}
]
}

0 comments on commit a388c2d

Please sign in to comment.