Skip to content

Instantly share code, notes, and snippets.

@sheldonth
Last active October 16, 2015 17:49
Show Gist options
  • Save sheldonth/a8346b1ca31ffee82f7a to your computer and use it in GitHub Desktop.
Save sheldonth/a8346b1ca31ffee82f7a to your computer and use it in GitHub Desktop.
Building dynamic link libraries in OSX
{
"targets": [
{
"target_name": "NodeActiveTickAddon",
"sources": [ "NodeActiveTickAddon.cpp",
"NodeActiveTick.cpp",
"Requestor.cpp",
"import/atfeed-cppsdk/example/Helper.cpp",
"AtEnumConverter.cpp",
"protobuf/messages.pb.cc"
],
'include_dirs': [
'./import/atfeed-cppsdk/include/',
"<!(node -e \"require('nan')\")"
],
"cflags": ['-c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG -fexceptions -std=c++11'],
"cflags_cc": ['-c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG -fexceptions'],
'cflags!': [ '-fno-rtti' ],
'cflags_cc!': [ '-fno-rtti' ],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.11',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI': 'YES',
'OTHER_CPLUSPLUSFLAGS': [
],
'OTHER_CFLAGS': [
'<!@(pkg-config --cflags protobuf)'
],
'OTHER_LDFLAGS': [
]
},
'link_settings': {
'libraries': [
'<(module_root_dir)/libActiveTickServerAPI.dylib',
'-lpthread',
'-D_THREAD_SAFE',
'<!@(pkg-config --libs protobuf)'
]
}
}],
['OS=="linux"', {
'link_settings': {
'ldflags': [
],
'libraries':[
'<(module_root_dir)/libActiveTickServerAPI.so',
'-lpthread',
'<!@(pkg-config --libs protobuf)'
]
}
}],
]
}
]
}
@sheldonth
Copy link
Author

So really I suppose my question is how do I set up the Mac build settings so that the library is reliably linked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment