mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
python/setup.py: use appropriate flags for windows build
This commit is contained in:
1 parent
615463e103
commit
234f47a018
1 file changed
+28
-2
+28
-2
@@ -14,11 +14,37 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
from setuptools import setup, Extension
|
||||
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",
|
||||
@@ -36,12 +62,12 @@ setup(name="opendht",
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
],
|
||||
cmdclass=dict(build_ext=build_ext),
|
||||
ext_modules = [Extension(
|
||||
"opendht",
|
||||
["@CURRENT_SOURCE_DIR@/opendht.pyx"],
|
||||
language="c++",
|
||||
extra_compile_args=["-std=c++17", "-DMSGPACK_NO_BOOST", "-DMSGPACK_DISABLE_LEGACY_NIL", "-DMSGPACK_DISABLE_LEGACY_CONVERT", "-DOPENDHT_INDEXATION", "-Dopendht_EXPORTS"],
|
||||
extra_link_args=["-std=c++17"],
|
||||
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@]
|
||||
|
||||
Reference in new issue
Block a user