diff --git a/python/src/pycryptosat.cpp b/python/src/pycryptosat.cpp index 3dd2b7347..f56c45872 100644 --- a/python/src/pycryptosat.cpp +++ b/python/src/pycryptosat.cpp @@ -896,6 +896,16 @@ MODULE_INIT_FUNC(pycryptosat) // Add the version string so users know what version of CryptoMiniSat // they're using. +#if defined(_MSC_VER) + if (PyModule_AddStringConstant(m, "__version__", "unknown -- can't use /D to define strings in Windows, pypi and Windows CLI are both broken") { + Py_DECREF(m); + return NULL; + } + if (PyModule_AddStringConstant(m, "VERSION", "unknown -- can't use /D to define strings in Windows, pypi and Windows CLI are both broken") == -1) { + Py_DECREF(m); + return NULL; + } +#else if (PyModule_AddStringConstant(m, "__version__", CMS_FULL_VERSION) == -1) { Py_DECREF(m); return NULL; @@ -904,6 +914,8 @@ MODULE_INIT_FUNC(pycryptosat) Py_DECREF(m); return NULL; } +#endif + // Add the Solver type. Py_INCREF(&pycryptosat_SolverType); diff --git a/setup.py b/setup.py index 0966f6a6c..27d7fa4f3 100644 --- a/setup.py +++ b/setup.py @@ -49,12 +49,12 @@ def _parse_toml(pyproject_path): def gen_modules(version): if platform == "win32" or platform == "cygwin": - extra_compile_args_val = ['-I../', '-Isrc/', '/std:c++17', "/DCMS_FULL_VERSION=\\\"cms-"+version+"\\\""] + extra_compile_args_val = ['-I../', '-Isrc/', '/std:c++17', "/DCMS_FULL_VERSION=\""+version+"\""] define_macros_val = [("TRACE", "")] else: extra_compile_args_val = ['-I../', '-Isrc/', '-std=c++17'] - define_macros_val = [("TRACE", ""), ("CMS_FULL_VERSION", "\"cms-"+version+"\"")] + define_macros_val = [("TRACE", ""), ("CMS_FULL_VERSION", "\""+version+"\"")] modules = Extension( name = "pycryptosat",