Build the node addon as a static library
This commit is contained in:
parent
0ff7357cc3
commit
28924b4f99
89
binding.gyp
89
binding.gyp
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"variables": {
|
||||
"realm_node_build_as_library%": "0"
|
||||
},
|
||||
"includes": [
|
||||
"src/node/gyp/target_defaults.gypi",
|
||||
"src/node/gyp/realm.gyp"
|
||||
|
@ -10,37 +13,39 @@
|
|||
"object-store"
|
||||
],
|
||||
"sources": [
|
||||
"src/node/node_sync_logger.cpp",
|
||||
"src/node/node_init.cpp",
|
||||
"src/node/platform.cpp",
|
||||
"src/js_realm.cpp"
|
||||
],
|
||||
"include_dirs": [
|
||||
"src"
|
||||
],
|
||||
"link_settings": {
|
||||
"ldflags": [
|
||||
"-Wl,--whole-archive,-lrealm-node,--no-whole-archive"
|
||||
]
|
||||
},
|
||||
"xcode_settings": {
|
||||
"OTHER_LDFLAGS": [ "-all_load", "-lrealm-node" ]
|
||||
}
|
||||
"conditions": [
|
||||
["realm_node_build_as_library", {
|
||||
"type": "static_library",
|
||||
"export_dependent_settings": [ "object-store" ]
|
||||
}, {
|
||||
"sources": [
|
||||
"src/node/node_init.cpp"
|
||||
]
|
||||
}],
|
||||
["realm_enable_sync", {
|
||||
"sources": [
|
||||
"src/node/node_sync_logger.cpp"
|
||||
]
|
||||
}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"variables": {
|
||||
"object-store-include-dirs": [
|
||||
"src/object-store/src",
|
||||
"src/object-store/src/impl",
|
||||
"src/object-store/src/impl/apple",
|
||||
"src/object-store/src/parser",
|
||||
"src/object-store/external/pegtl"
|
||||
]
|
||||
},
|
||||
"target_name": "object-store",
|
||||
"dependencies": [ "realm-sync" ], # sync also includes core
|
||||
"dependencies": [ "realm-core" ],
|
||||
"type": "static_library",
|
||||
"include_dirs": [ "<@(object-store-include-dirs)" ],
|
||||
"include_dirs": [
|
||||
"src/object-store/src",
|
||||
"src/object-store/src/impl",
|
||||
"src/object-store/src/impl/apple",
|
||||
"src/object-store/src/parser",
|
||||
"src/object-store/external/pegtl"
|
||||
],
|
||||
"sources": [
|
||||
"src/object-store/src/collection_notifications.cpp",
|
||||
"src/object-store/src/index_set.cpp",
|
||||
|
@ -50,10 +55,7 @@
|
|||
"src/object-store/src/results.cpp",
|
||||
"src/object-store/src/schema.cpp",
|
||||
"src/object-store/src/shared_realm.cpp",
|
||||
"src/object-store/src/sync_manager.cpp",
|
||||
"src/object-store/src/sync_session.cpp",
|
||||
"src/object-store/src/thread_confined.cpp",
|
||||
"src/object-store/src/global_notifier.cpp",
|
||||
"src/object-store/src/impl/collection_change_builder.cpp",
|
||||
"src/object-store/src/impl/collection_notifier.cpp",
|
||||
"src/object-store/src/impl/handover.cpp",
|
||||
|
@ -77,25 +79,44 @@
|
|||
"sources": [
|
||||
"src/object-store/src/impl/apple/external_commit_helper.cpp"
|
||||
]
|
||||
}],
|
||||
["realm_enable_sync", {
|
||||
"dependencies": [ "realm-sync" ],
|
||||
"sources": [
|
||||
"src/object-store/src/sync_manager.cpp",
|
||||
"src/object-store/src/sync_session.cpp"
|
||||
]
|
||||
}]
|
||||
],
|
||||
"all_dependent_settings": {
|
||||
"include_dirs": [ "<@(object-store-include-dirs)" ]
|
||||
"include_dirs": [
|
||||
"src/object-store/src",
|
||||
"src/object-store/src/impl",
|
||||
"src/object-store/src/impl/apple",
|
||||
"src/object-store/src/parser",
|
||||
"src/object-store/external/pegtl"
|
||||
]
|
||||
},
|
||||
"export_dependent_settings": [
|
||||
"<@(_dependencies)" # re-export settings related to linking the realm binaries
|
||||
]
|
||||
},
|
||||
{
|
||||
"target_name": "action_after_build",
|
||||
"type": "none",
|
||||
"dependencies": [ "<(module_name)" ],
|
||||
"copies": [
|
||||
}
|
||||
],
|
||||
"conditions": [
|
||||
["not realm_node_build_as_library", {
|
||||
"targets": [
|
||||
{
|
||||
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
||||
"destination": "<(module_path)"
|
||||
"target_name": "action_after_build",
|
||||
"type": "none",
|
||||
"dependencies": [ "<(module_name)" ],
|
||||
"copies": [
|
||||
{
|
||||
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
||||
"destination": "<(module_path)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,10 +1,24 @@
|
|||
{
|
||||
"variables": {
|
||||
"use_realm_debug": "<!(echo $REALMJS_USE_DEBUG_CORE)",
|
||||
"realm_enable_sync%": "0"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "realm-core",
|
||||
"type": "none",
|
||||
"direct_dependent_settings": {
|
||||
"conditions": [
|
||||
["use_realm_debug!=''", {
|
||||
"libraries": [ "-lrealm-node-dbg" ],
|
||||
"defines": [ "REALM_DEBUG=1" ]
|
||||
}, {
|
||||
"libraries": [ "-lrealm-node" ]
|
||||
}]
|
||||
]
|
||||
},
|
||||
"all_dependent_settings": {
|
||||
"defines": [ "REALM_HAVE_CONFIG", "REALM_PLATFORM_NODE=1", "REALM_ENABLE_SYNC" ]
|
||||
"defines": [ "REALM_HAVE_CONFIG", "REALM_PLATFORM_NODE=1", "REALM_ENABLE_SYNC=<(realm_enable_sync)" ]
|
||||
},
|
||||
"variables": {
|
||||
"prefix": "<!(echo $REALM_CORE_PREFIX)"
|
||||
|
@ -17,6 +31,12 @@
|
|||
"direct_dependent_settings": {
|
||||
"library_dirs": [ "<(prefix)/src/realm" ]
|
||||
}
|
||||
}, {
|
||||
"conditions": [
|
||||
["OS=='mac'", {
|
||||
"dependencies": [ "vendored-realm" ]
|
||||
}]
|
||||
]
|
||||
}]
|
||||
]
|
||||
},
|
||||
|
@ -24,6 +44,15 @@
|
|||
"target_name": "realm-sync",
|
||||
"type": "none",
|
||||
"dependencies": [ "realm-core" ], # sync headers include core headers
|
||||
"direct_dependent_settings": {
|
||||
"conditions": [
|
||||
["use_realm_debug!=''", {
|
||||
"libraries": [ "-lrealm-sync-node-dbg" ]
|
||||
}, {
|
||||
"libraries": [ "-lrealm-sync-node" ]
|
||||
}]
|
||||
]
|
||||
},
|
||||
"export_dependent_settings": [ "realm-core" ], # depending on sync is tantamount to depending on core
|
||||
"variables": {
|
||||
"prefix": "<!(echo $REALM_SYNC_PREFIX)"
|
||||
|
@ -36,8 +65,26 @@
|
|||
"direct_dependent_settings": {
|
||||
"library_dirs": [ "<(prefix)/src/realm" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
["OS=='mac'", {
|
||||
"dependencies": [ "vendored-realm" ]
|
||||
}]
|
||||
]
|
||||
}]
|
||||
],
|
||||
},
|
||||
{
|
||||
"variables": {
|
||||
"realm_vendor_dir%": "<(module_root_dir)/vendor",
|
||||
},
|
||||
"target_name": "vendored-realm",
|
||||
"type": "none",
|
||||
"all_dependent_settings": {
|
||||
"include_dirs": [ "<(realm_vendor_dir)/realm-sync/include" ],
|
||||
"library_dirs": [ "<(realm_vendor_dir)/realm-sync/osx" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -22,11 +22,6 @@
|
|||
"include_dirs": [
|
||||
"<!(node -e \"require('nan')\")"
|
||||
],
|
||||
"configurations": {
|
||||
"Debug": {
|
||||
"defines": ["DEBUG=1"]
|
||||
}
|
||||
},
|
||||
"conditions": [
|
||||
["OS=='mac'", {
|
||||
"xcode_settings": {
|
||||
|
|
Loading…
Reference in New Issue