Ben Bierens bd9b8394a7
Update to nim 2 x (#3)
* Change the LevelDbCmakeFlags option case

* Add nimbledeps to ignored files

* Increase version

* Add Nim 2.0.12 to the matrix

* Fixes STD_REGEX issue introduced by gtest/benchmark submodule

* Revert "Fixes STD_REGEX issue introduced by gtest/benchmark submodule"

This reverts commit b4db94d75300f9d638869279ab736571eda632e6.

* Disables building benchmark tests

---------

Co-authored-by: Arnaud <arnaud@status.im>
2025-02-11 12:06:00 +01:00

52 lines
1.5 KiB
Nim

import os
const
root = currentSourcePath.parentDir.parentDir
envWindows = root/"vendor"/"util"/"env_windows.cc"
envPosix = root/"vendor"/"util"/"env_posix.cc"
LevelDbCMakeFlags {.strdefine.} =
when defined(macosx):
"-DCMAKE_BUILD_TYPE=Release -DLEVELDB_BUILD_BENCHMARKS=OFF"
elif defined(windows):
"-G\"MSYS Makefiles\" -DCMAKE_BUILD_TYPE=Release -DLEVELDB_BUILD_BENCHMARKS=OFF"
else:
"-DCMAKE_BUILD_TYPE=Release -DLEVELDB_BUILD_BENCHMARKS=OFF"
LevelDbDir {.strdefine.} = $(root/"vendor")
buildDir = $(root/"build")
proc buildLevelDb() =
if fileExists(buildDir/"Makefile"):
echo "LevelDB already build. Delete '" & buildDir & "' to force rebuild."
return
echo "Initializing submodule..."
discard gorge "git submodule deinit -f \"" & root & "\""
discard gorge "git submodule update --init --recursive --checkout \"" & root & "\""
echo "\nClean dir: \"" & buildDir & "\""
discard gorge "rm -rf " & buildDir
discard gorge "mkdir -p " & buildDir
let cmd = "cmake -S \"" & LevelDbDir & "\" -B \"" & buildDir & "\" " & LevelDbCMakeFlags
echo "\nBuilding LevelDB: " & cmd
let (output, exitCode) = gorgeEx cmd
if exitCode != 0:
discard gorge "rm -rf " & buildDir
echo output
raise (ref Defect)(msg: "Failed to build LevelDB")
static:
buildLevelDb()
when defined(windows):
{.compile: envWindows.}
{.passc: "-DLEVELDB_PLATFORM_WINDOWS".}
{.passc: "-D_UNICODE".}
{.passc: "-DUNICODE".}
when defined(posix):
{.compile: envPosix.}
{.passc: "-DLEVELDB_PLATFORM_POSIX".}