diff --git a/cython/platform/config.h b/cython/platform/config.h deleted file mode 100644 index 68720cdc..00000000 --- a/cython/platform/config.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef SOLVESPACE_CONFIG_H -#define SOLVESPACE_CONFIG_H -#endif diff --git a/cython/platform/patch.diff b/cython/platform/cygwinccompiler.diff similarity index 100% rename from cython/platform/patch.diff rename to cython/platform/cygwinccompiler.diff diff --git a/cython/platform/pyconfig.diff b/cython/platform/pyconfig.diff new file mode 100644 index 00000000..0a31106c --- /dev/null +++ b/cython/platform/pyconfig.diff @@ -0,0 +1,15 @@ +--- pyconfig.h 2016-01-27 10:54:56.000000000 +0300 ++++ pyconfig.h 2016-03-28 11:46:48.000000000 +0300 +@@ -100,6 +100,12 @@ + + /* Compiler specific defines */ + ++#ifdef __MINGW32__ ++#ifdef _WIN64 ++#define MS_WIN64 ++#endif ++#endif ++ + /* ------------------------------------------------------------------------*/ + /* Microsoft C defines _MSC_VER */ + #ifdef _MSC_VER diff --git a/cython/platform/set_pycompiler.bat b/cython/platform/set_pycompiler.bat index 02d45e46..3e42cf8a 100644 --- a/cython/platform/set_pycompiler.bat +++ b/cython/platform/set_pycompiler.bat @@ -16,7 +16,8 @@ echo compiler=%COMPILER%>> "%DISTUTILS%" echo patched file "%DISTUTILS%" REM Apply the patch of "cygwinccompiler.py". REM Unix "patch" command of Msys. -patch -N "%PYTHON_DIR%\lib\distutils\cygwinccompiler.py" "%HERE%\patch.diff" +patch -N "%PYTHON_DIR%\lib\distutils\cygwinccompiler.py" "%HERE%\cygwinccompiler.diff" +patch -N "%PYTHON_DIR%\include\pyconfig.h" "%HERE%\pyconfig.diff" REM Copy "vcruntime140.dll" to "libs". copy "%PYTHON_DIR%\vcruntime140.dll" "%PYTHON_DIR%\libs" diff --git a/cython/setup.py b/cython/setup.py index 4464a272..db57e607 100644 --- a/cython/setup.py +++ b/cython/setup.py @@ -22,7 +22,6 @@ from distutils import sysconfig include_path = pth_join('python_solvespace', 'include') src_path = pth_join('python_solvespace', 'src') platform_path = pth_join(src_path, 'platform') -extra_path = 'platform' ver = sysconfig.get_config_var('VERSION') lib = sysconfig.get_config_var('BINDIR') @@ -76,9 +75,6 @@ if {'sdist', 'bdist'} & set(sys.argv): for s in ('utilwin', 'utilunix', 'platform'): sources.append(pth_join(platform_path, f'{s}.cpp')) elif system() == 'Windows': - # Avoid compile error with CYTHON_USE_PYLONG_INTERNALS. - # https://github.com/cython/cython/issues/2670#issuecomment-432212671 - macros.append(('MS_WIN64', None)) # Disable format warning compile_args.append('-Wno-format') # Solvespace arguments @@ -92,7 +88,7 @@ else: def copy_source(dry_run): dir_util.copy_tree(pth_join('..', 'include'), include_path, dry_run=dry_run) - dir_util.mkpath(pth_join('python_solvespace', 'src')) + dir_util.mkpath(src_path) for root, _, files in walk(pth_join('..', 'src')): for f in files: if not f.endswith('.h'): @@ -104,6 +100,7 @@ def copy_source(dry_run): file_util.copy_file(f, f_new, dry_run=dry_run) for f in sources[1:]: file_util.copy_file(f.replace('python_solvespace', '..'), f, dry_run=dry_run) + open(pth_join(platform_path, 'config.h'), 'a').close() class Build(build_ext): @@ -153,7 +150,7 @@ setup( "python_solvespace.slvs", sources, language="c++", - include_dirs=[include_path, src_path, platform_path, extra_path] + include_dirs=[include_path, src_path, platform_path] )], cmdclass={'build_ext': Build, 'sdist': PackSource}, zip_safe=False,