Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows build #22

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dist
*.eggs
src/aimrocks/lib_rocksdb.cpp
*.so
*.lib
*.dylib
lib*.so.*
__pycache__
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include requirements.txt
recursive-include src *.hpp *.pxd *.pyx *.h *.hxx *.pyi *.so* *.dylib*
recursive-include src *.hpp *.pxd *.pyx *.h *.hxx *.pyi *.lib *.so* *.dylib*
22 changes: 18 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,28 @@
if platform.system() == 'Darwin':
aimrocks_extra_compile_args += ['-mmacosx-version-min=10.7', '-stdlib=libc++']
aimrocks_extra_link_args += ["-Wl,-rpath,@loader_path"]
elif platform.system() == 'Windows':
aimrocks_extra_compile_args = ['/std:c++latest', '/permissive-', '/W3', '/O2', '/EHsc', '/GL']
aimrocks_extra_link_args = ['/LTCG']
else:
aimrocks_extra_link_args += ["-Wl,-rpath,$ORIGIN"]

third_party_install_dir = os.environ.get('AIM_DEP_DIR', '/usr/local')
third_party_deps = ['rocksdb']
if platform.system() == 'Windows':
third_party_install_dir = os.environ.get('AIM_DEP_DIR', '../vcpkg/installed/x64-windows-static-md')
third_party_deps = ['rocksdb', 'bz2', 'lz4', 'snappy', 'zlib', 'zstd']
else:
third_party_install_dir = os.environ.get('AIM_DEP_DIR', '/usr/local')
third_party_deps = ['rocksdb']

third_party_lib_dir = os.path.join(third_party_install_dir, 'lib')
third_party_libs = glob(os.path.join(third_party_lib_dir, 'librocksdb.*'))
if platform.system() == 'Windows':
third_party_libs = [
os.path.join(third_party_lib_dir, lib + '.lib')
for lib in third_party_deps
]
third_party_deps += ['rpcrt4', 'shlwapi'] # Windows system libs used by rocksdb
else:
third_party_libs = glob(os.path.join(third_party_lib_dir, 'librocksdb.*'))

third_party_headers = [os.path.join(third_party_install_dir, 'include/rocksdb')]

Expand Down Expand Up @@ -75,7 +89,7 @@
language='c++',
include_dirs=[local_include_dir],
library_dirs=[third_party_lib_dir],
libraries=['rocksdb'],
libraries=third_party_deps,
)
]

Expand Down
13 changes: 12 additions & 1 deletion src/aimrocks/lib_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ def get_lib_dir():
return path

def get_libs():
return [
libs = [
'rocksdb',
]
if platform.system() == 'Windows':
libs += [
'bz2',
'lz4',
'snappy',
'zlib',
'zstd',
'rpcrt4',
'shlwapi',
]
return libs

def get_lib_filename(name, lib_dir):
if platform.system() == 'Darwin':
Expand Down
2 changes: 2 additions & 0 deletions tests/test_memtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def test_open_skiplist_memtable_factory():
loc = tempfile.mkdtemp()
try:
test_db = aimrocks.DB(os.path.join(loc, "test"), opts)
del test_db
finally:
shutil.rmtree(loc)

Expand All @@ -25,5 +26,6 @@ def test_open_vector_memtable_factory():
loc = tempfile.mkdtemp()
try:
test_db = aimrocks.DB(os.path.join(loc, "test"), opts)
del test_db
finally:
shutil.rmtree(loc)