Build windows DLLs from vendor directory (#45)
* Add vcpkg as a submodule. * Set vendor submodules to RocksDb version v9.1.0 * Update readme.
This commit is contained in:
parent
138dadac9c
commit
a84cf5b896
|
@ -14,14 +14,10 @@ jobs:
|
||||||
target:
|
target:
|
||||||
- os: linux
|
- os: linux
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
# - os: linux
|
|
||||||
# cpu: i386
|
|
||||||
- os: macos
|
- os: macos
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
- os: windows
|
- os: windows
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
#- os: windows
|
|
||||||
#cpu: i386
|
|
||||||
branch: [version-1-6, version-2-0, devel]
|
branch: [version-1-6, version-2-0, devel]
|
||||||
include:
|
include:
|
||||||
- target:
|
- target:
|
||||||
|
@ -113,17 +109,8 @@ jobs:
|
||||||
git
|
git
|
||||||
mingw-w64-x86_64-toolchain
|
mingw-w64-x86_64-toolchain
|
||||||
|
|
||||||
- name: Restore Nim DLLs dependencies (Windows) from cache
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
id: windows-dlls-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: external/dlls-${{ matrix.target.cpu }}
|
|
||||||
key: 'dlls-${{ matrix.target.cpu }}'
|
|
||||||
|
|
||||||
- name: Install DLL dependencies (Windows)
|
- name: Install DLL dependencies (Windows)
|
||||||
if: >
|
if: >
|
||||||
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
|
||||||
runner.os == 'Windows'
|
runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
||||||
|
@ -132,13 +119,11 @@ jobs:
|
||||||
ROCKSDBSUB=x86
|
ROCKSDBSUB=x86
|
||||||
fi
|
fi
|
||||||
DLLPATH="external/dlls-${{ matrix.target.cpu }}"
|
DLLPATH="external/dlls-${{ matrix.target.cpu }}"
|
||||||
mkdir external
|
mkdir -p ${DLLPATH}
|
||||||
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
|
||||||
7z x -y external/windeps.zip -o"${DLLPATH}"
|
|
||||||
# ROCKSDB
|
# ROCKSDB
|
||||||
curl -L "https://github.com/status-im/nimbus-deps/releases/download/rocksdb-9.1.0/nimbus-deps.zip" -o external/nimbus-deps.zip
|
./scripts/build_dlls_windows.sh
|
||||||
7z x -y external/nimbus-deps.zip
|
cp ./build/librocksdb.dll "${DLLPATH}/librocksdb.dll"
|
||||||
cp -a "./${ROCKSDBSUB}/librocksdb.dll" "${DLLPATH}/librocksdb.dll"
|
|
||||||
|
|
||||||
- name: Path to cached dependencies (Windows)
|
- name: Path to cached dependencies (Windows)
|
||||||
if: >
|
if: >
|
||||||
|
|
|
@ -3,3 +3,8 @@
|
||||||
url = https://github.com/facebook/rocksdb
|
url = https://github.com/facebook/rocksdb
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
branch = master
|
branch = master
|
||||||
|
[submodule "vendor/vcpkg"]
|
||||||
|
path = vendor/vcpkg
|
||||||
|
url = https://github.com/microsoft/vcpkg
|
||||||
|
ignore = dirty
|
||||||
|
branch = master
|
||||||
|
|
16
README.md
16
README.md
|
@ -30,6 +30,22 @@ nim c -d:rocksdb_static_linking --threads:on your_program.nim
|
||||||
|
|
||||||
See the config.nims file which contains the static linking configuration which is switched on with the `rocksdb_static_linking` flag. Note that static linking is currently not supported on windows.
|
See the config.nims file which contains the static linking configuration which is switched on with the `rocksdb_static_linking` flag. Note that static linking is currently not supported on windows.
|
||||||
|
|
||||||
|
### Building Windows DLLs
|
||||||
|
|
||||||
|
Prerequisites:
|
||||||
|
- Windows 7 or newer
|
||||||
|
- Git
|
||||||
|
- Visual Studio 2015 Update 3 or greater with the English language pack
|
||||||
|
|
||||||
|
To build RocksDB for Windows, run the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
.\scripts\build_dlls_windows.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
After the build completes the built RocksDB DLLs will be located in the `build` directory.
|
||||||
|
|
||||||
|
|
||||||
### Contribution
|
### Contribution
|
||||||
|
|
||||||
Any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any
|
Any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
SET SCRIPT_DIR=%~dp0
|
||||||
|
|
||||||
|
cd %SCRIPT_DIR%\..
|
||||||
|
|
||||||
|
git submodule update --init
|
||||||
|
|
||||||
|
CALL .\vendor\vcpkg\bootstrap-vcpkg.bat -disableMetrics
|
||||||
|
|
||||||
|
.\vendor\vcpkg\vcpkg install rocksdb[lz4,zstd]:x64-windows-rocksdb --recurse --overlay-triplets=.\triplets
|
||||||
|
|
||||||
|
mkdir .\build
|
||||||
|
copy .\vendor\vcpkg\installed\x64-windows-rocksdb\bin\rocksdb-shared.dll .\build\librocksdb.dll
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Nim-RocksDB
|
||||||
|
# Copyright 2018-2024 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
#
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
# * GPL license, version 2.0, ([LICENSE-GPLv2](LICENSE-GPLv2) or https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
||||||
|
#
|
||||||
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"/..
|
||||||
|
|
||||||
|
REPO_DIR="${PWD}"
|
||||||
|
|
||||||
|
git submodule update --init
|
||||||
|
|
||||||
|
${REPO_DIR}/vendor/vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
||||||
|
|
||||||
|
${REPO_DIR}/vendor/vcpkg/vcpkg install rocksdb[lz4,zstd]:x64-windows-rocksdb --recurse --overlay-triplets=${REPO_DIR}/triplets
|
||||||
|
|
||||||
|
mkdir -p ${REPO_DIR}/build
|
||||||
|
cp ${REPO_DIR}/vendor/vcpkg/installed/x64-windows-rocksdb/bin/rocksdb-shared.dll ./build/librocksdb.dll
|
|
@ -0,0 +1,10 @@
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||||
|
set(VCPKG_BUILD_TYPE release)
|
||||||
|
|
||||||
|
if(${PORT} MATCHES "snappy|zlib|lz4|zstd")
|
||||||
|
set(VCPKG_CRT_LINKAGE static)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE static)
|
||||||
|
else()
|
||||||
|
set(VCPKG_CRT_LINKAGE static)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
||||||
|
endif()
|
|
@ -0,0 +1,10 @@
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE x86)
|
||||||
|
set(VCPKG_BUILD_TYPE release)
|
||||||
|
|
||||||
|
if(${PORT} MATCHES "snappy|zlib|lz4|zstd")
|
||||||
|
set(VCPKG_CRT_LINKAGE static)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE static)
|
||||||
|
else()
|
||||||
|
set(VCPKG_CRT_LINKAGE static)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
||||||
|
endif()
|
|
@ -1 +1 @@
|
||||||
Subproject commit a66daec5410683c0f66e7759b425631ffbfd8677
|
Subproject commit bcf88d48ce8aa8b536aee4dd305533b3b83cf435
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 01f602195983451bc83e72f4214af2cbc495aa94
|
Loading…
Reference in New Issue