sets up prelude

This commit is contained in:
benbierens 2024-05-09 14:05:01 +02:00
parent 90f998333a
commit 432ffc2152
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
2 changed files with 16 additions and 11 deletions

View File

@ -16,21 +16,18 @@ rm -Rf "${root}/sources/third_party"
rm -Rf "${root}/sources/benchmarks" rm -Rf "${root}/sources/benchmarks"
rm "${root}/sources/util/testutil.cc" rm "${root}/sources/util/testutil.cc"
# prelude: not needed? # Prelude:
cat "${root}/prelude.nim" > "${root}/leveldb.nim"
rm "${root}/leveldb.nim"
echo >> "${root}/leveldb.nim" echo >> "${root}/leveldb.nim"
# assemble files to be compiled: # assemble files to be compiled:
extensions="c cc cpp" extensions="c cc cpp"
for ext in ${extensions}; do for ext in ${extensions}; do
for file in `find "${root}/sources" -type f -name "*.${ext}"`; do for file in `find "${root}/sources" -type f -name "*.${ext}" \
if [[ $file == *"_test"* ]]; then | grep -v "_test" \
echo "Skip test file: ${file}" | grep -v "env_windows.cc" \
else | grep -v "env_posix.cc"`; do
echo "Include file: ${file}" compile="${compile} --compile=${file}"
compile="${compile} --compile=${file}"
fi
done done
done done
@ -46,5 +43,6 @@ toast \
--includeDirs="${root}/sources/port" \ --includeDirs="${root}/sources/port" \
--includeDirs="${root}/sources/include" \ --includeDirs="${root}/sources/include" \
--includeDirs="${root}/build/include" \ --includeDirs="${root}/build/include" \
--includeDirs="${root}/build/include/port" \
"${root}/sources/include/leveldb/c.h" >> "${root}/leveldb.nim" "${root}/sources/include/leveldb/c.h" >> "${root}/leveldb.nim"

7
prelude.nim Normal file
View File

@ -0,0 +1,7 @@
when defined(windows):
{.compile: "./sources/util/env_windows.cc".}
{.passc: "-DLEVELDB_PLATFORM_POSIX".}
when defined(posix):
{.compile: "./sources/util/env_posix.cc".}
{.passc: "-DLEVELDB_PLATFORM_WINDOWS".}