Skip to content

Commit

Permalink
chore: set _type and use it's value to determine defining arch
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Jun 26, 2024
1 parent 0928166 commit d840143
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/libmongocrypt.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function buildLibMongoCrypt(libmongocryptRoot, nodeDepsRoot, option
/**
* Where to install libmongocrypt
* Note that `binding.gyp` will set `./deps/include`
* as an include path if BUILD_TYPE=static
* as an include path if libmongocrypt_link_type=static
*/
DCMAKE_INSTALL_PREFIX: nodeDepsRoot
});
Expand Down Expand Up @@ -286,7 +286,7 @@ async function main() {
}

if (args.dynamic) {
gypDefines.push({ build_type: 'dynamic' });
gypDefines.push({ libmongocrypt_link_type: 'dynamic' });
}

const prebuildOptions =
Expand Down
24 changes: 8 additions & 16 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
'targets': [{
'target_name': 'mongocrypt',
'type': 'loadable_module',
'include_dirs': [
"<!(node -p \"require('node-addon-api').include_dir\")",
],
'variables': {
'ARCH': '<(host_arch)',
'no_macos_universal%': 'false',
'build_type%': 'static',
'libmongocrypt_link_type%': 'static',
},
'sources': [
'addon/mongocrypt.cc'
Expand All @@ -16,20 +16,16 @@
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.12',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
},
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
},
'conditions': [
['OS=="mac"', {
'cflags+': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
}
}],
['OS=="mac" and ARCH=="arm64" and "<(no_macos_universal)"!="true"', {
['OS=="mac"', { 'cflags+': ['-fvisibility=hidden'] }],
['_type!="static_library"', {
'xcode_settings': {
"OTHER_CFLAGS": [
"-arch x86_64",
Expand All @@ -41,14 +37,10 @@
]
}
}],
['build_type=="dynamic"', {
'link_settings': {
'libraries': [
'-lmongocrypt'
]
}
['libmongocrypt_link_type=="dynamic"', {
'link_settings': { 'libraries': ['-lmongocrypt'] }
}],
['build_type!="dynamic"', {
['libmongocrypt_link_type!="dynamic"', {
'conditions': [
['OS!="win"', {
'include_dirs': [
Expand Down

0 comments on commit d840143

Please sign in to comment.