2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-24 02:40:26 +01:00

Disable GX warnings when buildin Python modules with Microsoft Visual Studio

Python distutils add the GX flag by default but that was for very old systems
and ./Lib/distutils/msvccompiler.py was removed in Python 3.12
This commit is contained in:
Waf Project 2024-10-28 23:35:33 +08:00
parent 51159c17ab
commit 6ec62d9bbf
5 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,10 @@
NEW IN WAF 2.1.3
----------------
* Work around a race condition in mingw Python
* Install Python artifacts under PREFIX in a similar way as waf-2.0
* Disable GX warnings when buildin Python modules with Microsoft Visual Studio
* Improve the build_logs (prevent log file collisions), PyQt (v6), Sphinx and Cuda examples
NEW IN WAF 2.1.2 NEW IN WAF 2.1.2
---------------- ----------------
* Work around some Python regressions * Work around some Python regressions

View File

@ -34,7 +34,7 @@ static struct PyModuleDef spammodule = {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit_spam(void) PyInit_spam(void)
{ {
(void) PyModule_Create(&spammodule); return PyModule_Create(&spammodule);
} }
#else #else

View File

@ -32,7 +32,7 @@ static struct PyModuleDef embmodule = {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit_emb(void) PyInit_emb(void)
{ {
(void) PyModule_Create(&embmodule); return PyModule_Create(&embmodule);
} }
#endif #endif

View File

@ -34,9 +34,11 @@ def build(bld):
bld(features='py', source=bld.path.ant_glob('*.py'), install_from='.') bld(features='py', source=bld.path.ant_glob('*.py'), install_from='.')
# example for generated python files # example for generated python files
target = bld.path.find_or_declare('abc.py') from waflib import Utils
bld(rule='touch ${TGT}', source='wscript', target=target) if not Utils.is_win32:
bld(features='py', source=[target], install_from=target.parent) target = bld.path.find_or_declare('abc.py')
bld(rule='touch ${TGT}', source='wscript', target=target)
bld(features='py', source=[target], install_from=target.parent)
# then a c extension module # then a c extension module
bld( bld(

View File

@ -476,8 +476,8 @@ def check_python_headers(conf, features='pyembed pyext'):
if env.CC_NAME == "msvc": if env.CC_NAME == "msvc":
# From https://github.com/python/cpython/blob/main/Lib/distutils/msvccompiler.py # From https://github.com/python/cpython/blob/main/Lib/distutils/msvccompiler.py
env.append_value('CFLAGS_PYEXT', [ '/nologo', '/Ox', '/MD', '/W3', '/GX', '/DNDEBUG']) env.append_value('CFLAGS_PYEXT', [ '/nologo', '/Ox', '/MD', '/W3', '/EHsc', '/DNDEBUG'])
env.append_value('CXXFLAGS_PYEXT', [ '/nologo', '/Ox', '/MD', '/W3', '/GX', '/DNDEBUG']) env.append_value('CXXFLAGS_PYEXT', [ '/nologo', '/Ox', '/MD', '/W3', '/EHsc', '/DNDEBUG'])
env.append_value('LINKFLAGS_PYEXT', ['/DLL', '/nologo', '/INCREMENTAL:NO']) env.append_value('LINKFLAGS_PYEXT', ['/DLL', '/nologo', '/INCREMENTAL:NO'])
# See if it compiles # See if it compiles