diff --git a/py/client-ticking/setup.py b/py/client-ticking/setup.py index e5d4f402b12..43b4729e8a2 100644 --- a/py/client-ticking/setup.py +++ b/py/client-ticking/setup.py @@ -3,6 +3,7 @@ # import os import pathlib +import platform # Note: pkg_resources is deprecated https://setuptools.pypa.io/en/latest/pkg_resources.html, and it is suggested # to use an external library `packaging`. From the context of building a wheel though, we'd prefer to not have to @@ -29,6 +30,27 @@ def _compute_version(): return _normalize_version(os.environ['DEEPHAVEN_VERSION']) _version = _compute_version() +_system = platform.system() + +if _system == 'Windows': + dhinstall=os.environ.get('DHINSTALL') + extra_compiler_args=['/std:c++17', f'/I{dhinstall}\\include'] + extra_link_args=[f'/LIBPATH:{dhinstall}\\lib'] + + # Ensure distutils uses the compiler and linker in %PATH% + # You need an installation of Visual Studio 2022 with + # * Python Development Workspace + # * Python native option enabled + # And this should be run from the "x64 Native Tools Command Prompt" installed by VS + # Note "x64_x86 Cross Tools Command Prompt" will NOT work. + os.environ['DISTUTILS_USE_SDK']='y' + os.environ['MSSdk']='y' + libraries=['dhcore_static', 'ws2_32'] + +else: + extra_compiler_args=['-std=c++17'] + extra_link_args=None + libraries=['dhcore_static'] setup( name='pydeephaven-ticking', @@ -61,8 +83,9 @@ def _compute_version(): [Extension("pydeephaven_ticking._core", sources=["src/pydeephaven_ticking/*.pyx"], language="c++", - extra_compile_args=["-std=c++17"], - libraries=["dhcore_static"] + extra_compile_args=extra_compiler_args, + extra_link_args=extra_link_args, + libraries=libraries )]), python_requires='>=3.8', install_requires=[f"pydeephaven=={_version}"],