Skip to content

Commit 14a805e

Browse files
authored
Polish Linux, Mac and Windows builds (#51)
* move to the latest mgclient v1.4.1
1 parent b5a1a34 commit 14a805e

File tree

9 files changed

+3086
-5088
lines changed

9 files changed

+3086
-5088
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v1
1212
- uses: actions/setup-node@v1
1313
with:
14-
node-version: '12.x'
14+
node-version: '18.x'
1515
- name: Install and build addon
1616
run: |
1717
npm install
@@ -24,12 +24,12 @@ jobs:
2424
uses: actions/cache@v1
2525
with:
2626
path: ~/memgraph
27-
key: cache-memgraph-v2.1.1-docker-image
27+
key: cache-memgraph-v2.5.2-docker-image
2828
- name: Download Memgraph Docker image
2929
if: steps.cache-memgraph-docker.outputs.cache-hit != 'true'
3030
run: |
3131
mkdir ~/memgraph
32-
curl -L https://memgraph.com/download/memgraph/v2.1.1/docker/memgraph-2.1.1-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz
32+
curl -L https://memgraph.com/download/memgraph/v2.5.2/docker/memgraph-2.5.2-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz
3333
- name: Load Memgraph Docker image
3434
run: |
3535
docker load -i ~/memgraph/memgraph-docker.tar.gz

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
22
build/*
33
!build/Release/nodemgclient.node
4+
!build/Debug/nodemgclient.node
45
.cache
56
.github

CMakeLists.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@ cmake_minimum_required(VERSION 3.10)
22

33
#### NOTES:
44
# * HOW TO CHANGE THE COMPILER?
5-
# If you want to use specific compiler, consider using -C | --cc | --cxx cmake-js flags.
5+
# If you want to use specific compiler, consider using -C | --cc | --cxx cmake-js flags.
6+
#
67
# * WINDOWS AND MINGW ISSUES?
7-
# cmake-js doesn't support MinGW Makefiles -> https://github.com/cmake-js/cmake-js/issues/195
8-
# /DELAYLOAD:NODE.EXE: No such file or directory -> https://github.com/cmake-js/cmake-js/issues/200
9-
# cmake-js adds /DELAYLOAD:NODE.EXE + there is not an easy solution -> Move to node-gyp
10-
# I've played with paths + setting the CMAKE_SHARED_LINKER_FLAGS but all that is N/A.
11-
# The following does not work because CMake changes the string to be Windows path.
12-
# set(CMAKE_SHARED_LINKER_FLAGS "/DELAYLOAD:/c/Program\\ Files/nodejs/node.exe")
8+
# cmake-js doesn't support MinGW Makefiles -> https://github.com/cmake-js/cmake-js/issues/195
9+
# /DELAYLOAD:NODE.EXE: No such file or directory -> https://github.com/cmake-js/cmake-js/issues/200
10+
# cmake-js adds /DELAYLOAD:NODE.EXE + there is not an easy solution.
11+
# I've played with paths + setting the CMAKE_SHARED_LINKER_FLAGS but all that is N/A.
12+
# The following does not work because CMake changes the string to be Windows path.
13+
# set(CMAKE_SHARED_LINKER_FLAGS "/DELAYLOAD:/c/Program\\ Files/nodejs/node.exe")
1314

14-
project(nodemgclient VERSION 0.1.0)
15+
project(nodemgclient VERSION 0.1.2)
1516

1617
if (WIN32 AND MINGW)
1718
message(FATAL_ERROR "ON WINDOWS BUILD UNDER MINGW NOT YET POSSIBLE")
18-
elseif (APPLE)
19-
message(FATAL_ERROR "ON APPLE BUILD NOT YET POSSIBLE")
2019
endif()
2120

2221
include(ExternalProject)
@@ -36,14 +35,16 @@ add_library(project_warnings INTERFACE)
3635
include(cmake/CompilerWarnings.cmake)
3736
set_project_warnings(project_warnings)
3837

39-
set(MGCLIENT_GIT_TAG "v1.3.0" CACHE STRING "mgclient git tag")
38+
set(MGCLIENT_GIT_TAG "v1.4.1" CACHE STRING "mgclient git tag")
4039
set(MGCLIENT_LIBRARY mgclient-lib)
4140
set(MGCLIENT_INSTALL_DIR ${CMAKE_BINARY_DIR}/mgclient)
4241
set(MGCLIENT_INCLUDE_DIRS ${MGCLIENT_INSTALL_DIR}/include)
4342
if (UNIX AND NOT APPLE)
4443
set(MGCLIENT_LIBRARY_PATH ${MGCLIENT_INSTALL_DIR}/lib/libmgclient.so)
4544
elseif (WIN32)
4645
set(MGCLIENT_LIBRARY_PATH ${MGCLIENT_INSTALL_DIR}/lib/mgclient.dll)
46+
elseif (APPLE)
47+
set(MGCLIENT_LIBRARY_PATH ${MGCLIENT_INSTALL_DIR}/lib/libmgclient.dylib)
4748
endif()
4849
ExternalProject_Add(mgclient-proj
4950
PREFIX mgclient-proj
@@ -53,6 +54,7 @@ ExternalProject_Add(mgclient-proj
5354
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
5455
"-DBUILD_CPP_BINDINGS=ON"
5556
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
57+
"-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}"
5658
BUILD_BYPRODUCTS "${MGCLIENT_LIBRARY_PATH}"
5759
INSTALL_DIR "${PROJECT_BINARY_DIR}/mgclient"
5860
)

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Actions Status](https://github.com/memgraph/nodemgclient/workflows/CI/badge.svg)](https://github.com/memgraph/nodemgclient/actions)
2+
[![status: experimental](https://github.com/GIScience/badges/raw/master/status/experimental.svg)](https://www.npmjs.com/package/@memgraph/client)
23

34
# nodemgclient - Node.js Memgraph Client
45

@@ -50,7 +51,6 @@ npm run test
5051

5152
Since `cmake-js` is used, compiling for Windows is very similar to compiling
5253
for Linux:
53-
5454
```bash
5555
npm ci
5656
npm run build:release
@@ -60,7 +60,29 @@ If installing OpenSSL package from
6060
https://slproweb.com/products/Win32OpenSSL.html, make sure to use the full one
6161
because of the header files.
6262

63-
NOTE: Compilation doesn NOT work yet under MinGW.
63+
NOTE: Compilation does NOT work yet under MinGW.
64+
65+
## Build from Source on MacOS
66+
67+
To build on MacOS it's required to install the `openssl` package, e.g.:
68+
```
69+
brew install openssl
70+
```
71+
Once the package is in place, please set the `OPENSSL_ROOT_DIR` environment variable:
72+
```
73+
export OPENSSL_ROOT_DIR="$(brew --prefix openssl)"
74+
```
75+
Once OpenSSL is in place, please run:
76+
```
77+
npm ci
78+
npm run build:release
79+
```
80+
81+
NOTE: For more adventurous folks, since `cmake-js` is used, it's also possible to set
82+
the OpenSSL path via the following commend:
83+
```
84+
npx cmake-js compile --CDOPENSSL_ROOT_DIR="$(brew --prefix openssl)"
85+
```
6486

6587
## Implementation and Interface Notes
6688

example/event_emitter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const emitter = new EventEmitter()
3636
// a promise.
3737
const connection = memgraph.Connect({ host: 'localhost', port: 7687 });
3838

39-
await connection.ExecuteAndFetchRecords(query.DELETE_ALL);
39+
await connection.ExecuteAndFetchAll(query.DELETE_ALL);
4040

4141
const result = await connection.ExecuteLazy(
4242
`UNWIND [0, 1] AS item RETURN "value_x2" AS x, "value_y2" AS y;`,

0 commit comments

Comments
 (0)