mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
66 lines
2.5 KiB
Plaintext
66 lines
2.5 KiB
Plaintext
# Copyright (c) 2014-2026 Savoir-faire Linux Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
from setuptools import setup, Extension, find_packages
|
|
from setuptools.command.build_ext import build_ext as _build_ext
|
|
import os
|
|
|
|
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.md'), 'r', encoding='utf-8') as f:
|
|
long_description = f.read()
|
|
|
|
extra_compile_args = {
|
|
'msvc': ['/std:c++17', '/EHsc', '/utf-8'],
|
|
'unix': ['-std=c++17'],
|
|
}
|
|
|
|
extra_link_args = {
|
|
'msvc': ['wsock32.lib', 'ws2_32.lib'],
|
|
'unix': ['-std=c++17']
|
|
}
|
|
extra_libraries = {
|
|
'msvc': ['opendht_import', 'gnutls'],
|
|
'unix': ['opendht']
|
|
}
|
|
|
|
class build_ext(_build_ext):
|
|
def build_extensions(self):
|
|
compile_args = extra_compile_args.get(self.compiler.compiler_type, [])
|
|
link_args = extra_link_args.get(self.compiler.compiler_type, [])
|
|
libraries = extra_libraries.get(self.compiler.compiler_type, ['opendht'])
|
|
for ext in self.extensions:
|
|
ext.extra_compile_args.extend(compile_args)
|
|
ext.extra_link_args.extend(link_args)
|
|
ext.libraries = libraries
|
|
super().build_extensions()
|
|
|
|
setup(name="opendht",
|
|
version="@PACKAGE_VERSION@",
|
|
description="OpenDHT: A lightweight Distributed Hash Table",
|
|
long_description=long_description,
|
|
long_description_content_type="text/markdown",
|
|
url='https://github.com/savoirfairelinux/opendht',
|
|
author="Adrien Beraud <adrien.beraud@savoirfairelinux.com>",
|
|
license="MIT",
|
|
classifiers=[
|
|
'Development Status :: 5 - Production/Stable',
|
|
'Intended Audience :: Developers',
|
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
'Topic :: System :: Distributed Computing',
|
|
'Topic :: System :: Networking',
|
|
'Programming Language :: Python :: 3',
|
|
'Programming Language :: Python :: 3.9',
|
|
],
|
|
cmdclass=dict(build_ext=build_ext),
|
|
packages=find_packages(where='@CURRENT_SOURCE_DIR@'),
|
|
package_dir={"": "@CURRENT_SOURCE_DIR@"},
|
|
ext_modules=[Extension(
|
|
"opendht._core",
|
|
["@CURRENT_SOURCE_DIR@/opendht.pyx"],
|
|
language="c++",
|
|
extra_compile_args=["-DMSGPACK_NO_BOOST", "-DMSGPACK_DISABLE_LEGACY_NIL", "-DMSGPACK_DISABLE_LEGACY_CONVERT", "-DOPENDHT_INDEXATION", "-Dopendht_EXPORTS"],
|
|
libraries=["opendht", "gnutls"],
|
|
include_dirs = ['@PROJECT_SOURCE_DIR@/include'@OPENDHT_PYTHON_INCLUDE_DIRS@],
|
|
library_dirs = ['@CURRENT_BINARY_DIR@', '@PROJECT_BINARY_DIR@'@OPENDHT_PYTHON_LIBRARY_DIRS@]
|
|
)]
|
|
)
|