From d673b03560a7942b6edadf9ad2d0c4e9230dcf0a Mon Sep 17 00:00:00 2001 From: Mate Soos Date: Sat, 14 Oct 2023 19:32:51 +0200 Subject: [PATCH] Version for windows python module is very hard --- python/src/pyapproxmc.cpp | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/src/pyapproxmc.cpp b/python/src/pyapproxmc.cpp index de2a7dd..80a727d 100644 --- a/python/src/pyapproxmc.cpp +++ b/python/src/pyapproxmc.cpp @@ -450,6 +450,8 @@ PyMODINIT_FUNC PyInit_pyapproxmc(void) // Add the version string // they're using. +#if defined(_MSC_VER) +#else if (PyModule_AddStringConstant(m, "__version__", APPMC_FULL_VERSION) == -1) { Py_DECREF(m); return NULL; @@ -458,6 +460,7 @@ PyMODINIT_FUNC PyInit_pyapproxmc(void) Py_DECREF(m); return NULL; } +#endif // Add the Counter type Py_INCREF(&pyapproxmc_CounterType); diff --git a/setup.py b/setup.py index a04bc92..8f1726e 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ def _parse_toml(pyproject_path): def gen_modules(version): if platform == "win32" or platform == "cygwin": - extra_compile_args_val = ['/std:c++17', "/DCMS_LOCAL_BUILD=1", "/DAPPMC_FULL_VERSION=\"\\\""+version+"\"\\\""] + extra_compile_args_val = ['/std:c++17', "/DCMS_LOCAL_BUILD=1", "/DAPPMC_FULL_VERSION=\""+version+"\""] define_macros_val = [("TRACE", "")] else: