mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 06:46:03 +00:00
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": [
|
"includes": [
|
||||||
"src/node/gyp/target_defaults.gypi",
|
"src/node/gyp/target_defaults.gypi",
|
||||||
"src/node/gyp/realm.gyp"
|
"src/node/gyp/realm.gyp"
|
||||||
@ -10,37 +13,39 @@
|
|||||||
"object-store"
|
"object-store"
|
||||||
],
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
"src/node/node_sync_logger.cpp",
|
|
||||||
"src/node/node_init.cpp",
|
|
||||||
"src/node/platform.cpp",
|
"src/node/platform.cpp",
|
||||||
"src/js_realm.cpp"
|
"src/js_realm.cpp"
|
||||||
],
|
],
|
||||||
"include_dirs": [
|
"include_dirs": [
|
||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"link_settings": {
|
"conditions": [
|
||||||
"ldflags": [
|
["realm_node_build_as_library", {
|
||||||
"-Wl,--whole-archive,-lrealm-node,--no-whole-archive"
|
"type": "static_library",
|
||||||
]
|
"export_dependent_settings": [ "object-store" ]
|
||||||
},
|
}, {
|
||||||
"xcode_settings": {
|
"sources": [
|
||||||
"OTHER_LDFLAGS": [ "-all_load", "-lrealm-node" ]
|
"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",
|
"target_name": "object-store",
|
||||||
"dependencies": [ "realm-sync" ], # sync also includes core
|
"dependencies": [ "realm-core" ],
|
||||||
"type": "static_library",
|
"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": [
|
"sources": [
|
||||||
"src/object-store/src/collection_notifications.cpp",
|
"src/object-store/src/collection_notifications.cpp",
|
||||||
"src/object-store/src/index_set.cpp",
|
"src/object-store/src/index_set.cpp",
|
||||||
@ -50,10 +55,7 @@
|
|||||||
"src/object-store/src/results.cpp",
|
"src/object-store/src/results.cpp",
|
||||||
"src/object-store/src/schema.cpp",
|
"src/object-store/src/schema.cpp",
|
||||||
"src/object-store/src/shared_realm.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/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_change_builder.cpp",
|
||||||
"src/object-store/src/impl/collection_notifier.cpp",
|
"src/object-store/src/impl/collection_notifier.cpp",
|
||||||
"src/object-store/src/impl/handover.cpp",
|
"src/object-store/src/impl/handover.cpp",
|
||||||
@ -77,25 +79,44 @@
|
|||||||
"sources": [
|
"sources": [
|
||||||
"src/object-store/src/impl/apple/external_commit_helper.cpp"
|
"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": {
|
"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": [
|
"export_dependent_settings": [
|
||||||
"<@(_dependencies)" # re-export settings related to linking the realm binaries
|
"<@(_dependencies)" # re-export settings related to linking the realm binaries
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
"target_name": "action_after_build",
|
"conditions": [
|
||||||
"type": "none",
|
["not realm_node_build_as_library", {
|
||||||
"dependencies": [ "<(module_name)" ],
|
"targets": [
|
||||||
"copies": [
|
|
||||||
{
|
{
|
||||||
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
"target_name": "action_after_build",
|
||||||
"destination": "<(module_path)"
|
"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": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"target_name": "realm-core",
|
"target_name": "realm-core",
|
||||||
"type": "none",
|
"type": "none",
|
||||||
|
"direct_dependent_settings": {
|
||||||
|
"conditions": [
|
||||||
|
["use_realm_debug!=''", {
|
||||||
|
"libraries": [ "-lrealm-node-dbg" ],
|
||||||
|
"defines": [ "REALM_DEBUG=1" ]
|
||||||
|
}, {
|
||||||
|
"libraries": [ "-lrealm-node" ]
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
},
|
||||||
"all_dependent_settings": {
|
"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": {
|
"variables": {
|
||||||
"prefix": "<!(echo $REALM_CORE_PREFIX)"
|
"prefix": "<!(echo $REALM_CORE_PREFIX)"
|
||||||
@ -17,6 +31,12 @@
|
|||||||
"direct_dependent_settings": {
|
"direct_dependent_settings": {
|
||||||
"library_dirs": [ "<(prefix)/src/realm" ]
|
"library_dirs": [ "<(prefix)/src/realm" ]
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"conditions": [
|
||||||
|
["OS=='mac'", {
|
||||||
|
"dependencies": [ "vendored-realm" ]
|
||||||
|
}]
|
||||||
|
]
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -24,6 +44,15 @@
|
|||||||
"target_name": "realm-sync",
|
"target_name": "realm-sync",
|
||||||
"type": "none",
|
"type": "none",
|
||||||
"dependencies": [ "realm-core" ], # sync headers include core headers
|
"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
|
"export_dependent_settings": [ "realm-core" ], # depending on sync is tantamount to depending on core
|
||||||
"variables": {
|
"variables": {
|
||||||
"prefix": "<!(echo $REALM_SYNC_PREFIX)"
|
"prefix": "<!(echo $REALM_SYNC_PREFIX)"
|
||||||
@ -36,8 +65,26 @@
|
|||||||
"direct_dependent_settings": {
|
"direct_dependent_settings": {
|
||||||
"library_dirs": [ "<(prefix)/src/realm" ]
|
"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": [
|
"include_dirs": [
|
||||||
"<!(node -e \"require('nan')\")"
|
"<!(node -e \"require('nan')\")"
|
||||||
],
|
],
|
||||||
"configurations": {
|
|
||||||
"Debug": {
|
|
||||||
"defines": ["DEBUG=1"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"conditions": [
|
"conditions": [
|
||||||
["OS=='mac'", {
|
["OS=='mac'", {
|
||||||
"xcode_settings": {
|
"xcode_settings": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user