From 9e80aa564370ea19ee87e247d24503f40a7acdcf Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sun, 28 Nov 2021 15:45:05 +0100 Subject: [PATCH 01/18] Try to fix alignof under MSVC --- src/mgallocator.c | 5 +++++ src/mgsession.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mgallocator.c b/src/mgallocator.c index 069e1e0..458f8ba 100644 --- a/src/mgallocator.c +++ b/src/mgallocator.c @@ -15,12 +15,17 @@ #include "mgallocator.h" #include +// Somehow stdalign.h is not there (VS Build Tools 2019, Windows 11) +// https://docs.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170 +#ifndef _WIN32 #include +#endif #include #include #include #ifdef _MSC_VER +#define alignof __alignof typedef double max_align_t; #endif diff --git a/src/mgsession.c b/src/mgsession.c index dc9fb8b..f409713 100644 --- a/src/mgsession.c +++ b/src/mgsession.c @@ -14,15 +14,17 @@ #include #include -#include #include #include #include #include #include -#ifndef _MSC_VER +#ifndef _MSC_VER || _WIN32 #include #endif +#ifndef _WIN32 +#include +#endif #include "mgcommon.h" #include "mgconstants.h" From fac7a7594a6c231000947500d0ffd413149d16f6 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sun, 28 Nov 2021 15:49:16 +0100 Subject: [PATCH 02/18] Fix or in define --- src/mgsession.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mgsession.c b/src/mgsession.c index f409713..bf0bf84 100644 --- a/src/mgsession.c +++ b/src/mgsession.c @@ -19,7 +19,7 @@ #include #include #include -#ifndef _MSC_VER || _WIN32 +#ifndef _MSC_VER #include #endif #ifndef _WIN32 From 85cf10f79f7f1b41a054171cc92bac4968edf469 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sun, 28 Nov 2021 16:03:40 +0100 Subject: [PATCH 03/18] Fix stdalign include again --- src/mgallocator.c | 2 +- src/mgsession.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mgallocator.c b/src/mgallocator.c index 458f8ba..8465706 100644 --- a/src/mgallocator.c +++ b/src/mgallocator.c @@ -17,7 +17,7 @@ #include // Somehow stdalign.h is not there (VS Build Tools 2019, Windows 11) // https://docs.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170 -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_MSC_VER) #include #endif #include diff --git a/src/mgsession.c b/src/mgsession.c index bf0bf84..bfc3534 100644 --- a/src/mgsession.c +++ b/src/mgsession.c @@ -22,7 +22,7 @@ #ifndef _MSC_VER #include #endif -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_MSC_VER) #include #endif From 7d5d14ae8e8b24341a08ac1709a45fb16cfb797d Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sun, 28 Nov 2021 16:26:02 +0100 Subject: [PATCH 04/18] Fix align include finally --- src/mgallocator.c | 2 +- src/mgsession.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mgallocator.c b/src/mgallocator.c index 8465706..01e7f68 100644 --- a/src/mgallocator.c +++ b/src/mgallocator.c @@ -17,7 +17,7 @@ #include // Somehow stdalign.h is not there (VS Build Tools 2019, Windows 11) // https://docs.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170 -#if !defined(_WIN32) && !defined(_MSC_VER) +#if !defined(_WIN32) || !defined(_MSC_VER) #include #endif #include diff --git a/src/mgsession.c b/src/mgsession.c index bfc3534..1d62b92 100644 --- a/src/mgsession.c +++ b/src/mgsession.c @@ -22,7 +22,7 @@ #ifndef _MSC_VER #include #endif -#if !defined(_WIN32) && !defined(_MSC_VER) +#if !defined(_WIN32) || !defined(_MSC_VER) #include #endif From 4da3417fdc49661e824b5c45e6beeacf4e75841f Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 11 Feb 2023 14:45:49 +0100 Subject: [PATCH 05/18] Update README --- README.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 80b3c62..9fb9b1f 100644 --- a/README.md +++ b/README.md @@ -111,12 +111,24 @@ ctest ## Building and installing on Windows -To build `mgclient` on Windows, MINGW environment should be used. - - Install MSYS2 from https://www.msys2.org/. - - Install MinGW toolchain with the following command: - ``` - pacman -S --needed git base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain mingw-w64-i686-cmake mingw-w64-x86_64-cmake mingw-w64-i686-openssl mingw-w64-x86_64-openssl - ``` +To build `mgclient` on Windows, there are multiple options. + +### MSVC + +``` +mkdir build +cd build +cmake .. +cmake --build . +``` + +### MINGW + +- Install MSYS2 from https://www.msys2.org/. +- Install MinGW toolchain with the following command: + ``` + pacman -S --needed git base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain mingw-w64-i686-cmake mingw-w64-x86_64-cmake mingw-w64-i686-openssl mingw-w64-x86_64-openssl + ``` Once the environment is ready, please run: From 0d46938fed6efae93adf599f3750b59a88e8e020 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 16:49:46 +0100 Subject: [PATCH 06/18] Improve README a bit --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 004f3d8..33a9e1f 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,13 @@ brew install openssl@1.1 ``` If `cmake` can't locate OpenSSL, please set `OPENSSL_ROOT_DIR` to a valid path. -An examples follows: +Examples follow: ``` -cmake -DOPENSSL_ROOT_DIR="$(ls -rd -- /usr/local/Cellar/openssl@1.1/* | head -n 1)" .. +# M1 with brew installed cmake -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" .. +# Using only ls command +cmake -DOPENSSL_ROOT_DIR="$(ls -rd -- /usr/local/Cellar/openssl@1.1/* | head -n 1)" .. ``` After running CMake, you should see a Makefile in the build directory. Then you @@ -139,12 +141,17 @@ cd build cmake .. -G "MinGW Makefiles" cmake --build . --target install ``` + ## Building WASM (linux only) -Compiling `mgclient` for wasm requires the Emscripten sdk. This is automated in the following steps: + +Compiling `mgclient` for wasm requires the Emscripten sdk. This is automated in +the following steps: 1. mkdir build && cd build 2. cmake .. -DWASM=ON 3. make -Now there should be an `mgclient.js` and an `mgclient.wasm` found in `mgclient/build/` + +Now there should be an `mgclient.js` and an `mgclient.wasm` found in +`mgclient/build/` ## Using the library From 2f3c66abe77d4d84cb7e01fdee71934bc15c45d9 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 17:17:42 +0100 Subject: [PATCH 07/18] Polish the ifdefs a bit --- README.md | 1 + src/mgallocator.c | 9 +++++---- src/mgsession.c | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 33a9e1f..f35f36f 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Examples follow: ``` # M1 with brew installed cmake -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" .. + # Using only ls command cmake -DOPENSSL_ROOT_DIR="$(ls -rd -- /usr/local/Cellar/openssl@1.1/* | head -n 1)" .. ``` diff --git a/src/mgallocator.c b/src/mgallocator.c index 01e7f68..c70079f 100644 --- a/src/mgallocator.c +++ b/src/mgallocator.c @@ -17,17 +17,18 @@ #include // Somehow stdalign.h is not there (VS Build Tools 2019, Windows 11) // https://docs.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170 +// The following block is EXCLUDED on MSVC. #if !defined(_WIN32) || !defined(_MSC_VER) #include #endif -#include -#include -#include - +// The following block is USED on MSVC. #ifdef _MSC_VER #define alignof __alignof typedef double max_align_t; #endif +#include +#include +#include void *mg_system_realloc(struct mg_allocator *self, void *buf, size_t size) { (void)self; diff --git a/src/mgsession.c b/src/mgsession.c index d7d5756..457eccc 100644 --- a/src/mgsession.c +++ b/src/mgsession.c @@ -21,11 +21,12 @@ #include #include #include -#ifndef _MSC_VER -#include -#endif +// Somehow stdalign.h is not there (VS Build Tools 2019, Windows 11) +// https://docs.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170 #if !defined(_WIN32) || !defined(_MSC_VER) #include +#else +#include #endif #include "mgcommon.h" From 4faa05d154a338129a122bd8b21ccde4d886ffb3 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 17:28:46 +0100 Subject: [PATCH 08/18] Polish includes #2 --- src/mgallocator.c | 4 ++-- src/mgsession.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mgallocator.c b/src/mgallocator.c index c70079f..b12aeb4 100644 --- a/src/mgallocator.c +++ b/src/mgallocator.c @@ -17,11 +17,11 @@ #include // Somehow stdalign.h is not there (VS Build Tools 2019, Windows 11) // https://docs.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170 -// The following block is EXCLUDED on MSVC. +// EVERYWHERE EXCEPT MSVC #if !defined(_WIN32) || !defined(_MSC_VER) #include #endif -// The following block is USED on MSVC. +// ONLY ON MSVC #ifdef _MSC_VER #define alignof __alignof typedef double max_align_t; diff --git a/src/mgsession.c b/src/mgsession.c index 457eccc..7ce4a42 100644 --- a/src/mgsession.c +++ b/src/mgsession.c @@ -23,9 +23,9 @@ #include // Somehow stdalign.h is not there (VS Build Tools 2019, Windows 11) // https://docs.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170 +// EVERYWHERE EXCEPT MSVC #if !defined(_WIN32) || !defined(_MSC_VER) #include -#else #include #endif From 9bfee8d8c3075120737bd07c9ef8131fe237a5eb Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 17:43:59 +0100 Subject: [PATCH 09/18] Add GHA MSVC job attempt #1 --- .github/workflows/ci.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d4d720..7ae9c21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,18 @@ jobs: ctest -E "example|integration" sudo make install + build_windows_msvc: + runs-on: windows-latest + steps: + - name: Set-up repository + uses: actions/checkout@v2 + - name: Build and test mgclient + run: | + mkdir build + cd build + cmake .. + cmake --build . + build_and_test_linux: strategy: matrix: @@ -68,7 +80,6 @@ jobs: run: | docker load -i ~/memgraph/memgraph-docker.tar.gz docker run -d -p 7687:7687 memgraph --telemetry-enabled=false - - name: Build with gcc, test and install mgclient run: | mkdir build-gcc && cd build-gcc @@ -84,9 +95,6 @@ jobs: ctest --output-on-failure sudo make install - # This project needs MinGW environment ON_WINDOWS to compile. CMake, make, - # gcc are all required. - # # GitHub actions can't run Linux Docker container on Windows machine # https://github.com/actions/virtual-environments/issues/1143. # @@ -94,7 +102,7 @@ jobs: # run Memgraph under [WSL](https://docs.microsoft.com/en-us/windows/wsl/). # Memgraph has to be started manually because systemd is not available on # WSL (init process does not exist). - build_and_test_windows: + build_and_test_windows_mingw: runs-on: windows-latest strategy: matrix: @@ -123,7 +131,6 @@ jobs: dpkg -i ~/memgraph/memgraph-community.deb nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-cert-file="" --bolt-key-file="" --data-directory="~/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-file='' & sleep 1 # Wait for Memgraph a bit. - - name: Build and test mgclient run: | mkdir build From 932d2a78fc8ab3206d3cf086d08c280e041ae889 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 21:10:36 +0100 Subject: [PATCH 10/18] Add GHA MSVC job attempt #2 --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ae9c21..783fc21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,9 +38,23 @@ jobs: build_windows_msvc: runs-on: windows-latest + env: + VCPKG_ROOT: '${{ github.workspace }}/vcpkg' steps: - name: Set-up repository uses: actions/checkout@v2 + - name: Get vcpkg + run: | + cd ${{ github.workspace }} + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + .\bootstrap-vcpkg.bat + - name: Remove system vcpkg + run: rm -rf "$VCPKG_INSTALLATION_ROOT" + shell: bash + - name: Install vcpkg packages + run: | + ${{ env.VCPKG_ROOT }}\vcpkg.exe install openssl - name: Build and test mgclient run: | mkdir build From 8176beb1d55d3d3d46d845a199093e33534f1814 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 21:44:15 +0100 Subject: [PATCH 11/18] Add vcpkg cache --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 783fc21..1efaedb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,13 +37,33 @@ jobs: sudo make install build_windows_msvc: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: windows-latest runs-on: windows-latest env: - VCPKG_ROOT: '${{ github.workspace }}/vcpkg' + VCPKG_ROOT: "${{ github.workspace }}/vcpkg" + deps: "openssl" steps: - name: Set-up repository uses: actions/checkout@v2 + - name: Restore vcpkg and its artifacts + uses: actions/cache@v3 + id: vcpkg-cache + with: + path: | + ${{ env.VCPKG_ROOT }} + vcpkg_installed + !${{ env.VCPKG_ROOT }}/.git + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + key: | + ${{ matrix.os }}-${{ env.deps }} - name: Get vcpkg + if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }} run: | cd ${{ github.workspace }} git clone https://github.com/Microsoft/vcpkg.git @@ -54,7 +74,7 @@ jobs: shell: bash - name: Install vcpkg packages run: | - ${{ env.VCPKG_ROOT }}\vcpkg.exe install openssl + ${{ env.VCPKG_ROOT }}\vcpkg.exe install ${{ env.deps }} - name: Build and test mgclient run: | mkdir build From ae454165fcb7bdb05a02f6e08d5ce1a01787bfb5 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 21:45:50 +0100 Subject: [PATCH 12/18] Remove redundant runs-on --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1efaedb..e07672e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,6 @@ jobs: matrix: include: - os: windows-latest - runs-on: windows-latest env: VCPKG_ROOT: "${{ github.workspace }}/vcpkg" deps: "openssl" From 1ad3325b4578d7d152fa126b23afc7d5944e56db Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 22:06:25 +0100 Subject: [PATCH 13/18] Add GHA MSVC job attempt #5 --- .github/workflows/ci.yml | 2 +- README.md | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e07672e..be9ed26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: run: | mkdir build cd build - cmake .. + cmake -DOPENSSL_ROOT_DIR="${{ env.VCPKG_ROOT }}\packages\openssl_x86-windows" .. cmake --build . build_and_test_linux: diff --git a/README.md b/README.md index f35f36f..c3c3977 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,10 @@ ctest ## Building and installing on Windows -To build `mgclient` on Windows, there are multiple options. +To build and install mgclient from source on Windows you will need: + - CMake version >= 3.8 + - OpenSSL version >= 1.0.2 + - gcc >= 8 under MinGW or Windows compiler (MSVC) >= 2019 ### MSVC @@ -125,6 +128,11 @@ cd build cmake .. cmake --build . ``` +Depending on where OpenSSL is installed you might need to define +`OPENSSL_ROOT_DIR`, example follows: +``` +cmake -DOPENSSL_ROOT_DIR="$VCPKG_ROOT\packages\openssl_x86-windows" .. +``` ### MINGW From ab0d293f3f25d89593c519fa8f3914fb1247a765 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 22:37:38 +0100 Subject: [PATCH 14/18] Install openssl x64 + cache attempt 6 --- .github/workflows/ci.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be9ed26..41ca840 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,8 +43,8 @@ jobs: include: - os: windows-latest env: - VCPKG_ROOT: "${{ github.workspace }}/vcpkg" - deps: "openssl" + VCPKG_ROOT: "${{ github.workspace }}\\vcpkg" + deps: "openssl:x64-windows" steps: - name: Set-up repository uses: actions/checkout@v2 @@ -52,17 +52,10 @@ jobs: uses: actions/cache@v3 id: vcpkg-cache with: - path: | - ${{ env.VCPKG_ROOT }} - vcpkg_installed - !${{ env.VCPKG_ROOT }}/.git - !${{ env.VCPKG_ROOT }}/buildtrees - !${{ env.VCPKG_ROOT }}/packages - !${{ env.VCPKG_ROOT }}/downloads - key: | - ${{ matrix.os }}-${{ env.deps }} + path: ${{ env.VCPKG_ROOT }} + key: ${{ matrix.os }}-${{ env.deps }} - name: Get vcpkg - if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }} + if: ${{ steps.vcpkg-cache.outputs.cache-hit != "true" }} run: | cd ${{ github.workspace }} git clone https://github.com/Microsoft/vcpkg.git @@ -78,7 +71,7 @@ jobs: run: | mkdir build cd build - cmake -DOPENSSL_ROOT_DIR="${{ env.VCPKG_ROOT }}\packages\openssl_x86-windows" .. + cmake -DOPENSSL_ROOT_DIR="${{ env.VCPKG_ROOT }}\packages\openssl_x64-windows" .. cmake --build . build_and_test_linux: From 47ddca9b7ec66112b48cf120c44740aed6349487 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 22:38:27 +0100 Subject: [PATCH 15/18] Fix the cache expression attempt 7 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41ca840..de3c3cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: path: ${{ env.VCPKG_ROOT }} key: ${{ matrix.os }}-${{ env.deps }} - name: Get vcpkg - if: ${{ steps.vcpkg-cache.outputs.cache-hit != "true" }} + if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }} run: | cd ${{ github.workspace }} git clone https://github.com/Microsoft/vcpkg.git From bb911b0731c1dccbe4e4bec7ceffc05a02d3bdce Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 22:48:05 +0100 Subject: [PATCH 16/18] Fix README + openssl installed path attempt 8 --- .github/workflows/ci.yml | 3 ++- README.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de3c3cc..6c15af2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: build_windows_msvc: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: include: - os: windows-latest @@ -71,7 +72,7 @@ jobs: run: | mkdir build cd build - cmake -DOPENSSL_ROOT_DIR="${{ env.VCPKG_ROOT }}\packages\openssl_x64-windows" .. + cmake -DOPENSSL_ROOT_DIR="${{ env.VCPKG_ROOT }}\installed\x64-windows" .. cmake --build . build_and_test_linux: diff --git a/README.md b/README.md index c3c3977..fcb6244 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ cmake --build . Depending on where OpenSSL is installed you might need to define `OPENSSL_ROOT_DIR`, example follows: ``` -cmake -DOPENSSL_ROOT_DIR="$VCPKG_ROOT\packages\openssl_x86-windows" .. +cmake -DOPENSSL_ROOT_DIR="$VCPKG_ROOT\installed\x64-windows" .. ``` ### MINGW @@ -151,7 +151,7 @@ cmake .. -G "MinGW Makefiles" cmake --build . --target install ``` -## Building WASM (linux only) +## Building WASM (Linux only) Compiling `mgclient` for wasm requires the Emscripten sdk. This is automated in the following steps: From a93049851b0a1ebe5a7f6394a6fa81b4bebb7ad2 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 18 Feb 2023 23:32:55 +0100 Subject: [PATCH 17/18] Add more under README --- .github/workflows/ci.yml | 2 +- README.md | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c15af2..0b55eb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: ctest -E "example|integration" sudo make install - build_windows_msvc: + build_windows_compiler: runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/README.md b/README.md index fcb6244..618e0b4 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,12 @@ ctest To build and install mgclient from source on Windows you will need: - CMake version >= 3.8 - OpenSSL version >= 1.0.2 - - gcc >= 8 under MinGW or Windows compiler (MSVC) >= 2019 + - MinGW: gcc >= 8 or Windows Compiler (take a look + [here](https://blog.knatten.org/2022/08/26/microsoft-c-versions-explained/) + to understand versioning in a bit more details): + VS >= 17 2022, MSVC >= 14.34, C >= 19.34 -### MSVC +### Windows Compiler ``` mkdir build @@ -128,13 +131,19 @@ cd build cmake .. cmake --build . ``` + Depending on where OpenSSL is installed you might need to define `OPENSSL_ROOT_DIR`, example follows: ``` cmake -DOPENSSL_ROOT_DIR="$VCPKG_ROOT\installed\x64-windows" .. ``` -### MINGW +To install OpenSSL [vcpkg](https://vcpkg.io/en/index.html) can be used: +``` +vcpkg install openssl:x64-windows +``` + +### MinGW - Install MSYS2 from https://www.msys2.org/. - Install MinGW toolchain with the following command: From eb3fbf550faeeedad0cda93f40c119558fdf01c8 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sun, 19 Feb 2023 13:47:18 +0100 Subject: [PATCH 18/18] Add additional OpenSSL README link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 618e0b4..726df32 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,8 @@ To install OpenSSL [vcpkg](https://vcpkg.io/en/index.html) can be used: ``` vcpkg install openssl:x64-windows ``` +or you can download and install OpenSSL from +[here](https://slproweb.com/products/Win32OpenSSL.html). ### MinGW